## # This code was generated by # \ / _ _ _| _ _ # | (_)\/(_)(_|\/| |(/_ v1.0.0 # / / # # frozen_string_literal: true module Twilio module REST class Preview < Domain class TrustedComms < Version ## # 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 CurrentCallList < ListResource ## # Initialize the CurrentCallList # @param [Version] version Version that contains the resource # @return [CurrentCallList] CurrentCallList def initialize(version) super(version) # Path Solution @solution = {} 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 CurrentCallPage < Page ## # Initialize the CurrentCallPage # @param [Version] version Version that contains the resource # @param [Response] response Response from the API # @param [Hash] solution Path solution for the resource # @return [CurrentCallPage] CurrentCallPage def initialize(version, response, solution) super(version, response) # Path Solution @solution = solution end ## # Build an instance of CurrentCallInstance # @param [Hash] payload Payload response from the API # @return [CurrentCallInstance] CurrentCallInstance def get_instance(payload) CurrentCallInstance.new(@version, payload, ) 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 CurrentCallContext < InstanceContext ## # Initialize the CurrentCallContext # @param [Version] version Version that contains the resource # @return [CurrentCallContext] CurrentCallContext def initialize(version) super(version) # Path Solution @solution = {} @uri = "/CurrentCall" end ## # Fetch a CurrentCallInstance # @param [String] from The originating Phone Number, given in E.164 format # (https://en.wikipedia.org/wiki/E.164). This phone number should be a Twilio # number, otherwise it will return an error with HTTP Status Code 400. # @param [String] to The terminating Phone Number, given in E.164 format # (https://en.wikipedia.org/wiki/E.164). # @return [CurrentCallInstance] Fetched CurrentCallInstance def fetch(from: :unset, to: :unset) params = Twilio::Values.of({'From' => from, 'To' => to, }) payload = @version.fetch( 'GET', @uri, params, ) CurrentCallInstance.new(@version, payload, ) 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 CurrentCallInstance < InstanceResource ## # Initialize the CurrentCallInstance # @param [Version] version Version that contains the resource # @param [Hash] payload payload that contains response from Twilio # @return [CurrentCallInstance] CurrentCallInstance def initialize(version, payload) super(version) # Marshaled Properties @properties = { 'sid' => payload['sid'], 'from' => payload['from'], 'to' => payload['to'], 'reason' => payload['reason'], 'created_at' => Twilio.deserialize_iso8601_datetime(payload['created_at']), 'url' => payload['url'], } # Context @instance_context = nil @params = {} 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 [CurrentCallContext] CurrentCallContext for this CurrentCallInstance def context unless @instance_context @instance_context = CurrentCallContext.new(@version, ) end @instance_context end ## # @return [String] A string that uniquely identifies this Current Call. def sid @properties['sid'] end ## # @return [String] The originating Phone Number def from @properties['from'] end ## # @return [String] The terminating Phone Number def to @properties['to'] end ## # @return [String] The business reason for this phone call def reason @properties['reason'] end ## # @return [Time] The date this Current Call was created def created_at @properties['created_at'] end ## # @return [String] The URL of this resource. def url @properties['url'] end ## # Fetch a CurrentCallInstance # @param [String] from The originating Phone Number, given in E.164 format # (https://en.wikipedia.org/wiki/E.164). This phone number should be a Twilio # number, otherwise it will return an error with HTTP Status Code 400. # @param [String] to The terminating Phone Number, given in E.164 format # (https://en.wikipedia.org/wiki/E.164). # @return [CurrentCallInstance] Fetched CurrentCallInstance def fetch(from: :unset, to: :unset) context.fetch(from: from, to: to, ) 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