Class: Amazon::Awis::Element

Inherits:
Object
  • Object
show all
Defined in:
lib/awis-wrapper.rb

Instance Method Summary collapse

Constructor Details

#initialize(arg) ⇒ Element

Returns a new instance of Element.



147
148
149
# File 'lib/awis-wrapper.rb', line 147

def initialize(arg)
  @node = arg
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(methodId) ⇒ Object



166
167
168
169
170
171
172
173
174
175
# File 'lib/awis-wrapper.rb', line 166

def method_missing(methodId)
  result = @node.xpath("./aws:#{Amazon::Awis.camel_case methodId.to_s}", Awis::NAMESPACE)
  if result 
      result.collect do |r|
        Element.new r
      end
  else
    result
  end
end

Instance Method Details

#[](key) ⇒ Object



151
152
153
# File 'lib/awis-wrapper.rb', line 151

def [](key)
  @node[key.to_s]
end

#get_all_child(str) ⇒ Object



155
156
157
158
159
160
161
162
163
164
# File 'lib/awis-wrapper.rb', line 155

def get_all_child(str)
  result = @node.xpath(".//aws:#{Amazon::Awis.camel_case str.to_s}", Awis::NAMESPACE)
  if result 
      result.collect do |r|
        Element.new r
      end
  else
    result
  end
end

#to_sObject



177
178
179
# File 'lib/awis-wrapper.rb', line 177

def to_s
  @node.content
end