Class: RBook::GBIP::Warehouse
- Inherits:
-
Object
- Object
- RBook::GBIP::Warehouse
- Defined in:
- lib/rbook/gbip/warehouse.rb
Overview
models a warehouse supply detail from the Global Books in Print API
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
-
#onhand ⇒ Object
Returns the value of attribute onhand.
-
#onorder ⇒ Object
Returns the value of attribute onorder.
-
#status ⇒ Object
Returns the value of attribute status.
-
#updated_at ⇒ Object
Returns the value of attribute updated_at.
Instance Method Summary collapse
-
#initialize(arr) ⇒ Warehouse
constructor
A new instance of Warehouse.
Constructor Details
#initialize(arr) ⇒ Warehouse
Returns a new instance of Warehouse.
12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/rbook/gbip/warehouse.rb', line 12 def initialize(arr) raise ArgumentError, "arr must be an array" unless arr.class == Array raise ArgumentError, "Invalid number of array elements" unless arr.size == 5 self.name = arr[0].strip self.status = arr[1].strip self.onhand = arr[2].to_i self.onorder = arr[3].to_i tmpdate = arr[4] self.updated_at = Date.civil(tmpdate[6,4].to_i, tmpdate[0,2].to_i, tmpdate[3,2].to_i) end |
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
10 11 12 |
# File 'lib/rbook/gbip/warehouse.rb', line 10 def name @name end |
#onhand ⇒ Object
Returns the value of attribute onhand.
10 11 12 |
# File 'lib/rbook/gbip/warehouse.rb', line 10 def onhand @onhand end |
#onorder ⇒ Object
Returns the value of attribute onorder.
10 11 12 |
# File 'lib/rbook/gbip/warehouse.rb', line 10 def onorder @onorder end |
#status ⇒ Object
Returns the value of attribute status.
10 11 12 |
# File 'lib/rbook/gbip/warehouse.rb', line 10 def status @status end |
#updated_at ⇒ Object
Returns the value of attribute updated_at.
10 11 12 |
# File 'lib/rbook/gbip/warehouse.rb', line 10 def updated_at @updated_at end |