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

  • job_sid (String) (defaults to: nil)

    The unique string that that we created to identify the Bulk Export job


116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
# File 'lib/twilio-ruby/rest/bulkexports/v1/export/job.rb', line 116

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

#contextJobContext

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)

    JobContext for this JobInstance


144
145
146
147
148
149
# File 'lib/twilio-ruby/rest/bulkexports/v1/export/job.rb', line 144

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

#deleteBoolean

Delete the JobInstance

Returns:

  • (Boolean)

    true if delete succeeds, false otherwise


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

def delete
  context.delete
end

#detailsHash

Returns The details of a job state which is an object that contains a `status` string, a day count integer, and list of days in the job.

Returns:

  • (Hash)

    The details of a job state which is an object that contains a `status` string, a day count integer, and list of days in the job


165
166
167
# File 'lib/twilio-ruby/rest/bulkexports/v1/export/job.rb', line 165

def details
  @properties['details']
end

#emailString

Returns The optional email to send the completion notification to.

Returns:

  • (String)

    The optional email to send the completion notification to


201
202
203
# File 'lib/twilio-ruby/rest/bulkexports/v1/export/job.rb', line 201

def email
  @properties['email']
end

#end_dayString

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


177
178
179
# File 'lib/twilio-ruby/rest/bulkexports/v1/export/job.rb', line 177

def end_day
  @properties['end_day']
end

#estimated_completion_timeString

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


219
220
221
# File 'lib/twilio-ruby/rest/bulkexports/v1/export/job.rb', line 219

def estimated_completion_time
  @properties['estimated_completion_time']
end

#fetchJobInstance

Fetch the JobInstance

Returns:


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

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


159
160
161
# File 'lib/twilio-ruby/rest/bulkexports/v1/export/job.rb', line 159

def friendly_name
  @properties['friendly_name']
end

#inspectObject

Provide a detailed, user friendly representation


246
247
248
249
# File 'lib/twilio-ruby/rest/bulkexports/v1/export/job.rb', line 246

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

#job_queue_positionString

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


213
214
215
# File 'lib/twilio-ruby/rest/bulkexports/v1/export/job.rb', line 213

def job_queue_position
  @properties['job_queue_position']
end

#job_sidString

Returns The job_sid returned when the export was created.

Returns:

  • (String)

    The job_sid returned when the export was created


183
184
185
# File 'lib/twilio-ruby/rest/bulkexports/v1/export/job.rb', line 183

def job_sid
  @properties['job_sid']
end

#resource_typeString

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

Returns:

  • (String)

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


153
154
155
# File 'lib/twilio-ruby/rest/bulkexports/v1/export/job.rb', line 153

def resource_type
  @properties['resource_type']
end

#start_dayString

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


171
172
173
# File 'lib/twilio-ruby/rest/bulkexports/v1/export/job.rb', line 171

def start_day
  @properties['start_day']
end

#to_sObject

Provide a user friendly representation


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

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

#urlString

Returns The url.

Returns:

  • (String)

    The url


207
208
209
# File 'lib/twilio-ruby/rest/bulkexports/v1/export/job.rb', line 207

def url
  @properties['url']
end

#webhook_methodString

Returns This is the method used to call the webhook.

Returns:

  • (String)

    This is the method used to call the webhook


195
196
197
# File 'lib/twilio-ruby/rest/bulkexports/v1/export/job.rb', line 195

def webhook_method
  @properties['webhook_method']
end

#webhook_urlString

Returns The optional webhook url called on completion.

Returns:

  • (String)

    The optional webhook url called on completion


189
190
191
# File 'lib/twilio-ruby/rest/bulkexports/v1/export/job.rb', line 189

def webhook_url
  @properties['webhook_url']
end