Sha256: 7957b3edb2fb0e368a9267d1b6f1484648fc5cb1ae349335effd6f6c0e0fcc70
Contents?: true
Size: 848 Bytes
Versions: 4
Compression:
Stored size: 848 Bytes
Contents
module Spreedly class GatewayClass include Fields field :gateway_type, :name, :supported_countries, :homepage attr_reader :supported_countries, :payment_methods def initialize(xml_doc) initialize_fields(xml_doc) init_supported_countries(xml_doc) init_payment_methods(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 end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
spreedly-2.0.5 | lib/spreedly/gateway_class.rb |
spreedly-2.0.4 | lib/spreedly/gateway_class.rb |
spreedly-2.0.3 | lib/spreedly/gateway_class.rb |
spreedly-2.0.2 | lib/spreedly/gateway_class.rb |