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)
-
- (Object) raw
readonly
Returns the value of attribute raw.
Instance Method Summary (collapse)
- - (Object) ancestors
- - (Object) children
-
- (SimpleNode) initialize(hash)
constructor
A new instance of SimpleNode.
- - (Object) name
- - (Object) node_id
- - (Object) top_item_set
Constructor Details
- (SimpleNode) initialize(hash)
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
- (Object) raw (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
- (Object) ancestors
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 |
- (Object) children
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 |
- (Object) name
19 20 21 |
# File 'lib/asin/simple_node.rb', line 19 def name @raw.Name end |
- (Object) node_id
23 24 25 |
# File 'lib/asin/simple_node.rb', line 23 def node_id @raw.BrowseNodeId end |
- (Object) top_item_set
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 |