class EatabitRails::Job

Attributes

account[R]
api_version[R]
body[R]
created_at[R]
delivery_minutes[R]
environment[R]
expire_seconds[R]
expires_at[R]
external_id[R]
fulfill_at[R]
id[R]
pickup_minutes[R]
printer[R]
state[R]
status_url[R]
status_url_method[R]

Public Class Methods

create(printer_id, job_attributes) click to toggle source
# File lib/eatabit_rails/job.rb, line 43
def self.create(printer_id, job_attributes)
  job_uri = EatabitRails::REST::Uri.new.job printer_id
  params = EatabitRails::REST::Uri.default_params
  response = RestClient.post(
    job_uri,
    params.merge!(job_attributes)
  )
  response_attributes = JSON.parse(response.body)['job']

  new(response_attributes)
end
find(printer_id, job_id) click to toggle source
# File lib/eatabit_rails/job.rb, line 55
def self.find(printer_id, job_id)
  job_uri = EatabitRails::REST::Uri.new.job(printer_id, job_id)
  params = EatabitRails::REST::Uri.default_params
  response = RestClient.get(job_uri, params)
  response_attributes = JSON.parse(response.body)['job']

  new(response_attributes)
end
new(attributes) click to toggle source
# File lib/eatabit_rails/job.rb, line 24
def initialize(attributes)
  @id = attributes['id']
  @external_id = attributes['external_id']
  @body = attributes['body']
  @state = attributes['state']
  @environment = attributes['environment']
  @pickup_minutes = attributes['pickup_minutes']
  @delivery_minutes = attributes['delivery_minutes']
  @status_url = attributes['status_url']
  @status_url_method = attributes['status_url_method']
  @created_at = attributes['created_at']
  @fulfill_at = attributes['fulfill_at']
  @api_version = attributes['api_version']
  @expire_seconds = attributes['expire_seconds']
  @expires_at = attributes['expires_at']
  @account = attributes['account']
  @printer = attributes['printer']
end