## # This code was generated by # \ / _ _ _| _ _ # | (_)\/(_)(_|\/| |(/_ v1.0.0 # / / # # frozen_string_literal: true module Twilio module REST class Trunking < Domain class V1 < Version class TrunkContext < InstanceContext class RecordingList < ListResource ## # Initialize the RecordingList # @param [Version] version Version that contains the resource # @param [String] trunk_sid The trunk_sid # @return [RecordingList] RecordingList def initialize(version, trunk_sid: nil) super(version) # Path Solution @solution = {trunk_sid: trunk_sid} end ## # Provide a user friendly representation def to_s '#' end end class RecordingPage < Page ## # Initialize the RecordingPage # @param [Version] version Version that contains the resource # @param [Response] response Response from the API # @param [Hash] solution Path solution for the resource # @return [RecordingPage] RecordingPage def initialize(version, response, solution) super(version, response) # Path Solution @solution = solution end ## # Build an instance of RecordingInstance # @param [Hash] payload Payload response from the API # @return [RecordingInstance] RecordingInstance def get_instance(payload) RecordingInstance.new(@version, payload, trunk_sid: @solution[:trunk_sid], ) end ## # Provide a user friendly representation def to_s '' end end class RecordingContext < InstanceContext ## # Initialize the RecordingContext # @param [Version] version Version that contains the resource # @param [String] trunk_sid The SID of the Trunk from which to fetch the recording # settings. # @return [RecordingContext] RecordingContext def initialize(version, trunk_sid) super(version) # Path Solution @solution = {trunk_sid: trunk_sid, } @uri = "/Trunks/#{@solution[:trunk_sid]}/Recording" end ## # Fetch the RecordingInstance # @return [RecordingInstance] Fetched RecordingInstance def fetch payload = @version.fetch('GET', @uri) RecordingInstance.new(@version, payload, trunk_sid: @solution[:trunk_sid], ) end ## # Update the RecordingInstance # @return [RecordingInstance] Updated RecordingInstance def update payload = @version.update('POST', @uri) RecordingInstance.new(@version, payload, trunk_sid: @solution[:trunk_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 RecordingInstance < InstanceResource ## # Initialize the RecordingInstance # @param [Version] version Version that contains the resource # @param [Hash] payload payload that contains response from Twilio # @param [String] trunk_sid The trunk_sid # @return [RecordingInstance] RecordingInstance def initialize(version, payload, trunk_sid: nil) super(version) # Marshaled Properties @properties = { 'mode' => payload['mode'], 'trim' => payload['trim'], 'url' => payload['url'], 'trunk_sid' => payload['trunk_sid'], } # Context @instance_context = nil @params = {'trunk_sid' => trunk_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 [RecordingContext] RecordingContext for this RecordingInstance def context unless @instance_context @instance_context = RecordingContext.new(@version, @params['trunk_sid'], ) end @instance_context end ## # @return [recording.RecordingMode] The recording mode for the trunk. def mode @properties['mode'] end ## # @return [recording.RecordingTrim] The recording trim setting for the trunk. def trim @properties['trim'] end ## # @return [String] The url def url @properties['url'] end ## # @return [String] The trunk_sid def trunk_sid @properties['trunk_sid'] end ## # Fetch the RecordingInstance # @return [RecordingInstance] Fetched RecordingInstance def fetch context.fetch end ## # Update the RecordingInstance # @return [RecordingInstance] Updated RecordingInstance def update context.update 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