## # This code was generated by # \ / _ _ _| _ _ # | (_)\/(_)(_|\/| |(/_ v1.0.0 # / / require 'spec_helper.rb' describe 'Service' do it "can create" do @holodeck.mock(Twilio::TwilioResponse.new(500, '')) expect { @client.notifications.v1.services.create() }.to raise_exception(Twilio::REST::TwilioException) values = {} expect( @holodeck.has_request?(Holodeck::Request.new( method: 'post', url: 'https://notifications.twilio.com/v1/Services', ))).to eq(true) end it "receives create responses" do @holodeck.mock(Twilio::TwilioResponse.new( 201, %q[ { "sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "friendly_name": "733c7f0f-6541-42ec-84ce-e2ae1cac588c", "date_created": "2016-03-09T20:22:31Z", "date_updated": "2016-03-09T20:22:31Z", "apn_credential_sid": null, "gcm_credential_sid": null, "messaging_service_sid": null, "facebook_messenger_page_id": "4", "default_apn_notification_protocol_version": "3", "default_gcm_notification_protocol_version": "3", "url": "https://notifications.stage.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "links": { "bindings": "https://notifications.stage.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Bindings", "notifications": "https://notifications.stage.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Notifications" } } ] )) actual = @client.notifications.v1.services.create() expect(actual).to_not eq(nil) end it "can delete" do @holodeck.mock(Twilio::TwilioResponse.new(500, '')) expect { @client.notifications.v1.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").delete() }.to raise_exception(Twilio::REST::TwilioException) values = {} expect( @holodeck.has_request?(Holodeck::Request.new( method: 'delete', url: 'https://notifications.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', ))).to eq(true) end it "receives delete responses" do @holodeck.mock(Twilio::TwilioResponse.new( 204, nil, )) actual = @client.notifications.v1.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").delete() expect(actual).to eq(true) end it "can fetch" do @holodeck.mock(Twilio::TwilioResponse.new(500, '')) expect { @client.notifications.v1.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").fetch() }.to raise_exception(Twilio::REST::TwilioException) values = {} expect( @holodeck.has_request?(Holodeck::Request.new( method: 'get', url: 'https://notifications.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', ))).to eq(true) end it "receives fetch responses" do @holodeck.mock(Twilio::TwilioResponse.new( 200, %q[ { "sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "friendly_name": "733c7f0f-6541-42ec-84ce-e2ae1cac588c", "date_created": "2016-03-09T20:22:31Z", "date_updated": "2016-03-09T20:22:31Z", "apn_credential_sid": null, "gcm_credential_sid": null, "messaging_service_sid": null, "facebook_messenger_page_id": "4", "default_apn_notification_protocol_version": "3", "default_gcm_notification_protocol_version": "3", "url": "https://notifications.stage.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "links": { "bindings": "https://notifications.stage.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Bindings", "notifications": "https://notifications.stage.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Notifications" } } ] )) actual = @client.notifications.v1.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").fetch() expect(actual).to_not eq(nil) end it "can read" do @holodeck.mock(Twilio::TwilioResponse.new(500, '')) expect { @client.notifications.v1.services.list() }.to raise_exception(Twilio::REST::TwilioException) values = {} expect( @holodeck.has_request?(Holodeck::Request.new( method: 'get', url: 'https://notifications.twilio.com/v1/Services', ))).to eq(true) end it "receives read_full responses" do @holodeck.mock(Twilio::TwilioResponse.new( 200, %q[ { "meta": { "page": 0, "page_size": 1, "first_page_url": "https://notifications.twilio.com/v1/Services?PageSize=1&Page=0", "previous_page_url": null, "url": "https://notifications.twilio.com/v1/Services?PageSize=1&Page=0", "next_page_url": null, "key": "services" }, "services": [ { "sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "friendly_name": "733c7f0f-6541-42ec-84ce-e2ae1cac588c", "date_created": "2016-03-09T20:22:31Z", "date_updated": "2016-03-09T20:22:31Z", "apn_credential_sid": null, "gcm_credential_sid": null, "messaging_service_sid": null, "facebook_messenger_page_id": "4", "default_apn_notification_protocol_version": "3", "default_gcm_notification_protocol_version": "3", "url": "https://notifications.stage.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "links": { "bindings": "https://notifications.stage.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Bindings", "notifications": "https://notifications.stage.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Notifications" } } ] } ] )) actual = @client.notifications.v1.services.list() expect(actual).to_not eq(nil) end it "receives read_empty responses" do @holodeck.mock(Twilio::TwilioResponse.new( 200, %q[ { "meta": { "page": 0, "page_size": 50, "first_page_url": "https://notifications.twilio.com/v1/Services?PageSize=50&Page=0", "previous_page_url": null, "url": "https://notifications.twilio.com/v1/Services?PageSize=50&Page=0", "next_page_url": null, "key": "services" }, "services": [] } ] )) actual = @client.notifications.v1.services.list() expect(actual).to_not eq(nil) end it "can update" do @holodeck.mock(Twilio::TwilioResponse.new(500, '')) expect { @client.notifications.v1.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").update() }.to raise_exception(Twilio::REST::TwilioException) values = {} expect( @holodeck.has_request?(Holodeck::Request.new( method: 'post', url: 'https://notifications.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', ))).to eq(true) end it "receives update responses" do @holodeck.mock(Twilio::TwilioResponse.new( 200, %q[ { "sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "friendly_name": "733c7f0f-6541-42ec-84ce-e2ae1cac588c", "date_created": "2016-03-09T20:22:31Z", "date_updated": "2016-03-09T20:22:31Z", "apn_credential_sid": null, "gcm_credential_sid": null, "default_apn_notification_protocol_version": "3", "default_gcm_notification_protocol_version": "3", "messaging_service_sid": null, "facebook_messenger_page_id": "4", "url": "https://notifications.stage.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "links": { "bindings": "https://notifications.stage.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Bindings", "notifications": "https://notifications.stage.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Notifications" } } ] )) actual = @client.notifications.v1.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").update() expect(actual).to_not eq(nil) end end