Module: Rews::Item
- Defined in:
- lib/rews/item.rb
Defined Under Namespace
Class Method Summary collapse
-
.read_get_item_response_messages(client, get_item_response_messages) ⇒ Object
return a list of Item objects from a list of GetItemResponseMessages.
-
.read_items(client, items) ⇒ Object
return a list of Item objects given a hash formed from an Items element.
Class Method Details
.read_get_item_response_messages(client, get_item_response_messages) ⇒ Object
return a list of Item objects from a list of GetItemResponseMessages
17 18 19 20 21 22 |
# File 'lib/rews/item.rb', line 17 def (client, ) = [] if !.is_a?(Array) items = .map do |girm| read_items(client, girm[:items]) end.flatten end |
.read_items(client, items) ⇒ Object
return a list of Item objects given a hash formed from an Items element
6 7 8 9 10 11 12 13 14 |
# File 'lib/rews/item.rb', line 6 def read_items(client, items) return [] if !items items.map do |item_class,items_of_class| items_of_class = [items_of_class] if !items_of_class.is_a?(Array) items_of_class.map do |item| Item.new(client, item_class, item) end end.flatten end |