spec/integration/api/v2010/account/conference/participant_spec.rb in twilio-ruby-5.0.0.rc18 vs spec/integration/api/v2010/account/conference/participant_spec.rb in twilio-ruby-5.0.0.rc19

- old
+ new

@@ -1,23 +1,23 @@ ## # This code was generated by # \ / _ _ _| _ _ # | (_)\/(_)(_|\/| |(/_ v1.0.0 -# / / +# / / require 'spec_helper.rb' describe 'Participant' do it "can fetch" do @holodeck.mock(Twilio::TwilioResponse.new(500, '')) - + expect { @client.api.v2010.accounts("ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \ .conferences("CFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \ .participants("CAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").fetch() }.to raise_exception(Twilio::REST::TwilioException) - + 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', @@ -35,32 +35,33 @@ "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::TwilioResponse.new(500, '')) - + expect { @client.api.v2010.accounts("ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \ .conferences("CFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \ .participants("CAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").update() }.to raise_exception(Twilio::REST::TwilioException) - + 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', @@ -78,32 +79,108 @@ "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::TwilioResponse.new(500, '')) + + expect { + @client.api.v2010.accounts("ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \ + .conferences("CFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \ + .participants.create(from: "+987654321", to: "+123456789") + }.to raise_exception(Twilio::REST::TwilioException) + + 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::TwilioResponse.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::TwilioResponse.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::TwilioResponse.new(500, '')) - + expect { @client.api.v2010.accounts("ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \ .conferences("CFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \ .participants("CAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").delete() }.to raise_exception(Twilio::REST::TwilioException) - + 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', @@ -113,27 +190,27 @@ it "receives delete responses" do @holodeck.mock(Twilio::TwilioResponse.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::TwilioResponse.new(500, '')) - + expect { @client.api.v2010.accounts("ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \ .conferences("CFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \ .participants.list() }.to raise_exception(Twilio::REST::TwilioException) - + values = {} expect( @holodeck.has_request?(Holodeck::Request.new( method: 'get', url: 'https://api.twilio.com/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conferences/CFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants.json', @@ -145,13 +222,11 @@ 200, %q[ { "end": 0, "first_page_uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conferences/CFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants.json?Page=0&PageSize=50", - "last_page_uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conferences/CFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants.json?Page=0&PageSize=50", "next_page_uri": null, - "num_pages": 1, "page": 0, "page_size": 50, "participants": [ { "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", @@ -160,52 +235,49 @@ "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, - "total": 1, "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::TwilioResponse.new( 200, %q[ { "end": 0, "first_page_uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conferences/CFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants.json?Page=0&PageSize=50", - "last_page_uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conferences/CFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants.json?Page=0&PageSize=50", "next_page_uri": null, - "num_pages": 1, "page": 0, "page_size": 50, "participants": [], "previous_page_uri": null, "start": 0, - "total": 1, "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 \ No newline at end of file