Class: TerminalOrder
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- TerminalOrder
- Defined in:
- app/models/terminal_order.rb
Instance Method Summary collapse
- #complete! ⇒ Object
- #complete? ⇒ Boolean
- #error? ⇒ Boolean
- #sent!(percent = nil, error = nil) ⇒ Object
- #sent? ⇒ Boolean
- #title ⇒ Object
Instance Method Details
#complete! ⇒ Object
39 40 41 |
# File 'app/models/terminal_order.rb', line 39 def complete! update_attribute(:state, 'complete') end |
#complete? ⇒ Boolean
31 32 33 |
# File 'app/models/terminal_order.rb', line 31 def complete? state == 'complete' end |
#error? ⇒ Boolean
23 24 25 |
# File 'app/models/terminal_order.rb', line 23 def error? !error.blank? end |
#sent!(percent = nil, error = nil) ⇒ Object
35 36 37 |
# File 'app/models/terminal_order.rb', line 35 def sent!(percent=nil, error=nil) update_attributes(:state => (complete? ? 'complete' : 'sent'), :percent => [percent.to_i, self.percent.to_i].max, :error => error) end |
#sent? ⇒ Boolean
27 28 29 |
# File 'app/models/terminal_order.rb', line 27 def sent? state == 'sent' end |
#title ⇒ Object
19 20 21 |
# File 'app/models/terminal_order.rb', line 19 def title I18n.t "smartkiosk.terminal_orders.#{keyword}" end |