## # 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.phone_numbers \ .countries.list() }.to raise_exception(Twilio::REST::TwilioError) values = {} expect( @holodeck.has_request?(Holodeck::Request.new( method: 'get', url: 'https://pricing.twilio.com/v1/PhoneNumbers/Countries', ))).to eq(true) end it "receives read_full responses" do @holodeck.mock(Twilio::Response.new( 200, %q[ { "countries": [ { "country": "Austria", "iso_country": "AT", "url": "https://pricing.twilio.com/v1/PhoneNumbers/Countries/AT" } ], "meta": { "first_page_url": "https://pricing.twilio.com/v1/PhoneNumbers/Countries?PageSize=1&Page=0", "key": "countries", "next_page_url": null, "page": 0, "page_size": 1, "previous_page_url": null, "url": "https://pricing.twilio.com/v1/PhoneNumbers/Countries?PageSize=1&Page=0" } } ] )) actual = @client.pricing.v1.phone_numbers \ .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/PhoneNumbers/Countries?PageSize=1&Page=0", "key": "countries", "next_page_url": null, "page": 0, "page_size": 1, "previous_page_url": null, "url": "https://pricing.twilio.com/v1/PhoneNumbers/Countries?PageSize=1&Page=0" } } ] )) actual = @client.pricing.v1.phone_numbers \ .countries.list() expect(actual).to_not eq(nil) end it "can fetch" do @holodeck.mock(Twilio::Response.new(500, '')) expect { @client.pricing.v1.phone_numbers \ .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/PhoneNumbers/Countries/US', ))).to eq(true) end it "receives fetch responses" do @holodeck.mock(Twilio::Response.new( 200, %q[ { "country": "Estonia", "iso_country": "EE", "phone_number_prices": [ { "base_price": 3.0, "current_price": 3.0, "type": "mobile" }, { "base_price": 1.0, "current_price": 1.0, "type": "national" } ], "price_unit": "usd", "url": "https://pricing.twilio.com/v1/PhoneNumbers/Countries/US" } ] )) actual = @client.pricing.v1.phone_numbers \ .countries("US").fetch() expect(actual).to_not eq(nil) end end