Class: GoogleCheckout::MerchantCalculation
- Inherits:
-
Object
- Object
- GoogleCheckout::MerchantCalculation
show all
- Defined in:
- lib/google-checkout/merchant_calculation.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
13
14
15
|
# File 'lib/google-checkout/merchant_calculation.rb', line 13
def initialize(doc) @doc = doc
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *args) ⇒ Object
21
22
23
24
25
26
27
28
29
|
# File 'lib/google-checkout/merchant_calculation.rb', line 21
def method_missing(method_name, *args)
element_name = method_name.to_s.gsub(/_/, '-')
if element = (doc.at element_name)
if element.respond_to?(:inner_html)
return element.inner_html
end
end
super
end
|
Class Method Details
.parse(raw_xml) ⇒ Object
8
9
10
11
|
# File 'lib/google-checkout/merchant_calculation.rb', line 8
def self.parse(raw_xml)
doc = Nokogiri::XML(raw_xml)
return new(doc)
end
|
Instance Method Details
#address_id ⇒ Object
17
18
19
|
# File 'lib/google-checkout/merchant_calculation.rb', line 17
def address_id
(doc/"anonymous-address").attr('id').value
end
|
#doc ⇒ Object
4
5
6
|
# File 'lib/google-checkout/merchant_calculation.rb', line 4
def doc
@doc ||= Nokogiri::XML::Builder.new
end
|