class Spreedly::GatewayClass

Attributes

auth_modes[R]
payment_methods[R]
regions[R]
supported_countries[R]

Public Class Methods

new(xml_doc) click to toggle source
# File lib/spreedly/gateway_class.rb, line 18
def initialize(xml_doc)
  initialize_fields(xml_doc)
  init_supported_countries(xml_doc)
  init_regions(xml_doc)
  init_payment_methods(xml_doc)
  init_auth_modes(xml_doc)
end
new_list_from(xml_doc) click to toggle source
# File lib/spreedly/gateway_class.rb, line 26
def self.new_list_from(xml_doc)
  gateways = xml_doc.xpath('.//gateways/gateway')
  gateways.map do |each|
    self.new(each)
  end
end

Private Instance Methods

init_auth_modes(xml_doc) click to toggle source
# File lib/spreedly/gateway_class.rb, line 51
def init_auth_modes(xml_doc)
  @auth_modes = xml_doc.xpath(".//auth_modes/auth_mode").map do |each|
    Spreedly::AuthMode.new(each)
  end
end
init_payment_methods(xml_doc) click to toggle source
# File lib/spreedly/gateway_class.rb, line 45
def init_payment_methods(xml_doc)
  @payment_methods = xml_doc.xpath('.//payment_methods/payment_method').map do |each|
    each.text
  end
end
init_regions(xml_doc) click to toggle source
# File lib/spreedly/gateway_class.rb, line 40
def init_regions(xml_doc)
  list = xml_doc.at_xpath(".//regions").inner_html.strip
  @regions = list.split(/\s*,\s*/)
end
init_supported_countries(xml_doc) click to toggle source
# File lib/spreedly/gateway_class.rb, line 35
def init_supported_countries(xml_doc)
  list = xml_doc.at_xpath(".//supported_countries").inner_html.strip
  @supported_countries = list.split(/\s*,\s*/)
end