Class: Twilio::REST::Voice::V1::ArchivedCallInstance

Inherits:
InstanceResource show all
Defined in:
lib/twilio-ruby/rest/voice/v1/archived_call.rb

Overview

PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, date: nil, sid: nil) ⇒ ArchivedCallInstance

Initialize the ArchivedCallInstance

Parameters:

  • version (Version)

    Version that contains the resource

  • payload (Hash)

    payload that contains response from Twilio

  • date (Date) (defaults to: nil)

    The date of the Call in UTC.

  • sid (String) (defaults to: nil)

    The Twilio-provided Call SID that uniquely identifies the Call resource to delete


116
117
118
119
120
121
122
123
124
125
126
127
128
129
# File 'lib/twilio-ruby/rest/voice/v1/archived_call.rb', line 116

def initialize(version, payload, date: nil, sid: nil)
  super(version)

  # Marshaled Properties
  @properties = {
      'date' => Twilio.deserialize_iso8601_date(payload['date']),
      'sid' => payload['sid'],
      'url' => payload['url'],
  }

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

Instance Method Details

#contextArchivedCallContext

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

Returns:


135
136
137
138
139
140
# File 'lib/twilio-ruby/rest/voice/v1/archived_call.rb', line 135

def context
  unless @instance_context
    @instance_context = ArchivedCallContext.new(@version, @params['date'], @params['sid'], )
  end
  @instance_context
end

#dateDate

Returns date.

Returns:

  • (Date)

    date


144
145
146
# File 'lib/twilio-ruby/rest/voice/v1/archived_call.rb', line 144

def date
  @properties['date']
end

#deleteBoolean

Delete the ArchivedCallInstance

Returns:

  • (Boolean)

    true if delete succeeds, false otherwise


163
164
165
# File 'lib/twilio-ruby/rest/voice/v1/archived_call.rb', line 163

def delete
  context.delete
end

#inspectObject

Provide a detailed, user friendly representation


176
177
178
179
# File 'lib/twilio-ruby/rest/voice/v1/archived_call.rb', line 176

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

#sidString

Returns sid.

Returns:

  • (String)

    sid


150
151
152
# File 'lib/twilio-ruby/rest/voice/v1/archived_call.rb', line 150

def sid
  @properties['sid']
end

#to_sObject

Provide a user friendly representation


169
170
171
172
# File 'lib/twilio-ruby/rest/voice/v1/archived_call.rb', line 169

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

#urlString

Returns The absolute URL of the resource.

Returns:

  • (String)

    The absolute URL of the resource


156
157
158
# File 'lib/twilio-ruby/rest/voice/v1/archived_call.rb', line 156

def url
  @properties['url']
end