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.



145
146
147
# File 'lib/awis-wrapper.rb', line 145

def initialize(arg)
  @node = arg
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(methodId) ⇒ Object



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

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



149
150
151
# File 'lib/awis-wrapper.rb', line 149

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

#get_all_child(str) ⇒ Object



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

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



175
176
177
# File 'lib/awis-wrapper.rb', line 175

def to_s
  @node.content
end