class Spreedly::PaymentMethod
Attributes
errors[R]
Public Class Methods
new(xml_doc)
click to toggle source
Calls superclass method
Spreedly::Model::new
# File lib/spreedly/payment_methods/payment_method.rb, line 12 def initialize(xml_doc) super @errors = errors_from(xml_doc) end
new_from(xml_doc)
click to toggle source
# File lib/spreedly/payment_methods/payment_method.rb, line 17 def self.new_from(xml_doc) case xml_doc.at_xpath('.//payment_method_type').inner_text when 'credit_card' return CreditCard.new(xml_doc) when 'paypal' return Paypal.new(xml_doc) when 'sprel' return Sprel.new(xml_doc) when 'bank_account' return BankAccount.new(xml_doc) when 'third_party_token' return ThirdPartyToken.new(xml_doc) end end
new_list_from(xml_doc)
click to toggle source
# File lib/spreedly/payment_methods/payment_method.rb, line 32 def self.new_list_from(xml_doc) payment_methods = xml_doc.xpath('.//payment_methods/payment_method') payment_methods.map do |each| self.new_from(each) end end
Public Instance Methods
valid?()
click to toggle source
# File lib/spreedly/payment_methods/payment_method.rb, line 39 def valid? @errors.empty? end