## # This code was generated by # \ / _ _ _| _ _ # | (_)\/(_)(_|\/| |(/_ v1.0.0 # / / # # frozen_string_literal: true require 'spec_helper.rb' describe 'TerminatingSipDomain' do it "can fetch" do @holodeck.mock(Twilio::Response.new(500, '')) expect { @client.trunking.v1.trunks('TRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ .terminating_sip_domains('SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').fetch() }.to raise_exception(Twilio::REST::TwilioError) values = {} expect( @holodeck.has_request?(Holodeck::Request.new( method: 'get', url: 'https://trunking.twilio.com/v1/Trunks/TRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/TerminatingSipDomains/SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX', ))).to eq(true) end it "receives fetch responses" do @holodeck.mock(Twilio::Response.new( 200, %q[ { "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "api_version": "2010-04-01", "auth_type": "IP_ACL", "date_created": "2015-07-20T17:27:10Z", "date_updated": "2015-10-09T11:36:32Z", "domain_name": "dunder-mifflin-scranton.sip.twilio.com", "friendly_name": "Scranton Office", "sip_registration": true, "sid": "SDaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "url": "https://trunking.twilio.com/v1/Trunks/TRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/TerminatingSipDomains/SDaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "voice_fallback_method": "POST", "voice_fallback_url": null, "voice_method": "POST", "voice_status_callback_method": "POST", "voice_status_callback_url": null, "voice_url": "https://demo.twilio.com/welcome/voice/", "trunk_sid": "TRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "links": { "sip_domain": "https://api.twilio.com/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/SIP/Domains/SDaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" } } ] )) actual = @client.trunking.v1.trunks('TRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ .terminating_sip_domains('SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').fetch() expect(actual).to_not eq(nil) end it "can delete" do @holodeck.mock(Twilio::Response.new(500, '')) expect { @client.trunking.v1.trunks('TRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ .terminating_sip_domains('SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').delete() }.to raise_exception(Twilio::REST::TwilioError) values = {} expect( @holodeck.has_request?(Holodeck::Request.new( method: 'delete', url: 'https://trunking.twilio.com/v1/Trunks/TRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/TerminatingSipDomains/SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX', ))).to eq(true) end it "receives delete responses" do @holodeck.mock(Twilio::Response.new( 204, nil, )) actual = @client.trunking.v1.trunks('TRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ .terminating_sip_domains('SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').delete() expect(actual).to eq(true) end it "can create" do @holodeck.mock(Twilio::Response.new(500, '')) expect { @client.trunking.v1.trunks('TRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ .terminating_sip_domains.create(sip_domain_sid: 'SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') }.to raise_exception(Twilio::REST::TwilioError) values = {'SipDomainSid' => 'SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX', } expect( @holodeck.has_request?(Holodeck::Request.new( method: 'post', url: 'https://trunking.twilio.com/v1/Trunks/TRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/TerminatingSipDomains', data: values, ))).to eq(true) end it "receives create responses" do @holodeck.mock(Twilio::Response.new( 201, %q[ { "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "api_version": "2010-04-01", "auth_type": "IP_ACL", "date_created": "2015-07-20T17:27:10Z", "date_updated": "2015-10-09T11:36:32Z", "domain_name": "dunder-mifflin-scranton.sip.twilio.com", "friendly_name": "Scranton Office", "sip_registration": true, "sid": "SDaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "url": "https://trunking.twilio.com/v1/Trunks/TRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/TerminatingSipDomains/SDaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "voice_fallback_method": "POST", "voice_fallback_url": null, "voice_method": "POST", "voice_status_callback_method": "POST", "voice_status_callback_url": null, "voice_url": "https://demo.twilio.com/welcome/voice/", "trunk_sid": "TRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "links": { "sip_domain": "https://api.twilio.com/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/SIP/Domains/SDaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" } } ] )) actual = @client.trunking.v1.trunks('TRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ .terminating_sip_domains.create(sip_domain_sid: 'SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') expect(actual).to_not eq(nil) end it "can read" do @holodeck.mock(Twilio::Response.new(500, '')) expect { @client.trunking.v1.trunks('TRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ .terminating_sip_domains.list() }.to raise_exception(Twilio::REST::TwilioError) values = {} expect( @holodeck.has_request?(Holodeck::Request.new( method: 'get', url: 'https://trunking.twilio.com/v1/Trunks/TRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/TerminatingSipDomains', ))).to eq(true) end it "receives read_full responses" do @holodeck.mock(Twilio::Response.new( 200, %q[ { "meta": { "first_page_url": "https://trunking.twilio.com/v1/Trunks/TRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/TerminatingSipDomains?PageSize=50&Page=0", "key": "sip_domains", "next_page_url": null, "page": 0, "page_size": 50, "previous_page_url": null, "url": "https://trunking.twilio.com/v1/Trunks/TRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/TerminatingSipDomains?PageSize=50&Page=0" }, "sip_domains": [ { "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "api_version": "2010-04-01", "auth_type": "IP_ACL", "date_created": "2015-07-20T17:27:10Z", "date_updated": "2015-10-09T11:36:32Z", "domain_name": "dunder-mifflin-scranton.sip.twilio.com", "friendly_name": "Scranton Office", "sip_registration": true, "sid": "SDaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "url": "https://trunking.twilio.com/v1/Trunks/TRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/TerminatingSipDomains/SDaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "voice_fallback_method": "POST", "voice_fallback_url": null, "voice_method": "POST", "voice_status_callback_method": "POST", "voice_status_callback_url": null, "voice_url": "https://demo.twilio.com/welcome/voice/", "trunk_sid": "TRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "links": { "sip_domain": "https://api.twilio.com/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/SIP/Domains/SDaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" } } ] } ] )) actual = @client.trunking.v1.trunks('TRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ .terminating_sip_domains.list() expect(actual).to_not eq(nil) end it "receives read_empty responses" do @holodeck.mock(Twilio::Response.new( 200, %q[ { "meta": { "first_page_url": "https://trunking.twilio.com/v1/Trunks/TRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/TerminatingSipDomains?PageSize=50&Page=0", "key": "sip_domains", "next_page_url": null, "page": 0, "page_size": 50, "previous_page_url": null, "url": "https://trunking.twilio.com/v1/Trunks/TRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/TerminatingSipDomains?PageSize=50&Page=0" }, "sip_domains": [] } ] )) actual = @client.trunking.v1.trunks('TRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ .terminating_sip_domains.list() expect(actual).to_not eq(nil) end end