Class: Twilio::REST::Bulkexports::V1::ExportList::JobInstance

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

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, job_sid: nil) ⇒ JobInstance

Initialize the JobInstance

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 Job resource.

  • sid (String) —

    The SID of the Call resource to fetch.



241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
# File 'lib/twilio-ruby/rest/bulkexports/v1/export/job.rb', line 241

def initialize(version, payload , job_sid: nil)
    super(version)
    
    
    # Marshaled Properties
    @properties = { 
        'resource_type' => payload['resource_type'],
        'friendly_name' => payload['friendly_name'],
        'details' => payload['details'],
        'start_day' => payload['start_day'],
        'end_day' => payload['end_day'],
        'job_sid' => payload['job_sid'],
        'webhook_url' => payload['webhook_url'],
        'webhook_method' => payload['webhook_method'],
        'email' => payload['email'],
        'url' => payload['url'],
        'job_queue_position' => payload['job_queue_position'],
        'estimated_completion_time' => payload['estimated_completion_time'],
    }

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

Instance Method Details

#context ⇒ JobContext

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

Returns:

  • (JobContext) —

    CallContext for this CallInstance



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

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

#delete ⇒ Boolean

Delete the JobInstance

Returns:

  • (Boolean) —

    True if delete succeeds, false otherwise



352
353
354
355
# File 'lib/twilio-ruby/rest/bulkexports/v1/export/job.rb', line 352

def delete

    context.delete
end

#details ⇒ Array<Hash>

Returns The details of a job which is an object that contains an array of status grouped by status state. Each status object has a status string, a count which is the number of days in that status, and list of days in that status. The day strings are in the format yyyy-MM-dd. As an example, a currently running job may have a status object for COMPLETED and a status object for SUBMITTED each with its own count and list of days.

Returns:

  • (Array<Hash>) —

    The details of a job which is an object that contains an array of status grouped by status state. Each status object has a status string, a count which is the number of days in that status, and list of days in that status. The day strings are in the format yyyy-MM-dd. As an example, a currently running job may have a status object for COMPLETED and a status object for SUBMITTED each with its own count and list of days.



291
292
293
# File 'lib/twilio-ruby/rest/bulkexports/v1/export/job.rb', line 291

def details
    @properties['details']
end

#email ⇒ String

Returns The optional email to send the completion notification to.

Returns:

  • (String) —

    The optional email to send the completion notification to



327
328
329
# File 'lib/twilio-ruby/rest/bulkexports/v1/export/job.rb', line 327

def email
    @properties['email']
end

#end_day ⇒ String

Returns The end time for the export specified when creating the job.

Returns:

  • (String) —

    The end time for the export specified when creating the job



303
304
305
# File 'lib/twilio-ruby/rest/bulkexports/v1/export/job.rb', line 303

def end_day
    @properties['end_day']
end

#estimated_completion_time ⇒ String

Returns this is the time estimated until your job is complete. This is calculated each time you request the job list. The time is calculated based on the current rate of job completion (which may vary) and your job queue position.

Returns:

  • (String) —

    this is the time estimated until your job is complete. This is calculated each time you request the job list. The time is calculated based on the current rate of job completion (which may vary) and your job queue position



345
346
347
# File 'lib/twilio-ruby/rest/bulkexports/v1/export/job.rb', line 345

def estimated_completion_time
    @properties['estimated_completion_time']
end

#fetch ⇒ JobInstance

Fetch the JobInstance

Returns:



360
361
362
363
# File 'lib/twilio-ruby/rest/bulkexports/v1/export/job.rb', line 360

def fetch

    context.fetch
end

#friendly_name ⇒ String

Returns The friendly name specified when creating the job.

Returns:

  • (String) —

    The friendly name specified when creating the job



285
286
287
# File 'lib/twilio-ruby/rest/bulkexports/v1/export/job.rb', line 285

def friendly_name
    @properties['friendly_name']
end

#inspect ⇒ Object

Provide a detailed, user friendly representation



374
375
376
377
# File 'lib/twilio-ruby/rest/bulkexports/v1/export/job.rb', line 374

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

#job_queue_position ⇒ String

Returns This is the job position from the 1st in line. Your queue position will never increase. As jobs ahead of yours in the queue are processed, the queue position number will decrease.

Returns:

  • (String) —

    This is the job position from the 1st in line. Your queue position will never increase. As jobs ahead of yours in the queue are processed, the queue position number will decrease



339
340
341
# File 'lib/twilio-ruby/rest/bulkexports/v1/export/job.rb', line 339

def job_queue_position
    @properties['job_queue_position']
end

#job_sid ⇒ String

Returns The job_sid returned when the export was created.

Returns:

  • (String) —

    The job_sid returned when the export was created



309
310
311
# File 'lib/twilio-ruby/rest/bulkexports/v1/export/job.rb', line 309

def job_sid
    @properties['job_sid']
end

#resource_type ⇒ String

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

Returns:

  • (String) —

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



279
280
281
# File 'lib/twilio-ruby/rest/bulkexports/v1/export/job.rb', line 279

def resource_type
    @properties['resource_type']
end

#start_day ⇒ String

Returns The start time for the export specified when creating the job.

Returns:

  • (String) —

    The start time for the export specified when creating the job



297
298
299
# File 'lib/twilio-ruby/rest/bulkexports/v1/export/job.rb', line 297

def start_day
    @properties['start_day']
end

#to_s ⇒ Object

Provide a user friendly representation



367
368
369
370
# File 'lib/twilio-ruby/rest/bulkexports/v1/export/job.rb', line 367

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

#url ⇒ String

Returns:

  • (String)


333
334
335
# File 'lib/twilio-ruby/rest/bulkexports/v1/export/job.rb', line 333

def url
    @properties['url']
end

#webhook_method ⇒ String

Returns This is the method used to call the webhook.

Returns:

  • (String) —

    This is the method used to call the webhook



321
322
323
# File 'lib/twilio-ruby/rest/bulkexports/v1/export/job.rb', line 321

def webhook_method
    @properties['webhook_method']
end

#webhook_url ⇒ String

Returns The optional webhook url called on completion.

Returns:

  • (String) —

    The optional webhook url called on completion



315
316
317
# File 'lib/twilio-ruby/rest/bulkexports/v1/export/job.rb', line 315

def webhook_url
    @properties['webhook_url']
end