## # This code was generated by # \ / _ _ _| _ _ # | (_)\/(_)(_|\/| |(/_ v1.0.0 # / / # # frozen_string_literal: true require 'spec_helper.rb' describe 'WebChannel' do it "can read" do @holodeck.mock(Twilio::Response.new(500, '')) expect { @client.flex_api.v1.web_channel.list() }.to raise_exception(Twilio::REST::TwilioError) values = {} expect( @holodeck.has_request?(Holodeck::Request.new( method: 'get', url: 'https://flex-api.twilio.com/v1/WebChannels', ))).to eq(true) end it "receives read_full responses" do @holodeck.mock(Twilio::Response.new( 200, %q[ { "meta": { "page": 0, "page_size": 50, "first_page_url": "https://flex-api.twilio.com/v1/WebChannels?PageSize=50&Page=0", "previous_page_url": null, "url": "https://flex-api.twilio.com/v1/WebChannels?PageSize=50&Page=0", "next_page_url": null, "key": "flex_chat_channels" }, "flex_chat_channels": [ { "flex_flow_sid": "FOaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "sid": "CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "date_created": "2016-08-01T22:10:40Z", "date_updated": "2016-08-01T22:10:40Z", "url": "https://flex-api.twilio.com/v1/WebChannels/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" } ] } ] )) actual = @client.flex_api.v1.web_channel.list() expect(actual).to_not eq(nil) end it "receives read_empty responses" do @holodeck.mock(Twilio::Response.new( 200, %q[ { "meta": { "page": 0, "page_size": 50, "first_page_url": "https://flex-api.twilio.com/v1/WebChannels?PageSize=50&Page=0", "previous_page_url": null, "url": "https://flex-api.twilio.com/v1/WebChannels?PageSize=50&Page=0", "next_page_url": null, "key": "flex_chat_channels" }, "flex_chat_channels": [] } ] )) actual = @client.flex_api.v1.web_channel.list() expect(actual).to_not eq(nil) end it "can fetch" do @holodeck.mock(Twilio::Response.new(500, '')) expect { @client.flex_api.v1.web_channel('CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').fetch() }.to raise_exception(Twilio::REST::TwilioError) values = {} expect( @holodeck.has_request?(Holodeck::Request.new( method: 'get', url: 'https://flex-api.twilio.com/v1/WebChannels/CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX', ))).to eq(true) end it "receives fetch responses" do @holodeck.mock(Twilio::Response.new( 200, %q[ { "flex_flow_sid": "FOaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "sid": "CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "date_created": "2016-08-01T22:10:40Z", "date_updated": "2016-08-01T22:10:40Z", "url": "https://flex-api.twilio.com/v1/WebChannels/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" } ] )) actual = @client.flex_api.v1.web_channel('CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').fetch() expect(actual).to_not eq(nil) end it "can create" do @holodeck.mock(Twilio::Response.new(500, '')) expect { @client.flex_api.v1.web_channel.create(flex_flow_sid: 'FOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX', identity: 'identity', customer_friendly_name: 'customer_friendly_name', chat_friendly_name: 'chat_friendly_name') }.to raise_exception(Twilio::REST::TwilioError) values = { 'FlexFlowSid' => 'FOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX', 'Identity' => 'identity', 'CustomerFriendlyName' => 'customer_friendly_name', 'ChatFriendlyName' => 'chat_friendly_name', } expect( @holodeck.has_request?(Holodeck::Request.new( method: 'post', url: 'https://flex-api.twilio.com/v1/WebChannels', data: values, ))).to eq(true) end it "receives create responses" do @holodeck.mock(Twilio::Response.new( 201, %q[ { "flex_flow_sid": "FOaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "sid": "CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "date_created": "2016-08-01T22:10:40Z", "date_updated": "2016-08-01T22:10:40Z", "url": "https://flex-api.twilio.com/v1/WebChannels/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" } ] )) actual = @client.flex_api.v1.web_channel.create(flex_flow_sid: 'FOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX', identity: 'identity', customer_friendly_name: 'customer_friendly_name', chat_friendly_name: 'chat_friendly_name') expect(actual).to_not eq(nil) end it "can update" do @holodeck.mock(Twilio::Response.new(500, '')) expect { @client.flex_api.v1.web_channel('CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').update() }.to raise_exception(Twilio::REST::TwilioError) values = {} expect( @holodeck.has_request?(Holodeck::Request.new( method: 'post', url: 'https://flex-api.twilio.com/v1/WebChannels/CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX', ))).to eq(true) end it "receives update responses" do @holodeck.mock(Twilio::Response.new( 200, %q[ { "flex_flow_sid": "FOaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "sid": "CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "date_created": "2016-08-01T22:10:40Z", "date_updated": "2016-08-01T22:10:40Z", "url": "https://flex-api.twilio.com/v1/WebChannels/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" } ] )) actual = @client.flex_api.v1.web_channel('CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').update() expect(actual).to_not eq(nil) end it "can delete" do @holodeck.mock(Twilio::Response.new(500, '')) expect { @client.flex_api.v1.web_channel('CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').delete() }.to raise_exception(Twilio::REST::TwilioError) values = {} expect( @holodeck.has_request?(Holodeck::Request.new( method: 'delete', url: 'https://flex-api.twilio.com/v1/WebChannels/CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX', ))).to eq(true) end it "receives delete responses" do @holodeck.mock(Twilio::Response.new( 204, nil, )) actual = @client.flex_api.v1.web_channel('CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').delete() expect(actual).to eq(true) end end