Class: EatabitRails::Job
- Inherits:
-
Object
- Object
- EatabitRails::Job
- Defined in:
- lib/eatabit_rails/job.rb
Instance Attribute Summary collapse
-
#account ⇒ Object
readonly
Returns the value of attribute account.
-
#api_version ⇒ Object
readonly
Returns the value of attribute api_version.
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#created_at ⇒ Object
readonly
Returns the value of attribute created_at.
-
#delivery_minutes ⇒ Object
readonly
Returns the value of attribute delivery_minutes.
-
#environment ⇒ Object
readonly
Returns the value of attribute environment.
-
#expire_seconds ⇒ Object
readonly
Returns the value of attribute expire_seconds.
-
#expires_at ⇒ Object
readonly
Returns the value of attribute expires_at.
-
#external_id ⇒ Object
readonly
Returns the value of attribute external_id.
-
#fulfill_at ⇒ Object
readonly
Returns the value of attribute fulfill_at.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#pickup_minutes ⇒ Object
readonly
Returns the value of attribute pickup_minutes.
-
#printer ⇒ Object
readonly
Returns the value of attribute printer.
-
#state ⇒ Object
readonly
Returns the value of attribute state.
-
#status_url ⇒ Object
readonly
Returns the value of attribute status_url.
-
#status_url_method ⇒ Object
readonly
Returns the value of attribute status_url_method.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(attributes) ⇒ Job
constructor
A new instance of Job.
Constructor Details
#initialize(attributes) ⇒ Job
Returns a new instance of Job.
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/eatabit_rails/job.rb', line 22 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 |
Instance Attribute Details
#account ⇒ Object (readonly)
Returns the value of attribute account.
5 6 7 |
# File 'lib/eatabit_rails/job.rb', line 5 def account @account end |
#api_version ⇒ Object (readonly)
Returns the value of attribute api_version.
5 6 7 |
# File 'lib/eatabit_rails/job.rb', line 5 def api_version @api_version end |
#body ⇒ Object (readonly)
Returns the value of attribute body.
5 6 7 |
# File 'lib/eatabit_rails/job.rb', line 5 def body @body end |
#created_at ⇒ Object (readonly)
Returns the value of attribute created_at.
5 6 7 |
# File 'lib/eatabit_rails/job.rb', line 5 def created_at @created_at end |
#delivery_minutes ⇒ Object (readonly)
Returns the value of attribute delivery_minutes.
5 6 7 |
# File 'lib/eatabit_rails/job.rb', line 5 def delivery_minutes @delivery_minutes end |
#environment ⇒ Object (readonly)
Returns the value of attribute environment.
5 6 7 |
# File 'lib/eatabit_rails/job.rb', line 5 def environment @environment end |
#expire_seconds ⇒ Object (readonly)
Returns the value of attribute expire_seconds.
5 6 7 |
# File 'lib/eatabit_rails/job.rb', line 5 def expire_seconds @expire_seconds end |
#expires_at ⇒ Object (readonly)
Returns the value of attribute expires_at.
5 6 7 |
# File 'lib/eatabit_rails/job.rb', line 5 def expires_at @expires_at end |
#external_id ⇒ Object (readonly)
Returns the value of attribute external_id.
5 6 7 |
# File 'lib/eatabit_rails/job.rb', line 5 def external_id @external_id end |
#fulfill_at ⇒ Object (readonly)
Returns the value of attribute fulfill_at.
5 6 7 |
# File 'lib/eatabit_rails/job.rb', line 5 def fulfill_at @fulfill_at end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
5 6 7 |
# File 'lib/eatabit_rails/job.rb', line 5 def id @id end |
#pickup_minutes ⇒ Object (readonly)
Returns the value of attribute pickup_minutes.
5 6 7 |
# File 'lib/eatabit_rails/job.rb', line 5 def pickup_minutes @pickup_minutes end |
#printer ⇒ Object (readonly)
Returns the value of attribute printer.
5 6 7 |
# File 'lib/eatabit_rails/job.rb', line 5 def printer @printer end |
#state ⇒ Object (readonly)
Returns the value of attribute state.
5 6 7 |
# File 'lib/eatabit_rails/job.rb', line 5 def state @state end |
#status_url ⇒ Object (readonly)
Returns the value of attribute status_url.
5 6 7 |
# File 'lib/eatabit_rails/job.rb', line 5 def status_url @status_url end |
#status_url_method ⇒ Object (readonly)
Returns the value of attribute status_url_method.
5 6 7 |
# File 'lib/eatabit_rails/job.rb', line 5 def status_url_method @status_url_method end |
Class Method Details
.create(printer_id, job_attributes) ⇒ Object
41 42 43 44 45 46 47 48 |
# File 'lib/eatabit_rails/job.rb', line 41 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, job_attributes response_attributes = JSON.parse(response.body)['job'] new response_attributes end |
.find(printer_id, job_id) ⇒ Object
50 51 52 53 54 55 56 57 |
# File 'lib/eatabit_rails/job.rb', line 50 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 |