Class: EatabitRails::Printer

Inherits:
Object
  • Object
show all
Defined in:
lib/eatabit_rails/printer.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes) ⇒ Printer

Returns a new instance of Printer.



18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/eatabit_rails/printer.rb', line 18

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

Instance Attribute Details

#autoprintObject (readonly)

Returns the value of attribute autoprint.



5
6
7
# File 'lib/eatabit_rails/printer.rb', line 5

def autoprint
  @autoprint
end

#delivery_minutesObject (readonly)

Returns the value of attribute delivery_minutes.



5
6
7
# File 'lib/eatabit_rails/printer.rb', line 5

def delivery_minutes
  @delivery_minutes
end

#enabledObject (readonly)

Returns the value of attribute enabled.



5
6
7
# File 'lib/eatabit_rails/printer.rb', line 5

def enabled
  @enabled
end

#fulfillmentObject (readonly)

Returns the value of attribute fulfillment.



5
6
7
# File 'lib/eatabit_rails/printer.rb', line 5

def fulfillment
  @fulfillment
end

#idObject (readonly)

Returns the value of attribute id.



5
6
7
# File 'lib/eatabit_rails/printer.rb', line 5

def id
  @id
end

#lightObject (readonly)

Returns the value of attribute light.



5
6
7
# File 'lib/eatabit_rails/printer.rb', line 5

def light
  @light
end

#nameObject (readonly)

Returns the value of attribute name.



5
6
7
# File 'lib/eatabit_rails/printer.rb', line 5

def name
  @name
end

#onlineObject (readonly)

Returns the value of attribute online.



5
6
7
# File 'lib/eatabit_rails/printer.rb', line 5

def online
  @online
end

#paperObject (readonly)

Returns the value of attribute paper.



5
6
7
# File 'lib/eatabit_rails/printer.rb', line 5

def paper
  @paper
end

#pickup_minutesObject (readonly)

Returns the value of attribute pickup_minutes.



5
6
7
# File 'lib/eatabit_rails/printer.rb', line 5

def pickup_minutes
  @pickup_minutes
end

#soundObject (readonly)

Returns the value of attribute sound.



5
6
7
# File 'lib/eatabit_rails/printer.rb', line 5

def sound
  @sound
end

#stateObject (readonly)

Returns the value of attribute state.



5
6
7
# File 'lib/eatabit_rails/printer.rb', line 5

def state
  @state
end

Class Method Details

.find(id) ⇒ Object



33
34
35
36
37
38
39
40
# File 'lib/eatabit_rails/printer.rb', line 33

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