## # This code was generated by # \ / _ _ _| _ _ # | (_)\/(_)(_|\/| |(/_ v1.0.0 # / / # # frozen_string_literal: true require 'spec_helper.rb' describe 'Country' do it "can fetch" do @holodeck.mock(Twilio::Response.new(500, '')) expect { @client.voice.v1.dialing_permissions \ .countries('US').fetch() }.to raise_exception(Twilio::REST::TwilioError) values = {} expect( @holodeck.has_request?(Holodeck::Request.new( method: 'get', url: 'https://voice.twilio.com/v1/DialingPermissions/Countries/US', ))).to eq(true) end it "receives fetch responses" do @holodeck.mock(Twilio::Response.new( 200, %q[ { "iso_code": "US", "name": "United States/Canada", "country_codes": [ "+1" ], "continent": "NORTH_AMERICA", "low_risk_numbers_enabled": false, "high_risk_special_numbers_enabled": false, "high_risk_tollfraud_numbers_enabled": false, "url": "https://voice.twilio.com/v1/DialingPermissions/Countries/US", "links": { "highrisk_special_prefixes": "https://voice.twilio.com/v1/DialingPermissions/Countries/US/HighRiskSpecialPrefixes" } } ] )) actual = @client.voice.v1.dialing_permissions \ .countries('US').fetch() expect(actual).to_not eq(nil) end it "can read" do @holodeck.mock(Twilio::Response.new(500, '')) expect { @client.voice.v1.dialing_permissions \ .countries.list() }.to raise_exception(Twilio::REST::TwilioError) values = {} expect( @holodeck.has_request?(Holodeck::Request.new( method: 'get', url: 'https://voice.twilio.com/v1/DialingPermissions/Countries', ))).to eq(true) end it "receives read_us responses" do @holodeck.mock(Twilio::Response.new( 200, %q[ { "content": [ { "iso_code": "US", "name": "United States/Canada", "country_codes": [ "+1" ], "continent": "NORTH_AMERICA", "low_risk_numbers_enabled": false, "high_risk_special_numbers_enabled": false, "high_risk_tollfraud_numbers_enabled": false, "url": "https://voice.twilio.com/v1/DialingPermissions/Countries/US", "links": { "highrisk_special_prefixes": "https://voice.twilio.com/v1/DialingPermissions/Countries/US/HighRiskSpecialPrefixes" } } ], "meta": { "first_page_url": "https://voice.twilio.com/v1/DialingPermissions/Countries?PageSize=50&Page=0", "key": "content", "next_page_url": null, "page": 0, "page_size": 50, "previous_page_url": null, "url": "https://voice.twilio.com/v1/DialingPermissions/Countries?PageSize=50&Page=0" } } ] )) actual = @client.voice.v1.dialing_permissions \ .countries.list() expect(actual).to_not eq(nil) end end