Class: Twilio::REST::Trunking::V1::TrunkContext::RecordingContext

Inherits:
InstanceContext
  • Object
show all
Defined in:
lib/twilio-ruby/rest/trunking/v1/trunk/recording.rb

Instance Method Summary collapse

Constructor Details

#initialize(version, trunk_sid) ⇒ RecordingContext

Initialize the RecordingContext

Parameters:

  • version (Version)

    Version that contains the resource

  • trunk_sid (String)

    The SID of the Trunk from which to fetch the recording settings.


71
72
73
74
75
76
77
# File 'lib/twilio-ruby/rest/trunking/v1/trunk/recording.rb', line 71

def initialize(version, trunk_sid)
  super(version)

  # Path Solution
  @solution = {trunk_sid: trunk_sid, }
  @uri = "/Trunks/#{@solution[:trunk_sid]}/Recording"
end

Instance Method Details

#fetchRecordingInstance

Fetch the RecordingInstance

Returns:


82
83
84
85
86
# File 'lib/twilio-ruby/rest/trunking/v1/trunk/recording.rb', line 82

def fetch
  payload = @version.fetch('GET', @uri)

  RecordingInstance.new(@version, payload, trunk_sid: @solution[:trunk_sid], )
end

#inspectObject

Provide a detailed, user friendly representation


113
114
115
116
# File 'lib/twilio-ruby/rest/trunking/v1/trunk/recording.rb', line 113

def inspect
  context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
  "#<Twilio.Trunking.V1.RecordingContext #{context}>"
end

#to_sObject

Provide a user friendly representation


106
107
108
109
# File 'lib/twilio-ruby/rest/trunking/v1/trunk/recording.rb', line 106

def to_s
  context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
  "#<Twilio.Trunking.V1.RecordingContext #{context}>"
end

#update(mode: :unset, trim: :unset) ⇒ RecordingInstance

Update the RecordingInstance

Parameters:

  • mode (recording.RecordingMode) (defaults to: :unset)

    The recording mode for the trunk. Can be do-not-record (default), record-from-ringing, record-from-answer, record-from-ringing-dual, or record-from-answer-dual.

  • trim (recording.RecordingTrim) (defaults to: :unset)

    The recording trim setting for the trunk. Can be do-not-trim (default) or trim-silence.

Returns:


96
97
98
99
100
101
102
# File 'lib/twilio-ruby/rest/trunking/v1/trunk/recording.rb', line 96

def update(mode: :unset, trim: :unset)
  data = Twilio::Values.of({'Mode' => mode, 'Trim' => trim, })

  payload = @version.update('POST', @uri, data: data)

  RecordingInstance.new(@version, payload, trunk_sid: @solution[:trunk_sid], )
end