lib/mymoip/credit_card.rb in mymoip-0.6.1 vs lib/mymoip/credit_card.rb in mymoip-0.6.2
- old
+ new
@@ -14,20 +14,12 @@
validates_length_of :security_code, within: 3..4
validates_format_of :expiration_date, with: /\A(?:(?:0[1-9])|(?:1[02]))\/\d{2}\Z/ # %m/%y
validates_inclusion_of :logo, in: AVAILABLE_LOGOS
def initialize(attrs)
- self.logo = attrs[:logo]
- self.card_number = attrs[:card_number]
- self.expiration_date = attrs[:expiration_date]
- self.security_code = attrs[:security_code]
- self.owner_name = attrs[:owner_name]
- self.owner_birthday = attrs[:owner_birthday]
- self.owner_phone = attrs[:owner_phone]
- self.owner_cpf = attrs[:owner_cpf]
-
- # Deprecated attributes
- self.owner_rg = attrs[:owner_rg] if attrs.has_key?(:owner_rg)
+ attrs.each do |attr, value|
+ public_send(:"#{attr}=", value)
+ end
end
def logo=(value)
value = value.to_sym unless value.nil?
@logo = value