## # This code was generated by # \ / _ _ _| _ _ # | (_)\/(_)(_|\/| |(/_ v1.0.0 # / / # # frozen_string_literal: true require 'spec_helper.rb' describe 'ItemAssignment' do it "can create" do @holodeck.mock(Twilio::Response.new(500, '')) expect { @client.numbers.v2.regulatory_compliance \ .bundles('BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ .item_assignments.create(object_sid: 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') }.to raise_exception(Twilio::REST::TwilioError) values = {'ObjectSid' => 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX', } expect( @holodeck.has_request?(Holodeck::Request.new( method: 'post', url: 'https://numbers.twilio.com/v2/RegulatoryCompliance/Bundles/BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/ItemAssignments', data: values, ))).to eq(true) end it "receives create responses" do @holodeck.mock(Twilio::Response.new( 201, %q[ { "sid": "BVaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "bundle_sid": "BUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "object_sid": "RDaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "date_created": "2019-07-31T02:34:41Z", "url": "https://numbers.twilio.com/v2/RegulatoryCompliance/Bundles/BUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/ItemAssignments/BVaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" } ] )) actual = @client.numbers.v2.regulatory_compliance \ .bundles('BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ .item_assignments.create(object_sid: 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') expect(actual).to_not eq(nil) end it "can read" do @holodeck.mock(Twilio::Response.new(500, '')) expect { @client.numbers.v2.regulatory_compliance \ .bundles('BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ .item_assignments.list() }.to raise_exception(Twilio::REST::TwilioError) values = {} expect( @holodeck.has_request?(Holodeck::Request.new( method: 'get', url: 'https://numbers.twilio.com/v2/RegulatoryCompliance/Bundles/BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/ItemAssignments', ))).to eq(true) end it "receives read_empty responses" do @holodeck.mock(Twilio::Response.new( 200, %q[ { "results": [], "meta": { "page": 0, "page_size": 50, "first_page_url": "https://numbers.twilio.com/v2/RegulatoryCompliance/Bundles/BUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/ItemAssignments?PageSize=50&Page=0", "previous_page_url": null, "url": "https://numbers.twilio.com/v2/RegulatoryCompliance/Bundles/BUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/ItemAssignments?PageSize=50&Page=0", "next_page_url": null, "key": "results" } } ] )) actual = @client.numbers.v2.regulatory_compliance \ .bundles('BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ .item_assignments.list() expect(actual).to_not eq(nil) end it "receives read_full responses" do @holodeck.mock(Twilio::Response.new( 200, %q[ { "results": [ { "sid": "BVaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "bundle_sid": "BUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "object_sid": "RDaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "date_created": "2019-07-31T02:34:41Z", "url": "https://numbers.twilio.com/v2/RegulatoryCompliance/Bundles/BUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/ItemAssignments/BVaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" } ], "meta": { "page": 0, "page_size": 50, "first_page_url": "https://numbers.twilio.com/v2/RegulatoryCompliance/Bundles/BUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/ItemAssignments?PageSize=50&Page=0", "previous_page_url": null, "url": "https://numbers.twilio.com/v2/RegulatoryCompliance/Bundles/BUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/ItemAssignments?PageSize=50&Page=0", "next_page_url": null, "key": "results" } } ] )) actual = @client.numbers.v2.regulatory_compliance \ .bundles('BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ .item_assignments.list() expect(actual).to_not eq(nil) end it "can fetch" do @holodeck.mock(Twilio::Response.new(500, '')) expect { @client.numbers.v2.regulatory_compliance \ .bundles('BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ .item_assignments('BVXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').fetch() }.to raise_exception(Twilio::REST::TwilioError) values = {} expect( @holodeck.has_request?(Holodeck::Request.new( method: 'get', url: 'https://numbers.twilio.com/v2/RegulatoryCompliance/Bundles/BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/ItemAssignments/BVXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX', ))).to eq(true) end it "receives fetch responses" do @holodeck.mock(Twilio::Response.new( 200, %q[ { "sid": "BVaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "bundle_sid": "BUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "object_sid": "RDaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "date_created": "2019-07-31T02:34:41Z", "url": "https://numbers.twilio.com/v2/RegulatoryCompliance/Bundles/BUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/ItemAssignments/BVaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" } ] )) actual = @client.numbers.v2.regulatory_compliance \ .bundles('BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ .item_assignments('BVXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').fetch() expect(actual).to_not eq(nil) end it "can delete" do @holodeck.mock(Twilio::Response.new(500, '')) expect { @client.numbers.v2.regulatory_compliance \ .bundles('BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ .item_assignments('BVXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').delete() }.to raise_exception(Twilio::REST::TwilioError) values = {} expect( @holodeck.has_request?(Holodeck::Request.new( method: 'delete', url: 'https://numbers.twilio.com/v2/RegulatoryCompliance/Bundles/BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/ItemAssignments/BVXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX', ))).to eq(true) end it "receives delete responses" do @holodeck.mock(Twilio::Response.new( 204, nil, )) actual = @client.numbers.v2.regulatory_compliance \ .bundles('BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ .item_assignments('BVXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').delete() expect(actual).to eq(true) end end