Class: ASIN::SimpleNode
- Inherits:
-
Object
- Object
- ASIN::SimpleNode
- Defined in:
- lib/asin/simple_node.rb
Overview
SimpleNode
The SimpleNode
class is a wrapper for the Amazon XML-REST-Response.
A Hashie::Mash is used for the internal data representation and can be accessed over the raw
attribute.
Instance Attribute Summary collapse
-
#raw ⇒ Object
readonly
Returns the value of attribute raw.
Instance Method Summary collapse
- #ancestors ⇒ Object
- #children ⇒ Object
-
#initialize(hash) ⇒ SimpleNode
constructor
A new instance of SimpleNode.
- #name ⇒ Object
- #node_id ⇒ Object
- #top_item_set ⇒ Object
Constructor Details
#initialize(hash) ⇒ SimpleNode
Returns a new instance of SimpleNode.
15 16 17 |
# File 'lib/asin/simple_node.rb', line 15 def initialize(hash) @raw = Hashie::Mash.new(hash) end |
Instance Attribute Details
#raw ⇒ Object (readonly)
Returns the value of attribute raw.
13 14 15 |
# File 'lib/asin/simple_node.rb', line 13 def raw @raw end |
Instance Method Details
#ancestors ⇒ Object
32 33 34 35 |
# File 'lib/asin/simple_node.rb', line 32 def ancestors return [] unless @raw.Ancestors @raw.Ancestors.BrowseNode.is_a?(Array) ? @raw.Ancestors.BrowseNode : [@raw.Ancestors.BrowseNode] end |
#children ⇒ Object
27 28 29 30 |
# File 'lib/asin/simple_node.rb', line 27 def children return [] unless @raw.Children @raw.Children.BrowseNode.is_a?(Array) ? @raw.Children.BrowseNode : [@raw.Children.BrowseNode] end |
#name ⇒ Object
19 20 21 |
# File 'lib/asin/simple_node.rb', line 19 def name @raw.Name end |
#node_id ⇒ Object
23 24 25 |
# File 'lib/asin/simple_node.rb', line 23 def node_id @raw.BrowseNodeId end |
#top_item_set ⇒ Object
37 38 39 40 |
# File 'lib/asin/simple_node.rb', line 37 def top_item_set return [] unless @raw.TopItemSet @raw.TopItemSet.TopItem.is_a?(Array) ? @raw.TopItemSet.TopItem : [@raw.TopItemSet.TopItem] end |