Class: Twilio::REST::Preview::BulkExports::ExportContext::DayInstance

Inherits:
InstanceResource
  • Object
show all
Defined in:
lib/twilio-ruby/rest/preview/bulk_exports/export/day.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, resource_type: nil, day: nil) ⇒ DayInstance

Initialize the DayInstance

Parameters:

  • version (Version)

    Version that contains the resource

  • payload (Hash)

    payload that contains response from Twilio

  • resource_type (String) (defaults to: nil)

    The type of communication – Messages, Calls, Conferences, and Participants

  • day (String) (defaults to: nil)

    The ISO 8601 format date of the resources in the file, for a UTC day


204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
# File 'lib/twilio-ruby/rest/preview/bulk_exports/export/day.rb', line 204

def initialize(version, payload, resource_type: nil, day: nil)
  super(version)

  # Marshaled Properties
  @properties = {
      'redirect_to' => payload['redirect_to'],
      'day' => payload['day'],
      'size' => payload['size'].to_i,
      'create_date' => payload['create_date'],
      'friendly_name' => payload['friendly_name'],
      'resource_type' => payload['resource_type'],
  }

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

Instance Method Details

#contextDayContext

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

Returns:

  • (DayContext)

    DayContext for this DayInstance


226
227
228
229
230
231
# File 'lib/twilio-ruby/rest/preview/bulk_exports/export/day.rb', line 226

def context
  unless @instance_context
    @instance_context = DayContext.new(@version, @params['resource_type'], @params['day'], )
  end
  @instance_context
end

#create_dateString

Returns The date when resource is created.

Returns:

  • (String)

    The date when resource is created


253
254
255
# File 'lib/twilio-ruby/rest/preview/bulk_exports/export/day.rb', line 253

def create_date
  @properties['create_date']
end

#dayString

Returns The date of the data in the file.

Returns:

  • (String)

    The date of the data in the file


241
242
243
# File 'lib/twilio-ruby/rest/preview/bulk_exports/export/day.rb', line 241

def day
  @properties['day']
end

#fetchDayInstance

Fetch the DayInstance

Returns:


272
273
274
# File 'lib/twilio-ruby/rest/preview/bulk_exports/export/day.rb', line 272

def fetch
  context.fetch
end

#friendly_nameString

Returns The friendly name specified when creating the job.

Returns:

  • (String)

    The friendly name specified when creating the job


259
260
261
# File 'lib/twilio-ruby/rest/preview/bulk_exports/export/day.rb', line 259

def friendly_name
  @properties['friendly_name']
end

#inspectObject

Provide a detailed, user friendly representation


285
286
287
288
# File 'lib/twilio-ruby/rest/preview/bulk_exports/export/day.rb', line 285

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

#redirect_toString

Returns The redirect_to.

Returns:

  • (String)

    The redirect_to


235
236
237
# File 'lib/twilio-ruby/rest/preview/bulk_exports/export/day.rb', line 235

def redirect_to
  @properties['redirect_to']
end

#resource_typeString

Returns The type of communication – Messages, Calls, Conferences, and Participants.

Returns:

  • (String)

    The type of communication – Messages, Calls, Conferences, and Participants


265
266
267
# File 'lib/twilio-ruby/rest/preview/bulk_exports/export/day.rb', line 265

def resource_type
  @properties['resource_type']
end

#sizeString

Returns Size of the file in bytes.

Returns:

  • (String)

    Size of the file in bytes


247
248
249
# File 'lib/twilio-ruby/rest/preview/bulk_exports/export/day.rb', line 247

def size
  @properties['size']
end

#to_sObject

Provide a user friendly representation


278
279
280
281
# File 'lib/twilio-ruby/rest/preview/bulk_exports/export/day.rb', line 278

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