Sha256: 20e396a377d6f387e026d1be4c27f1046542d278f27866a6e49fa7094e3c905f
Contents?: true
Size: 1.78 KB
Versions: 1
Compression:
Stored size: 1.78 KB
Contents
# frozen_string_literal: true module EatabitRails class Job attr_reader( :id, :external_id, :body, :state, :environment, :pickup_minutes, :delivery_minutes, :status_url, :status_url_method, :created_at, :fulfill_at, :api_version, :expire_seconds, :expires_at, :account, :printer ) 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 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 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 end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
eatabit_rails-0.2.1 | lib/eatabit_rails/job.rb |