## # This code was generated by # \ / _ _ _| _ _ # | (_)\/(_)(_|\/| |(/_ v1.0.0 # / / # # frozen_string_literal: true module Twilio module REST class Insights < Domain class V1 < Version class CallList < ListResource ## # Initialize the CallList # @param [Version] version Version that contains the resource # @return [CallList] CallList def initialize(version) super(version) # Path Solution @solution = {} end ## # Provide a user friendly representation def to_s '#' end end class CallPage < Page ## # Initialize the CallPage # @param [Version] version Version that contains the resource # @param [Response] response Response from the API # @param [Hash] solution Path solution for the resource # @return [CallPage] CallPage def initialize(version, response, solution) super(version, response) # Path Solution @solution = solution end ## # Build an instance of CallInstance # @param [Hash] payload Payload response from the API # @return [CallInstance] CallInstance def get_instance(payload) CallInstance.new(@version, payload, ) end ## # Provide a user friendly representation def to_s '' end end class CallContext < InstanceContext ## # Initialize the CallContext # @param [Version] version Version that contains the resource # @param [String] sid The sid # @return [CallContext] CallContext def initialize(version, sid) super(version) # Path Solution @solution = {sid: sid, } @uri = "/Voice/#{@solution[:sid]}" # Dependents @events = nil @metrics = nil @summary = nil @annotation = nil end ## # Fetch the CallInstance # @return [CallInstance] Fetched CallInstance def fetch payload = @version.fetch('GET', @uri) CallInstance.new(@version, payload, sid: @solution[:sid], ) end ## # Access the events # @return [EventList] # @return [EventContext] def events unless @events @events = EventList.new(@version, call_sid: @solution[:sid], ) end @events end ## # Access the metrics # @return [MetricList] # @return [MetricContext] def metrics unless @metrics @metrics = MetricList.new(@version, call_sid: @solution[:sid], ) end @metrics end ## # Access the summary # @return [CallSummaryList] # @return [CallSummaryContext] def summary CallSummaryContext.new(@version, @solution[:sid], ) end ## # Access the annotation # @return [AnnotationList] # @return [AnnotationContext] def annotation AnnotationContext.new(@version, @solution[: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 class CallInstance < InstanceResource ## # Initialize the CallInstance # @param [Version] version Version that contains the resource # @param [Hash] payload payload that contains response from Twilio # @param [String] sid The sid # @return [CallInstance] CallInstance def initialize(version, payload, sid: nil) super(version) # Marshaled Properties @properties = {'sid' => payload['sid'], 'url' => payload['url'], 'links' => payload['links'], } # Context @instance_context = nil @params = {'sid' => sid || @properties['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 [CallContext] CallContext for this CallInstance def context unless @instance_context @instance_context = CallContext.new(@version, @params['sid'], ) end @instance_context end ## # @return [String] The sid def sid @properties['sid'] end ## # @return [String] The url def url @properties['url'] end ## # @return [String] The links def links @properties['links'] end ## # Fetch the CallInstance # @return [CallInstance] Fetched CallInstance def fetch context.fetch end ## # Access the events # @return [events] events def events context.events end ## # Access the metrics # @return [metrics] metrics def metrics context.metrics end ## # Access the summary # @return [summary] summary def summary context.summary end ## # Access the annotation # @return [annotation] annotation def annotation context.annotation 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