Sha256: 8531935a39275d7b44aee7e566e2006b932e53bec9d6676df3044fdfeea97348
Contents?: true
Size: 1.24 KB
Versions: 1
Compression:
Stored size: 1.24 KB
Contents
module EatabitRails class Printer attr_reader :id, :name, :enabled, :pickup_minutes, :delivery_minutes, :state, :online, :paper, :fulfillment, :sound, :light, :autoprint def initialize(attributes) @id = attributes['id'] @name = attributes['name'] @enabled = attributes['enabled'] @pickup_minutes = attributes['pickup_minutes'] @delivery_minutes = attributes['delivery_minutes'] @state = attributes['state'] @online = attributes['online'] @paper = attributes['paper'] @fulfillment = attributes['fulfillment'] @sound = attributes['sound'] @light = attributes['light'] @autoprint = attributes['autoprint'] end def self.find(id) printer_uri = EatabitRails::REST::Uri.new.printer id params = EatabitRails::REST::Uri.default_params response = RestClient.get printer_uri, params attributes = JSON.parse(response.body)['printer'] new(attributes) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
eatabit_rails-0.2.0 | lib/eatabit_rails/printer.rb |