Class: Creditcard

Inherits:
Object
  • Object
show all
Extended by:
ActiveModel::Callbacks, ActiveModel::Naming
Includes:
ActiveModel::Conversion, ActiveModel::Validations, ActiveModel::Validations::Callbacks
Defined in:
app/models/creditcard.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attrs = {}) ⇒ Creditcard

Returns a new instance of Creditcard.



26
27
28
29
30
31
32
# File 'app/models/creditcard.rb', line 26

def initialize(attrs = {})
  sanitize_month_and_year(attrs)

  attrs.each do | name, value |
    send("#{name}=", value)
  end
end

Instance Attribute Details

#address1Object

Returns the value of attribute address1.



8
9
10
# File 'app/models/creditcard.rb', line 8

def address1
  @address1
end

#address2Object

Returns the value of attribute address2.



8
9
10
# File 'app/models/creditcard.rb', line 8

def address2
  @address2
end

#cardtypeObject

Returns the value of attribute cardtype.



9
10
11
# File 'app/models/creditcard.rb', line 9

def cardtype
  @cardtype
end

#cvvObject Also known as: verification_value

Returns the value of attribute cvv.



9
10
11
# File 'app/models/creditcard.rb', line 9

def cvv
  @cvv
end

#expires_onObject

Returns the value of attribute expires_on.



9
10
11
# File 'app/models/creditcard.rb', line 9

def expires_on
  @expires_on
end

#first_nameObject

Returns the value of attribute first_name.



8
9
10
# File 'app/models/creditcard.rb', line 8

def first_name
  @first_name
end

#last_nameObject

Returns the value of attribute last_name.



8
9
10
# File 'app/models/creditcard.rb', line 8

def last_name
  @last_name
end

#monthObject

Returns the value of attribute month.



9
10
11
# File 'app/models/creditcard.rb', line 9

def month
  @month
end

#numberObject

Returns the value of attribute number.



9
10
11
# File 'app/models/creditcard.rb', line 9

def number
  @number
end

#stateObject

Returns the value of attribute state.



8
9
10
# File 'app/models/creditcard.rb', line 8

def state
  @state
end

#yearObject

Returns the value of attribute year.



9
10
11
# File 'app/models/creditcard.rb', line 9

def year
  @year
end

#zipcodeObject

Returns the value of attribute zipcode.



8
9
10
# File 'app/models/creditcard.rb', line 8

def zipcode
  @zipcode
end

Instance Method Details

#persisted?Boolean

Returns:

  • (Boolean)


38
39
40
# File 'app/models/creditcard.rb', line 38

def persisted?
  false
end

#verification_value?Boolean

Returns:

  • (Boolean)


34
35
36
# File 'app/models/creditcard.rb', line 34

def verification_value?
  true # ActiveMerchant needs this
end