Class: Coinigy::Model
- Inherits:
-
Object
- Object
- Coinigy::Model
- Includes:
- ActiveModel::Model
- Defined in:
- lib/coinigy/model.rb
Overview
Base for models
Direct Known Subclasses
Account, Alert, Exchange, Market, Order, Preferences, Subscription
Instance Attribute Summary collapse
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
Instance Method Summary collapse
- #attributes ⇒ Object
- #errors? ⇒ Boolean
-
#initialize(attributes = {}) ⇒ Model
constructor
A new instance of Model.
- #inspect ⇒ Object
- #save ⇒ Object
Constructor Details
#initialize(attributes = {}) ⇒ Model
Returns a new instance of Model
8 9 10 11 |
# File 'lib/coinigy/model.rb', line 8 def initialize(attributes = {}) super @errors = [] end |
Instance Attribute Details
#errors ⇒ Object (readonly)
Returns the value of attribute errors
6 7 8 |
# File 'lib/coinigy/model.rb', line 6 def errors @errors end |
Instance Method Details
#attributes ⇒ Object
13 14 15 |
# File 'lib/coinigy/model.rb', line 13 def attributes {} end |
#errors? ⇒ Boolean
17 18 19 |
# File 'lib/coinigy/model.rb', line 17 def errors? @errors.present? end |
#inspect ⇒ Object
25 26 27 |
# File 'lib/coinigy/model.rb', line 25 def inspect "<#{self.class} #{attributes.inspect}>" end |
#save ⇒ Object
21 22 23 |
# File 'lib/coinigy/model.rb', line 21 def save send_to_server { save_to_api(attributes) } end |