Sha256: c74f469565e998f6b51fa06987c53f8b958e9fe1ec5f12f8b72ea19946bb07f6
Contents?: true
Size: 1.03 KB
Versions: 1
Compression:
Stored size: 1.03 KB
Contents
module Spreedly class GatewayClass include Fields field :gateway_type, :name, :supported_countries, :homepage attr_reader :supported_countries, :payment_methods, :auth_modes def initialize(xml_doc) initialize_fields(xml_doc) init_supported_countries(xml_doc) init_payment_methods(xml_doc) init_auth_modes(xml_doc) end def self.new_list_from(xml_doc) gateways = xml_doc.xpath('.//gateways/gateway') gateways.map do |each| self.new(each) end end private def init_supported_countries(xml_doc) list = xml_doc.at_xpath(".//supported_countries").inner_html.strip @supported_countries = list.split(/\s*,\s*/) end def init_payment_methods(xml_doc) @payment_methods = xml_doc.xpath('.//payment_methods/payment_method').map do |each| each.text end end def init_auth_modes(xml_doc) @auth_modes = xml_doc.xpath(".//auth_modes/auth_mode").map do |each| Spreedly::AuthMode.new(each) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
spreedly-2.0.6 | lib/spreedly/gateway_class.rb |