Class: Twilio::REST::Bulkexports::V1::ExportContext::DayInstance

Inherits:
InstanceResource
  • Object
show all
Defined in:
lib/twilio-ruby/rest/bulkexports/v1/export/day.rb

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

  • account_sid (String)

    The SID of the Account that created this Day resource.

  • sid (String)

    The SID of the Call resource to fetch.



213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
# File 'lib/twilio-ruby/rest/bulkexports/v1/export/day.rb', line 213

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'] == nil ? payload['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  || @properties['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)

    CallContext for this CallInstance



235
236
237
238
239
240
# File 'lib/twilio-ruby/rest/bulkexports/v1/export/day.rb', line 235

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

#create_dateString

Returns The ISO 8601 format date when resources is created.

Returns:

  • (String)

    The ISO 8601 format date when resources is created



262
263
264
# File 'lib/twilio-ruby/rest/bulkexports/v1/export/day.rb', line 262

def create_date
    @properties['create_date']
end

#dayString

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

Returns:

  • (String)

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



250
251
252
# File 'lib/twilio-ruby/rest/bulkexports/v1/export/day.rb', line 250

def day
    @properties['day']
end

#fetchDayInstance

Fetch the DayInstance

Returns:



281
282
283
284
# File 'lib/twilio-ruby/rest/bulkexports/v1/export/day.rb', line 281

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



268
269
270
# File 'lib/twilio-ruby/rest/bulkexports/v1/export/day.rb', line 268

def friendly_name
    @properties['friendly_name']
end

#inspectObject

Provide a detailed, user friendly representation



295
296
297
298
# File 'lib/twilio-ruby/rest/bulkexports/v1/export/day.rb', line 295

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

#redirect_toString

Returns:

  • (String)


244
245
246
# File 'lib/twilio-ruby/rest/bulkexports/v1/export/day.rb', line 244

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



274
275
276
# File 'lib/twilio-ruby/rest/bulkexports/v1/export/day.rb', line 274

def resource_type
    @properties['resource_type']
end

#sizeString

Returns The size of the day’s data file in bytes.

Returns:

  • (String)

    The size of the day’s data file in bytes



256
257
258
# File 'lib/twilio-ruby/rest/bulkexports/v1/export/day.rb', line 256

def size
    @properties['size']
end

#to_sObject

Provide a user friendly representation



288
289
290
291
# File 'lib/twilio-ruby/rest/bulkexports/v1/export/day.rb', line 288

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