## # This code was generated by # \ / _ _ _| _ _ # | (_)\/(_)(_|\/| |(/_ v1.0.0 # / / require 'spec_helper.rb' describe 'Country' do it "can read" do @holodeck.mock(Twilio::Response.new(500, '')) expect { @client.pricing.v1.voice \ .countries.list() }.to raise_exception(Twilio::REST::TwilioError) values = {} expect( @holodeck.has_request?(Holodeck::Request.new( method: 'get', url: 'https://pricing.twilio.com/v1/Voice/Countries', ))).to eq(true) end it "receives read_full responses" do @holodeck.mock(Twilio::Response.new( 200, %q[ { "countries": [ { "country": "Andorra", "iso_country": "AD", "url": "https://pricing.twilio.com/v1/Voice/Countries/AD" } ], "meta": { "first_page_url": "https://pricing.twilio.com/v1/Voice/Countries?PageSize=50&Page=0", "key": "countries", "next_page_url": null, "page": 0, "page_size": 50, "previous_page_url": null, "url": "https://pricing.twilio.com/v1/Voice/Countries?PageSize=50&Page=0" } } ] )) actual = @client.pricing.v1.voice \ .countries.list() expect(actual).to_not eq(nil) end it "receives read_empty responses" do @holodeck.mock(Twilio::Response.new( 200, %q[ { "countries": [], "meta": { "first_page_url": "https://pricing.twilio.com/v1/Voice/Countries?PageSize=50&Page=0", "key": "countries", "next_page_url": null, "page": 0, "page_size": 50, "previous_page_url": null, "url": "https://pricing.twilio.com/v1/Voice/Countries?PageSize=50&Page=0" } } ] )) actual = @client.pricing.v1.voice \ .countries.list() expect(actual).to_not eq(nil) end it "can fetch" do @holodeck.mock(Twilio::Response.new(500, '')) expect { @client.pricing.v1.voice \ .countries('US').fetch() }.to raise_exception(Twilio::REST::TwilioError) values = {} expect( @holodeck.has_request?(Holodeck::Request.new( method: 'get', url: 'https://pricing.twilio.com/v1/Voice/Countries/US', ))).to eq(true) end it "receives fetch responses" do @holodeck.mock(Twilio::Response.new( 200, %q[ { "country": "United States", "inbound_call_prices": [ { "current_price": "0.0085", "number_type": "local", "base_price": "0.0085" }, { "current_price": "0.022", "number_type": "toll free", "base_price": "0.022" } ], "iso_country": "US", "outbound_prefix_prices": [ { "prefixes": [ "1907" ], "current_price": "0.090", "friendly_name": "Programmable Outbound Minute - United States - Alaska", "base_price": "0.090" } ], "price_unit": "USD", "url": "https://pricing.twilio.com/v1/Voice/Countries/US" } ] )) actual = @client.pricing.v1.voice \ .countries('US').fetch() expect(actual).to_not eq(nil) end end