## # This code was generated by # \ / _ _ _| _ _ # | (_)\/(_)(_|\/| |(/_ v1.0.0 # / / # # frozen_string_literal: true require 'spec_helper.rb' describe 'Interaction' do it "can fetch" do @holodeck.mock(Twilio::Response.new(500, '')) expect { @client.preview.proxy.services('KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ .sessions('KCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ .interactions('KIXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').fetch() }.to raise_exception(Twilio::REST::TwilioError) values = {} expect( @holodeck.has_request?(Holodeck::Request.new( method: 'get', url: 'https://preview.twilio.com/Proxy/Services/KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Sessions/KCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Interactions/KIXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX', ))).to eq(true) end it "receives fetch responses" do @holodeck.mock(Twilio::Response.new( 200, %q[ { "service_sid": "KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "data": "data", "date_created": "2015-07-30T20:00:00Z", "date_updated": "2015-07-30T20:00:00Z", "inbound_participant_sid": "KPaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "inbound_resource_sid": "SMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "inbound_resource_status": "sent", "inbound_resource_type": "Message", "inbound_resource_url": null, "outbound_participant_sid": "KPbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", "outbound_resource_sid": "SMbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", "outbound_resource_status": "sent", "outbound_resource_type": "Message", "outbound_resource_url": null, "sid": "KIaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "status": "completed", "url": "https://preview.twilio.com/Proxy/Services/KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Sessions/KCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Interactions/KIaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "session_sid": "KCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" } ] )) actual = @client.preview.proxy.services('KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ .sessions('KCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ .interactions('KIXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').fetch() expect(actual).to_not eq(nil) end it "can read" do @holodeck.mock(Twilio::Response.new(500, '')) expect { @client.preview.proxy.services('KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ .sessions('KCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ .interactions.list() }.to raise_exception(Twilio::REST::TwilioError) values = {} expect( @holodeck.has_request?(Holodeck::Request.new( method: 'get', url: 'https://preview.twilio.com/Proxy/Services/KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Sessions/KCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Interactions', ))).to eq(true) end it "receives read_empty responses" do @holodeck.mock(Twilio::Response.new( 200, %q[ { "interactions": [], "meta": { "previous_page_url": null, "next_page_url": null, "url": "https://preview.twilio.com/Proxy/Services/KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Sessions/KCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Interactions?PageSize=50&Page=0", "page": 0, "first_page_url": "https://preview.twilio.com/Proxy/Services/KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Sessions/KCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Interactions?PageSize=50&Page=0", "page_size": 50, "key": "interactions" } } ] )) actual = @client.preview.proxy.services('KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ .sessions('KCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ .interactions.list() expect(actual).to_not eq(nil) end end