Module: Spreedly::Fields
- Included in:
- AuthMode, Credential, DeliverPaymentResponse, GatewayClass, Model, ReceiverClass, Response, ShippingAddress
- Defined in:
- lib/spreedly/common/fields.rb
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.included(base) ⇒ Object
4 5 6 |
# File 'lib/spreedly/common/fields.rb', line 4 def self.included(base) base.extend ClassMethods end |
Instance Method Details
#field_hash ⇒ Object
18 19 20 21 22 23 |
# File 'lib/spreedly/common/fields.rb', line 18 def field_hash self.class.fields.inject({}) do |hash, each| hash[each] = send(each) hash end end |
#initialize_fields(xml_doc) ⇒ Object
8 9 10 11 12 13 14 15 16 |
# File 'lib/spreedly/common/fields.rb', line 8 def initialize_fields(xml_doc) self.class.fields.each do |field| node = xml_doc.at_xpath(".//#{field}") if node value = node.inner_html.strip instance_variable_set("@#{field}", value) end end end |