## # This code was generated by # \ / _ _ _| _ _ # | (_)\/(_)(_|\/| |(/_ v1.0.0 # / / # # frozen_string_literal: true require 'spec_helper.rb' describe 'SuccessRate' do it "can fetch" do @holodeck.mock(Twilio::Response.new(500, '')) expect { @client.preview.trusted_comms.businesses('BXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ .insights \ .success_rate().fetch() }.to raise_exception(Twilio::REST::TwilioError) values = {} expect( @holodeck.has_request?(Holodeck::Request.new( method: 'get', url: 'https://preview.twilio.com/TrustedComms/Businesses/BXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Insights/SuccessRate', ))).to eq(true) end it "receives fetch responses" do @holodeck.mock(Twilio::Response.new( 200, %q[ { "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "business_sid": "BXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "start": "2015-07-30T20:00:00Z", "end": "2015-07-30T21:00:00Z", "interval": "minute", "reports": { "success_rate": { "timestamp": "2015-07-30T20:00:00", "calls": 1200, "branded": 800, "value": 66.67 } }, "url": "https://preview.twilio.com/TrustedComms/Businesses/BXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Insights/SuccessRate" } ] )) actual = @client.preview.trusted_comms.businesses('BXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ .insights \ .success_rate().fetch() expect(actual).to_not eq(nil) end end