## # This code was generated by # \ / _ _ _| _ _ # | (_)\/(_)(_|\/| |(/_ v1.0.0 # / / # # frozen_string_literal: true require 'spec_helper.rb' describe 'EventType' do it "can read" do @holodeck.mock(Twilio::Response.new(500, '')) expect { @client.events.v1.event_types.list() }.to raise_exception(Twilio::REST::TwilioError) expect( @holodeck.has_request?(Holodeck::Request.new( method: 'get', url: 'https://events.twilio.com/v1/Types', ))).to eq(true) end it "receives read_empty responses" do @holodeck.mock(Twilio::Response.new( 200, %q[ { "types": [], "meta": { "page": 0, "page_size": 10, "first_page_url": "https://events.twilio.com/v1/Types?PageSize=10&Page=0", "previous_page_url": null, "url": "https://events.twilio.com/v1/Types?PageSize=10&Page=0", "next_page_url": null, "key": "types" } } ] )) actual = @client.events.v1.event_types.list() expect(actual).to_not eq(nil) end it "receives read_results responses" do @holodeck.mock(Twilio::Response.new( 200, %q[ { "types": [ { "date_created": "2020-08-13T12:50:18Z", "date_updated": "2020-08-13T13:28:48Z", "type": "com.twilio.test.example", "schema_id": "EventStreams.SampleSchema", "description": "A sample event type", "url": "https://events.twilio.com/v1/Types/com.twilio.test.example", "links": { "schema": "https://events.twilio.com/v1/Schemas/EventStreams.SampleSchema/Versions" } }, { "date_created": "2020-08-13T12:50:19Z", "date_updated": "2020-08-13T13:28:49Z", "type": "com.twilio.test.example2", "schema_id": "EventStreams.SampleSchema", "description": "Another sample event type", "url": "https://events.twilio.com/v1/Types/com.twilio.test.example2", "links": { "schema": "https://events.twilio.com/v1/Schemas/EventStreams.SampleSchema/Versions" } } ], "meta": { "page": 0, "page_size": 20, "first_page_url": "https://events.twilio.com/v1/Types?PageSize=20&Page=0", "previous_page_url": null, "url": "https://events.twilio.com/v1/Types?PageSize=20&Page=0", "next_page_url": null, "key": "types" } } ] )) actual = @client.events.v1.event_types.list() expect(actual).to_not eq(nil) end it "can fetch" do @holodeck.mock(Twilio::Response.new(500, '')) expect { @client.events.v1.event_types('type').fetch() }.to raise_exception(Twilio::REST::TwilioError) expect( @holodeck.has_request?(Holodeck::Request.new( method: 'get', url: 'https://events.twilio.com/v1/Types/type', ))).to eq(true) end it "receives fetch responses" do @holodeck.mock(Twilio::Response.new( 200, %q[ { "date_created": "2020-08-13T12:50:18Z", "date_updated": "2020-08-13T13:28:48Z", "type": "com.twilio.test.example", "schema_id": "EventStreams.SampleSchema", "description": "A sample subscription", "url": "https://events.twilio.com/v1/Types/com.twilio.test.example", "links": { "schema": "https://events.twilio.com/v1/Schemas/EventStreams.SampleSchema/Versions" } } ] )) actual = @client.events.v1.event_types('type').fetch() expect(actual).to_not eq(nil) end end