Class: Clearbooks::Base
- Inherits:
-
Object
- Object
- Clearbooks::Base
- Defined in:
- lib/clearbooks/model/base.rb
Class Method Summary collapse
-
.build(data) ⇒ Array
List of items that represent collection from hash returned by Savon.
-
.create(data) ⇒ Object
An item instantiated from a hash returned by Savon.
Class Method Details
.build(data) ⇒ Array
Note:
Still returns an array when called with a hash representing a single item.
Returns List of items that represent collection from hash returned by Savon.
22 23 24 25 26 27 28 29 30 |
# File 'lib/clearbooks/model/base.rb', line 22 def build data if data.nil? Array.new elsif data.is_a? Array data.map { |d| create(d) } else [ create(data) ] end end |
.create(data) ⇒ Object
Returns An item instantiated from a hash returned by Savon.
38 39 40 41 42 43 44 |
# File 'lib/clearbooks/model/base.rb', line 38 def create data if data.is_a? Hash new data else data end end |