## # This code was generated by # \ / _ _ _| _ _ # | (_)\/(_)(_|\/| |(/_ v1.0.0 # / / require 'spec_helper.rb' describe 'Participant' do it "can read" do @holodeck.mock(Twilio::TwilioResponse.new(500, '')) expect { @client.conversations.v1.conversations("CVaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \ .participants.list() }.to raise_exception(Twilio::REST::TwilioException) values = {} expect( @holodeck.has_request?(Holodeck::Request.new( method: 'get', url: 'https://conversations.twilio.com/v1/Conversations/CVaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants', ))).to eq(true) end it "receives read_full responses" do @holodeck.mock(Twilio::TwilioResponse.new( 200, %q[ { "meta": { "first_page_url": "https://conversations.twilio.com/v1/Conversations/CVaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants?PageSize=50&Page=0", "key": "participants", "next_page_url": null, "page": 0, "page_size": 50, "previous_page_url": null, "url": "https://conversations.twilio.com/v1/Conversations/CVaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants?PageSize=50&Page=0" }, "participants": [ { "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "address": "torkel2@ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.endpoint.twilio.com", "conversation_sid": "CVaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "date_created": "2015-05-13T23:03:12Z", "duration": 685, "end_time": "2015-05-13T23:14:40Z", "sid": "PAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "start_time": "2015-05-13T23:03:15Z", "status": "disconnected", "url": "https://conversations.twilio.com/v1/Conversations/CVaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants/PAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" } ] } ] )) actual = @client.conversations.v1.conversations("CVaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \ .participants.list() expect(actual).to_not eq(nil) end it "receives read_empty responses" do @holodeck.mock(Twilio::TwilioResponse.new( 200, %q[ { "meta": { "first_page_url": "https://conversations.twilio.com/v1/Conversations/CVaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants?PageSize=50&Page=0", "key": "participants", "next_page_url": null, "page": 0, "page_size": 50, "previous_page_url": null, "url": "https://conversations.twilio.com/v1/Conversations/CVaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants?PageSize=50&Page=0" }, "participants": [] } ] )) actual = @client.conversations.v1.conversations("CVaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \ .participants.list() expect(actual).to_not eq(nil) end it "can create" do @holodeck.mock(Twilio::TwilioResponse.new(500, '')) expect { @client.conversations.v1.conversations("CVaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \ .participants.create(to: "+123456789", from: "+987654321") }.to raise_exception(Twilio::REST::TwilioException) values = { 'To' => "+123456789", 'From' => "+987654321", } expect( @holodeck.has_request?(Holodeck::Request.new( method: 'post', url: 'https://conversations.twilio.com/v1/Conversations/CVaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants', data: values, ))).to eq(true) end it "receives create responses" do @holodeck.mock(Twilio::TwilioResponse.new( 200, %q[ { "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "address": "torkel2@ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.endpoint.twilio.com", "conversation_sid": "CVaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "date_created": "2015-05-13T23:03:12Z", "duration": 685, "end_time": "2015-05-13T23:14:40Z", "sid": "PAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "start_time": "2015-05-13T23:03:15Z", "status": "disconnected", "url": "https://conversations.twilio.com/v1/Conversations/CVaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants/PAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" } ] )) actual = @client.conversations.v1.conversations("CVaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \ .participants.create(to: "+123456789", from: "+987654321") expect(actual).to_not eq(nil) end it "can fetch" do @holodeck.mock(Twilio::TwilioResponse.new(500, '')) expect { @client.conversations.v1.conversations("CVaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \ .participants("PAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").fetch() }.to raise_exception(Twilio::REST::TwilioException) values = {} expect( @holodeck.has_request?(Holodeck::Request.new( method: 'get', url: 'https://conversations.twilio.com/v1/Conversations/CVaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants/PAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', ))).to eq(true) end it "receives fetch responses" do @holodeck.mock(Twilio::TwilioResponse.new( 200, %q[ { "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "address": "torkel2@ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.endpoint.twilio.com", "conversation_sid": "CVaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "date_created": "2015-05-13T23:03:12Z", "duration": 685, "end_time": "2015-05-13T23:14:40Z", "sid": "PAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "start_time": "2015-05-13T23:03:15Z", "status": "disconnected", "url": "https://conversations.twilio.com/v1/Conversations/CVaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants/PAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" } ] )) actual = @client.conversations.v1.conversations("CVaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \ .participants("PAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").fetch() expect(actual).to_not eq(nil) end end