## # This code was generated by # \ / _ _ _| _ _ # | (_)\/(_)(_|\/| |(/_ v1.0.0 # / / require 'spec_helper.rb' describe 'Participant' do it "can fetch" do @holodeck.mock(Twilio::Response.new(500, '')) expect { @client.api.v2010.accounts("ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \ .conferences("CFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \ .participants("CAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").fetch() }.to raise_exception(Twilio::REST::TwilioError) values = {} expect( @holodeck.has_request?(Holodeck::Request.new( method: 'get', url: 'https://api.twilio.com/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conferences/CFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants/CAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.json', ))).to eq(true) end it "receives fetch responses" do @holodeck.mock(Twilio::Response.new( 200, %q[ { "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "call_sid": "CAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "conference_sid": "CFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "date_created": "Fri, 18 Feb 2011 21:07:19 +0000", "date_updated": "Fri, 18 Feb 2011 21:07:19 +0000", "end_conference_on_exit": false, "muted": false, "hold": false, "status": "complete", "start_conference_on_enter": true, "uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conferences/CFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants/CAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.json" } ] )) actual = @client.api.v2010.accounts("ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \ .conferences("CFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \ .participants("CAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").fetch() expect(actual).to_not eq(nil) end it "can update" do @holodeck.mock(Twilio::Response.new(500, '')) expect { @client.api.v2010.accounts("ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \ .conferences("CFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \ .participants("CAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").update() }.to raise_exception(Twilio::REST::TwilioError) values = {} expect( @holodeck.has_request?(Holodeck::Request.new( method: 'post', url: 'https://api.twilio.com/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conferences/CFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants/CAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.json', ))).to eq(true) end it "receives update responses" do @holodeck.mock(Twilio::Response.new( 200, %q[ { "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "call_sid": "CAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "conference_sid": "CFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "date_created": "Fri, 18 Feb 2011 21:07:19 +0000", "date_updated": "Fri, 18 Feb 2011 21:07:19 +0000", "end_conference_on_exit": false, "muted": false, "hold": false, "status": "complete", "start_conference_on_enter": true, "uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conferences/CFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants/CAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.json" } ] )) actual = @client.api.v2010.accounts("ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \ .conferences("CFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \ .participants("CAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").update() expect(actual).to_not eq(nil) end it "can create" do @holodeck.mock(Twilio::Response.new(500, '')) expect { @client.api.v2010.accounts("ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \ .conferences("CFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \ .participants.create(from: "+987654321", to: "+123456789") }.to raise_exception(Twilio::REST::TwilioError) values = {'From' => "+987654321", 'To' => "+123456789",} expect( @holodeck.has_request?(Holodeck::Request.new( method: 'post', url: 'https://api.twilio.com/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conferences/CFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants.json', data: values, ))).to eq(true) end it "receives create_with_sid responses" do @holodeck.mock(Twilio::Response.new( 201, %q[ { "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "call_sid": "CAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "conference_sid": "CFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "date_created": "Fri, 18 Feb 2011 21:07:19 +0000", "date_updated": "Fri, 18 Feb 2011 21:07:19 +0000", "end_conference_on_exit": false, "muted": false, "hold": false, "status": "complete", "start_conference_on_enter": true, "uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conferences/CFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants/CAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.json" } ] )) actual = @client.api.v2010.accounts("ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \ .conferences("CFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \ .participants.create(from: "+987654321", to: "+123456789") expect(actual).to_not eq(nil) end it "receives create_with_friendly_name responses" do @holodeck.mock(Twilio::Response.new( 201, %q[ { "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "call_sid": "CAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "conference_sid": "CFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "date_created": "Fri, 18 Feb 2011 21:07:19 +0000", "date_updated": "Fri, 18 Feb 2011 21:07:19 +0000", "end_conference_on_exit": false, "muted": false, "hold": false, "status": "complete", "start_conference_on_enter": true, "uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conferences/CFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants/CAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.json" } ] )) actual = @client.api.v2010.accounts("ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \ .conferences("CFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \ .participants.create(from: "+987654321", to: "+123456789") expect(actual).to_not eq(nil) end it "can delete" do @holodeck.mock(Twilio::Response.new(500, '')) expect { @client.api.v2010.accounts("ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \ .conferences("CFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \ .participants("CAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").delete() }.to raise_exception(Twilio::REST::TwilioError) values = {} expect( @holodeck.has_request?(Holodeck::Request.new( method: 'delete', url: 'https://api.twilio.com/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conferences/CFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants/CAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.json', ))).to eq(true) end it "receives delete responses" do @holodeck.mock(Twilio::Response.new( 204, nil, )) actual = @client.api.v2010.accounts("ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \ .conferences("CFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \ .participants("CAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").delete() expect(actual).to eq(true) end it "can read" do @holodeck.mock(Twilio::Response.new(500, '')) expect { @client.api.v2010.accounts("ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \ .conferences("CFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \ .participants.list() }.to raise_exception(Twilio::REST::TwilioError) values = {} expect( @holodeck.has_request?(Holodeck::Request.new( method: 'get', url: 'https://api.twilio.com/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conferences/CFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants.json', ))).to eq(true) end it "receives read_full responses" do @holodeck.mock(Twilio::Response.new( 200, %q[ { "end": 0, "first_page_uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conferences/CFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants.json?Page=0&PageSize=50", "next_page_uri": null, "page": 0, "page_size": 50, "participants": [ { "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "call_sid": "CAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "conference_sid": "CFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "date_created": "Fri, 18 Feb 2011 21:07:19 +0000", "date_updated": "Fri, 18 Feb 2011 21:07:19 +0000", "end_conference_on_exit": false, "muted": false, "hold": false, "status": "complete", "start_conference_on_enter": true, "uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conferences/CFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants/CAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.json" } ], "previous_page_uri": null, "start": 0, "uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conferences/CFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants.json" } ] )) actual = @client.api.v2010.accounts("ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \ .conferences("CFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \ .participants.list() expect(actual).to_not eq(nil) end it "receives read_empty responses" do @holodeck.mock(Twilio::Response.new( 200, %q[ { "end": 0, "first_page_uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conferences/CFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants.json?Page=0&PageSize=50", "next_page_uri": null, "page": 0, "page_size": 50, "participants": [], "previous_page_uri": null, "start": 0, "uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conferences/CFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants.json" } ] )) actual = @client.api.v2010.accounts("ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \ .conferences("CFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \ .participants.list() expect(actual).to_not eq(nil) end end