## # This code was generated by # \ / _ _ _| _ _ # | (_)\/(_)(_|\/| |(/_ v1.0.0 # / / # # frozen_string_literal: true module Twilio module REST class Preview < Domain class TrustedComms < Version class BusinessContext < InstanceContext class InsightsList < ListResource ## # PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com. class SuccessRateList < ListResource ## # Initialize the SuccessRateList # @param [Version] version Version that contains the resource # @param [String] business_sid A 34 character string that uniquely identifies this # Business. # @return [SuccessRateList] SuccessRateList def initialize(version, business_sid: nil) super(version) # Path Solution @solution = {business_sid: business_sid} end ## # Provide a user friendly representation def to_s '#' end end ## # PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com. class SuccessRatePage < Page ## # Initialize the SuccessRatePage # @param [Version] version Version that contains the resource # @param [Response] response Response from the API # @param [Hash] solution Path solution for the resource # @return [SuccessRatePage] SuccessRatePage def initialize(version, response, solution) super(version, response) # Path Solution @solution = solution end ## # Build an instance of SuccessRateInstance # @param [Hash] payload Payload response from the API # @return [SuccessRateInstance] SuccessRateInstance def get_instance(payload) SuccessRateInstance.new(@version, payload, business_sid: @solution[:business_sid], ) end ## # Provide a user friendly representation def to_s '' end end ## # PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com. class SuccessRateContext < InstanceContext ## # Initialize the SuccessRateContext # @param [Version] version Version that contains the resource # @param [String] business_sid The unique SID identifier of the Business to filter # by. # @return [SuccessRateContext] SuccessRateContext def initialize(version, business_sid) super(version) # Path Solution @solution = {business_sid: business_sid, } @uri = "/Businesses/#{@solution[:business_sid]}/Insights/SuccessRate" end ## # Fetch a SuccessRateInstance # @param [String] brand_sid The unique SID identifier of the Brand to filter by. # @param [String] branded_channel_sid The unique SID identifier of the Branded # Channel to filter by. # @param [String] phone_number_sid The unique SID identifier of the Phone Number # to filter by. # @param [String] country The 2-letter ISO 3166 code of the Country to filter by. # @param [Time] start The start date that for this Success Rate, given in ISO 8601 # format. Default value is 30 days ago. # @param [Time] end_ The end date that for this Success Rate, given in ISO 8601 # format. Default value is current timestamp. # @param [success_rate.Intervals] interval The Interval of this Success Rate. One # of `minute`, `hour`, `day`, `week` or `month`. # @return [SuccessRateInstance] Fetched SuccessRateInstance def fetch(brand_sid: :unset, branded_channel_sid: :unset, phone_number_sid: :unset, country: :unset, start: :unset, end_: :unset, interval: :unset) params = Twilio::Values.of({ 'BrandSid' => brand_sid, 'BrandedChannelSid' => branded_channel_sid, 'PhoneNumberSid' => phone_number_sid, 'Country' => country, 'Start' => Twilio.serialize_iso8601_datetime(start), 'End' => Twilio.serialize_iso8601_datetime(end_), 'Interval' => interval, }) payload = @version.fetch( 'GET', @uri, params, ) SuccessRateInstance.new(@version, payload, business_sid: @solution[:business_sid], ) end ## # Provide a user friendly representation def to_s context = @solution.map {|k, v| "#{k}: #{v}"}.join(',') "#" end ## # Provide a detailed, user friendly representation def inspect context = @solution.map {|k, v| "#{k}: #{v}"}.join(',') "#" end end ## # PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com. class SuccessRateInstance < InstanceResource ## # Initialize the SuccessRateInstance # @param [Version] version Version that contains the resource # @param [Hash] payload payload that contains response from Twilio # @param [String] business_sid A 34 character string that uniquely identifies this # Business. # @return [SuccessRateInstance] SuccessRateInstance def initialize(version, payload, business_sid: nil) super(version) # Marshaled Properties @properties = { 'account_sid' => payload['account_sid'], 'business_sid' => payload['business_sid'], 'end_' => Twilio.deserialize_iso8601_datetime(payload['end']), 'interval' => payload['interval'], 'reports' => payload['reports'], 'start' => Twilio.deserialize_iso8601_datetime(payload['start']), 'url' => payload['url'], } # Context @instance_context = nil @params = {'business_sid' => business_sid, } end ## # Generate an instance context for the instance, the context is capable of # performing various actions. All instance actions are proxied to the context # @return [SuccessRateContext] SuccessRateContext for this SuccessRateInstance def context unless @instance_context @instance_context = SuccessRateContext.new(@version, @params['business_sid'], ) end @instance_context end ## # @return [String] Account Sid. def account_sid @properties['account_sid'] end ## # @return [String] Business Sid. def business_sid @properties['business_sid'] end ## # @return [Time] The end date that for this Success Rate. def end_ @properties['end_'] end ## # @return [success_rate.Intervals] The Interval of this Success Rate. def interval @properties['interval'] end ## # @return [Hash] Values of Success Rate per interval. def reports @properties['reports'] end ## # @return [Time] The start date that for this Success Rate. def start @properties['start'] end ## # @return [String] The URL of this resource. def url @properties['url'] end ## # Fetch a SuccessRateInstance # @param [String] brand_sid The unique SID identifier of the Brand to filter by. # @param [String] branded_channel_sid The unique SID identifier of the Branded # Channel to filter by. # @param [String] phone_number_sid The unique SID identifier of the Phone Number # to filter by. # @param [String] country The 2-letter ISO 3166 code of the Country to filter by. # @param [Time] start The start date that for this Success Rate, given in ISO 8601 # format. Default value is 30 days ago. # @param [Time] end_ The end date that for this Success Rate, given in ISO 8601 # format. Default value is current timestamp. # @param [success_rate.Intervals] interval The Interval of this Success Rate. One # of `minute`, `hour`, `day`, `week` or `month`. # @return [SuccessRateInstance] Fetched SuccessRateInstance def fetch(brand_sid: :unset, branded_channel_sid: :unset, phone_number_sid: :unset, country: :unset, start: :unset, end_: :unset, interval: :unset) context.fetch( brand_sid: brand_sid, branded_channel_sid: branded_channel_sid, phone_number_sid: phone_number_sid, country: country, start: start, end_: end_, interval: interval, ) end ## # Provide a user friendly representation def to_s values = @params.map{|k, v| "#{k}: #{v}"}.join(" ") "" end ## # Provide a detailed, user friendly representation def inspect values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ") "" end end end end end end end end