Class: Twilio::REST::Insights::V1::CallSummaryInstance

Inherits:
Twilio::REST::InstanceResource show all
Defined in:
lib/twilio-ruby/rest/insights/v1/summary.rb

Overview

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 [email protected].

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, call_sid: nil) ⇒ CallSummaryInstance

Initialize the CallSummaryInstance

Parameters:

  • version (Version)

    Version that contains the resource

  • payload (Hash)

    payload that contains response from Twilio

  • call_sid (String) (defaults to: nil)

    The call_sid



121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
# File 'lib/twilio-ruby/rest/insights/v1/summary.rb', line 121

def initialize(version, payload, call_sid: nil)
  super(version)

  # Marshaled Properties
  @properties = {
      'account_sid' => payload['account_sid'],
      'call_sid' => payload['call_sid'],
      'call_type' => payload['call_type'],
      'call_state' => payload['call_state'],
      'processing_state' => payload['processing_state'],
      'start_time' => Twilio.deserialize_iso8601_datetime(payload['start_time']),
      'end_time' => Twilio.deserialize_iso8601_datetime(payload['end_time']),
      'duration' => payload['duration'] == nil ? payload['duration'] : payload['duration'].to_i,
      'connect_duration' => payload['connect_duration'] == nil ? payload['connect_duration'] : payload['connect_duration'].to_i,
      'from' => payload['from'],
      'to' => payload['to'],
      'carrier_edge' => payload['carrier_edge'],
      'client_edge' => payload['client_edge'],
      'sdk_edge' => payload['sdk_edge'],
      'sip_edge' => payload['sip_edge'],
      'tags' => payload['tags'],
      'url' => payload['url'],
      'attributes' => payload['attributes'],
      'properties' => payload['properties'],
  }

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

Instance Method Details

#account_sidString

Returns The account_sid.

Returns:

  • (String)

    The account_sid



165
166
167
# File 'lib/twilio-ruby/rest/insights/v1/summary.rb', line 165

def 
  @properties['account_sid']
end

#attributesHash

Returns The attributes.

Returns:

  • (Hash)

    The attributes



267
268
269
# File 'lib/twilio-ruby/rest/insights/v1/summary.rb', line 267

def attributes
  @properties['attributes']
end

#call_sidString

Returns The call_sid.

Returns:

  • (String)

    The call_sid



171
172
173
# File 'lib/twilio-ruby/rest/insights/v1/summary.rb', line 171

def call_sid
  @properties['call_sid']
end

#call_statecall_summary.CallState

Returns The call_state.

Returns:

  • (call_summary.CallState)

    The call_state



183
184
185
# File 'lib/twilio-ruby/rest/insights/v1/summary.rb', line 183

def call_state
  @properties['call_state']
end

#call_typecall_summary.CallType

Returns The call_type.

Returns:

  • (call_summary.CallType)

    The call_type



177
178
179
# File 'lib/twilio-ruby/rest/insights/v1/summary.rb', line 177

def call_type
  @properties['call_type']
end

#carrier_edgeHash

Returns The carrier_edge.

Returns:

  • (Hash)

    The carrier_edge



231
232
233
# File 'lib/twilio-ruby/rest/insights/v1/summary.rb', line 231

def carrier_edge
  @properties['carrier_edge']
end

#client_edgeHash

Returns The client_edge.

Returns:

  • (Hash)

    The client_edge



237
238
239
# File 'lib/twilio-ruby/rest/insights/v1/summary.rb', line 237

def client_edge
  @properties['client_edge']
end

#connect_durationString

Returns The connect_duration.

Returns:

  • (String)

    The connect_duration



213
214
215
# File 'lib/twilio-ruby/rest/insights/v1/summary.rb', line 213

def connect_duration
  @properties['connect_duration']
end

#contextCallSummaryContext

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

Returns:



156
157
158
159
160
161
# File 'lib/twilio-ruby/rest/insights/v1/summary.rb', line 156

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

#durationString

Returns The duration.

Returns:

  • (String)

    The duration



207
208
209
# File 'lib/twilio-ruby/rest/insights/v1/summary.rb', line 207

def duration
  @properties['duration']
end

#end_timeTime

Returns The end_time.

Returns:

  • (Time)

    The end_time



201
202
203
# File 'lib/twilio-ruby/rest/insights/v1/summary.rb', line 201

def end_time
  @properties['end_time']
end

#fetch(processing_state: :unset) ⇒ CallSummaryInstance

Fetch a CallSummaryInstance

Parameters:

  • processing_state (call_summary.ProcessingState) (defaults to: :unset)

    The processing_state

Returns:



281
282
283
# File 'lib/twilio-ruby/rest/insights/v1/summary.rb', line 281

def fetch(processing_state: :unset)
  context.fetch(processing_state: processing_state, )
end

#fromHash

Returns The from.

Returns:

  • (Hash)

    The from



219
220
221
# File 'lib/twilio-ruby/rest/insights/v1/summary.rb', line 219

def from
  @properties['from']
end

#inspectObject

Provide a detailed, user friendly representation



294
295
296
297
# File 'lib/twilio-ruby/rest/insights/v1/summary.rb', line 294

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

#processing_statecall_summary.ProcessingState

Returns The processing_state.

Returns:

  • (call_summary.ProcessingState)

    The processing_state



189
190
191
# File 'lib/twilio-ruby/rest/insights/v1/summary.rb', line 189

def processing_state
  @properties['processing_state']
end

#propertiesHash

Returns The properties.

Returns:

  • (Hash)

    The properties



273
274
275
# File 'lib/twilio-ruby/rest/insights/v1/summary.rb', line 273

def properties
  @properties['properties']
end

#sdk_edgeHash

Returns The sdk_edge.

Returns:

  • (Hash)

    The sdk_edge



243
244
245
# File 'lib/twilio-ruby/rest/insights/v1/summary.rb', line 243

def sdk_edge
  @properties['sdk_edge']
end

#sip_edgeHash

Returns The sip_edge.

Returns:

  • (Hash)

    The sip_edge



249
250
251
# File 'lib/twilio-ruby/rest/insights/v1/summary.rb', line 249

def sip_edge
  @properties['sip_edge']
end

#start_timeTime

Returns The start_time.

Returns:

  • (Time)

    The start_time



195
196
197
# File 'lib/twilio-ruby/rest/insights/v1/summary.rb', line 195

def start_time
  @properties['start_time']
end

#tagsString

Returns The tags.

Returns:

  • (String)

    The tags



255
256
257
# File 'lib/twilio-ruby/rest/insights/v1/summary.rb', line 255

def tags
  @properties['tags']
end

#toHash

Returns The to.

Returns:

  • (Hash)

    The to



225
226
227
# File 'lib/twilio-ruby/rest/insights/v1/summary.rb', line 225

def to
  @properties['to']
end

#to_sObject

Provide a user friendly representation



287
288
289
290
# File 'lib/twilio-ruby/rest/insights/v1/summary.rb', line 287

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

#urlString

Returns The url.

Returns:

  • (String)

    The url



261
262
263
# File 'lib/twilio-ruby/rest/insights/v1/summary.rb', line 261

def url
  @properties['url']
end