## # This code was generated by # \ / _ _ _| _ _ # | (_)\/(_)(_|\/| |(/_ v1.0.0 # / / require 'spec_helper.rb' describe 'TaskQueue' do it "can fetch" do @holodeck.mock(Twilio::TwilioResponse.new(500, '')) expect { @client.taskrouter.v1.workspaces("WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \ .task_queues("WQaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").fetch() }.to raise_exception(Twilio::REST::TwilioException) values = {} expect( @holodeck.has_request?(Holodeck::Request.new( method: 'get', url: 'https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/TaskQueues/WQaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', ))).to eq(true) end it "receives fetch responses" do @holodeck.mock(Twilio::TwilioResponse.new( 200, %q[ { "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "assignment_activity_name": "817ca1c5-3a05-11e5-9292-98e0d9a1eb73", "assignment_activity_sid": "WAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "date_created": "2015-08-03T17:31:41Z", "date_updated": "2015-08-03T17:31:41Z", "friendly_name": "81f96435-3a05-11e5-9f81-98e0d9a1eb73", "max_reserved_workers": 1, "links": { "assignment_activity": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Activities/WAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "reservation_activity": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Activities/WAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "workspace": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" }, "reservation_activity_name": "80fa2beb-3a05-11e5-8fc8-98e0d9a1eb73", "reservation_activity_sid": "WAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "sid": "WQaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "target_workers": null, "url": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/TaskQueues/WQaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "workspace_sid": "WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" } ] )) actual = @client.taskrouter.v1.workspaces("WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \ .task_queues("WQaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").fetch() expect(actual).to_not eq(nil) end it "can update" do @holodeck.mock(Twilio::TwilioResponse.new(500, '')) expect { @client.taskrouter.v1.workspaces("WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \ .task_queues("WQaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").update() }.to raise_exception(Twilio::REST::TwilioException) values = {} expect( @holodeck.has_request?(Holodeck::Request.new( method: 'post', url: 'https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/TaskQueues/WQaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', ))).to eq(true) end it "receives update responses" do @holodeck.mock(Twilio::TwilioResponse.new( 200, %q[ { "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "assignment_activity_name": "817ca1c5-3a05-11e5-9292-98e0d9a1eb73", "assignment_activity_sid": "WAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "date_created": "2015-08-03T17:31:41Z", "date_updated": "2015-08-03T17:31:41Z", "friendly_name": "81f96435-3a05-11e5-9f81-98e0d9a1eb73", "max_reserved_workers": 1, "links": { "assignment_activity": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Activities/WAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "reservation_activity": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Activities/WAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "workspace": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" }, "reservation_activity_name": "80fa2beb-3a05-11e5-8fc8-98e0d9a1eb73", "reservation_activity_sid": "WAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "sid": "WQaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "target_workers": null, "url": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/TaskQueues/WQaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "workspace_sid": "WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" } ] )) actual = @client.taskrouter.v1.workspaces("WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \ .task_queues("WQaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").update() expect(actual).to_not eq(nil) end it "can read" do @holodeck.mock(Twilio::TwilioResponse.new(500, '')) expect { @client.taskrouter.v1.workspaces("WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \ .task_queues.list() }.to raise_exception(Twilio::REST::TwilioException) values = {} expect( @holodeck.has_request?(Holodeck::Request.new( method: 'get', url: 'https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/TaskQueues', ))).to eq(true) end it "receives read_full responses" do @holodeck.mock(Twilio::TwilioResponse.new( 200, %q[ { "meta": { "first_page_url": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/TaskQueues?PageSize=50&Page=0", "key": "task_queues", "next_page_url": null, "page": 0, "page_size": 50, "previous_page_url": null, "url": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/TaskQueues?PageSize=50&Page=0" }, "task_queues": [ { "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "assignment_activity_name": "817ca1c5-3a05-11e5-9292-98e0d9a1eb73", "assignment_activity_sid": "WAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "date_created": "2015-08-03T17:31:41Z", "date_updated": "2015-08-03T17:31:41Z", "friendly_name": "81f96435-3a05-11e5-9f81-98e0d9a1eb73", "max_reserved_workers": 1, "links": { "assignment_activity": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Activities/WAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "reservation_activity": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Activities/WAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "workspace": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" }, "reservation_activity_name": "80fa2beb-3a05-11e5-8fc8-98e0d9a1eb73", "reservation_activity_sid": "WAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "sid": "WQaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "target_workers": null, "url": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/TaskQueues/WQaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "workspace_sid": "WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" } ] } ] )) actual = @client.taskrouter.v1.workspaces("WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \ .task_queues.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://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/TaskQueues?PageSize=50&Page=0", "key": "task_queues", "next_page_url": null, "page": 0, "page_size": 50, "previous_page_url": null, "url": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/TaskQueues?PageSize=50&Page=0" }, "task_queues": [] } ] )) actual = @client.taskrouter.v1.workspaces("WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \ .task_queues.list() expect(actual).to_not eq(nil) end it "can create" do @holodeck.mock(Twilio::TwilioResponse.new(500, '')) expect { @client.taskrouter.v1.workspaces("WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \ .task_queues.create(friendly_name: "friendly_name", reservation_activity_sid: "WAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", assignment_activity_sid: "WAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") }.to raise_exception(Twilio::REST::TwilioException) values = { 'FriendlyName' => "friendly_name", 'ReservationActivitySid' => "WAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", 'AssignmentActivitySid' => "WAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", } expect( @holodeck.has_request?(Holodeck::Request.new( method: 'post', url: 'https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/TaskQueues', data: values, ))).to eq(true) end it "receives create responses" do @holodeck.mock(Twilio::TwilioResponse.new( 200, %q[ { "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "assignment_activity_name": "817ca1c5-3a05-11e5-9292-98e0d9a1eb73", "assignment_activity_sid": "WAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "date_created": "2015-08-03T17:31:41Z", "date_updated": "2015-08-03T17:31:41Z", "friendly_name": "81f96435-3a05-11e5-9f81-98e0d9a1eb73", "max_reserved_workers": 1, "links": { "assignment_activity": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Activities/WAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "reservation_activity": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Activities/WAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "workspace": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" }, "reservation_activity_name": "80fa2beb-3a05-11e5-8fc8-98e0d9a1eb73", "reservation_activity_sid": "WAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "sid": "WQaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "target_workers": null, "url": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/TaskQueues/WQaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "workspace_sid": "WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" } ] )) actual = @client.taskrouter.v1.workspaces("WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \ .task_queues.create(friendly_name: "friendly_name", reservation_activity_sid: "WAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", assignment_activity_sid: "WAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") expect(actual).to_not eq(nil) end it "can delete" do @holodeck.mock(Twilio::TwilioResponse.new(500, '')) expect { @client.taskrouter.v1.workspaces("WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \ .task_queues("WQaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").delete() }.to raise_exception(Twilio::REST::TwilioException) values = {} expect( @holodeck.has_request?(Holodeck::Request.new( method: 'delete', url: 'https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/TaskQueues/WQaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', ))).to eq(true) end it "receives delete responses" do @holodeck.mock(Twilio::TwilioResponse.new( 204, nil, )) actual = @client.taskrouter.v1.workspaces("WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \ .task_queues("WQaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").delete() expect(actual).to eq(true) end end