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

  • 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


196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
# File 'lib/twilio-ruby/rest/bulkexports/v1/export/day.rb', line 196

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


218
219
220
221
222
223
# File 'lib/twilio-ruby/rest/bulkexports/v1/export/day.rb', line 218

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


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

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


233
234
235
# File 'lib/twilio-ruby/rest/bulkexports/v1/export/day.rb', line 233

def day
  @properties['day']
end

#fetchDayInstance

Fetch the DayInstance

Returns:


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

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


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

def friendly_name
  @properties['friendly_name']
end

#inspectObject

Provide a detailed, user friendly representation


277
278
279
280
# File 'lib/twilio-ruby/rest/bulkexports/v1/export/day.rb', line 277

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

#redirect_toString

Returns The redirect_to.

Returns:

  • (String)

    The redirect_to


227
228
229
# File 'lib/twilio-ruby/rest/bulkexports/v1/export/day.rb', line 227

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


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

def resource_type
  @properties['resource_type']
end

#sizeString

Returns Size of the file in bytes.

Returns:

  • (String)

    Size of the file in bytes


239
240
241
# File 'lib/twilio-ruby/rest/bulkexports/v1/export/day.rb', line 239

def size
  @properties['size']
end

#to_sObject

Provide a user friendly representation


270
271
272
273
# File 'lib/twilio-ruby/rest/bulkexports/v1/export/day.rb', line 270

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