## # This code was generated by # \ / _ _ _| _ _ # | (_)\/(_)(_|\/| |(/_ v1.0.0 # / / require 'spec_helper.rb' describe 'Feedback' do it "can create" do @holodeck.mock(Twilio::Response.new(500, '')) expect { @client.api.v2010.accounts("ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \ .calls("CAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \ .feedback().create(quality_score: 1) }.to raise_exception(Twilio::REST::TwilioError) values = { 'QualityScore' => 1, } expect( @holodeck.has_request?(Holodeck::Request.new( method: 'post', url: 'https://api.twilio.com/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Calls/CAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Feedback.json', data: values, ))).to eq(true) end it "receives create responses" do @holodeck.mock(Twilio::Response.new( 201, %q[ { "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "date_created": "Thu, 20 Aug 2015 21:45:46 +0000", "date_updated": "Thu, 20 Aug 2015 21:45:46 +0000", "issues": [ "imperfect-audio", "post-dial-delay" ], "quality_score": 5, "sid": "CAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" } ] )) actual = @client.api.v2010.accounts("ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \ .calls("CAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \ .feedback().create(quality_score: 1) expect(actual).to_not eq(nil) end it "can fetch" do @holodeck.mock(Twilio::Response.new(500, '')) expect { @client.api.v2010.accounts("ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \ .calls("CAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \ .feedback().fetch() }.to raise_exception(Twilio::REST::TwilioError) values = {} expect( @holodeck.has_request?(Holodeck::Request.new( method: 'get', url: 'https://api.twilio.com/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Calls/CAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Feedback.json', ))).to eq(true) end it "receives fetch responses" do @holodeck.mock(Twilio::Response.new( 200, %q[ { "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "date_created": "Thu, 20 Aug 2015 21:45:46 +0000", "date_updated": "Thu, 20 Aug 2015 21:45:46 +0000", "issues": [ "imperfect-audio", "post-dial-delay" ], "quality_score": 5, "sid": "CAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" } ] )) actual = @client.api.v2010.accounts("ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \ .calls("CAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \ .feedback().fetch() expect(actual).to_not eq(nil) end it "can update" do @holodeck.mock(Twilio::Response.new(500, '')) expect { @client.api.v2010.accounts("ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \ .calls("CAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \ .feedback().update(quality_score: 1) }.to raise_exception(Twilio::REST::TwilioError) values = { 'QualityScore' => 1, } expect( @holodeck.has_request?(Holodeck::Request.new( method: 'post', url: 'https://api.twilio.com/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Calls/CAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Feedback.json', data: values, ))).to eq(true) end it "receives update responses" do @holodeck.mock(Twilio::Response.new( 200, %q[ { "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "date_created": "Thu, 20 Aug 2015 21:45:46 +0000", "date_updated": "Thu, 20 Aug 2015 21:45:46 +0000", "issues": [ "imperfect-audio", "post-dial-delay" ], "quality_score": 5, "sid": "CAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" } ] )) actual = @client.api.v2010.accounts("ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \ .calls("CAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \ .feedback().update(quality_score: 1) expect(actual).to_not eq(nil) end end