Class: Twilio::REST::Trunking::V1::TrunkContext::RecordingInstance

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

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, trunk_sid: nil) ⇒ RecordingInstance

Initialize the RecordingInstance

Parameters:

  • version (Version)

    Version that contains the resource

  • payload (Hash)

    payload that contains response from Twilio

  • account_sid (String)

    The SID of the Account that created this Recording resource.

  • sid (String)

    The SID of the Call resource to fetch.



162
163
164
165
166
167
168
169
170
171
172
173
174
# File 'lib/twilio-ruby/rest/trunking/v1/trunk/recording.rb', line 162

def initialize(version, payload , trunk_sid: nil)
    super(version)
    
    # Marshaled Properties
    @properties = { 
        'mode' => payload['mode'],
        'trim' => payload['trim'],
    }

    # Context
    @instance_context = nil
    @params = { 'trunk_sid' => trunk_sid  || @properties['trunk_sid']  , }
end

Instance Method Details

#contextRecordingContext

Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context

Returns:



180
181
182
183
184
185
# File 'lib/twilio-ruby/rest/trunking/v1/trunk/recording.rb', line 180

def context
    unless @instance_context
        @instance_context = RecordingContext.new(@version , @params['trunk_sid'])
    end
    @instance_context
end

#fetchRecordingInstance

Fetch the RecordingInstance

Returns:



202
203
204
205
# File 'lib/twilio-ruby/rest/trunking/v1/trunk/recording.rb', line 202

def fetch

    context.fetch
end

#inspectObject

Provide a detailed, user friendly representation



232
233
234
235
# File 'lib/twilio-ruby/rest/trunking/v1/trunk/recording.rb', line 232

def inspect
    values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
    "<Twilio.Trunking.V1.RecordingInstance #{values}>"
end

#modeRecordingMode

Returns:

  • (RecordingMode)


189
190
191
# File 'lib/twilio-ruby/rest/trunking/v1/trunk/recording.rb', line 189

def mode
    @properties['mode']
end

#to_sObject

Provide a user friendly representation



225
226
227
228
# File 'lib/twilio-ruby/rest/trunking/v1/trunk/recording.rb', line 225

def to_s
    values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
    "<Twilio.Trunking.V1.RecordingInstance #{values}>"
end

#trimRecordingTrim

Returns:

  • (RecordingTrim)


195
196
197
# File 'lib/twilio-ruby/rest/trunking/v1/trunk/recording.rb', line 195

def trim
    @properties['trim']
end

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

Update the RecordingInstance

Parameters:

  • mode (RecordingMode) (defaults to: :unset)
  • trim (RecordingTrim) (defaults to: :unset)

Returns:



212
213
214
215
216
217
218
219
220
221
# File 'lib/twilio-ruby/rest/trunking/v1/trunk/recording.rb', line 212

def update(
    mode: :unset, 
    trim: :unset
)

    context.update(
        mode: mode, 
        trim: trim, 
    )
end