Class: Amazon::Associates::BrowseNode

Inherits:
ApiResult show all
Defined in:
lib/amazon-associates/types/browse_node.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id = nil, name = nil, parent = nil) ⇒ BrowseNode

Returns a new instance of BrowseNode.



18
19
20
21
22
# File 'lib/amazon-associates/types/browse_node.rb', line 18

def initialize(id = nil, name = nil, parent = nil)
  @id = id
  @name = name
  @parent = parent
end

Class Method Details

.find(browse_node_id, opts = {}) ⇒ Object



14
15
16
# File 'lib/amazon-associates/types/browse_node.rb', line 14

def self.find(browse_node_id, opts = {})
  Amazon::Associates.browse_node_lookup(opts.merge(:browse_node_id => browse_node_id)).browse_nodes.first
end

Instance Method Details

#==(other) ⇒ Object



32
33
34
35
# File 'lib/amazon-associates/types/browse_node.rb', line 32

def ==(other)
  return false unless other.respond_to?(:name, :id)
  @name == other.name and @id == other.id
end

#inspectObject



28
29
30
# File 'lib/amazon-associates/types/browse_node.rb', line 28

def inspect
  "#<#{self.class}:#{@id} #{self}>"
end

#to_sObject



24
25
26
# File 'lib/amazon-associates/types/browse_node.rb', line 24

def to_s
  "#{@name}#{' : ' + @parent.to_s if @parent}"
end