Class: Exchequer::Card

Inherits:
Object
  • Object
show all
Defined in:
lib/exchequer/card.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params = {}) ⇒ Card

Returns a new instance of Card.



6
7
8
9
10
11
# File 'lib/exchequer/card.rb', line 6

def initialize(params = {})
  params ||= {}
  params.keys.each do |key|
    send "#{key}=", params[key]
  end
end

Instance Attribute Details

#billing_addressObject

Returns the value of attribute billing_address.



2
3
4
# File 'lib/exchequer/card.rb', line 2

def billing_address
  @billing_address
end

#billing_cityObject

Returns the value of attribute billing_city.



2
3
4
# File 'lib/exchequer/card.rb', line 2

def billing_city
  @billing_city
end

#billing_countryObject

Returns the value of attribute billing_country.



2
3
4
# File 'lib/exchequer/card.rb', line 2

def billing_country
  @billing_country
end

#billing_stateObject

Returns the value of attribute billing_state.



2
3
4
# File 'lib/exchequer/card.rb', line 2

def billing_state
  @billing_state
end

#billing_zipObject

Returns the value of attribute billing_zip.



2
3
4
# File 'lib/exchequer/card.rb', line 2

def billing_zip
  @billing_zip
end

#cvvObject

Returns the value of attribute cvv.



2
3
4
# File 'lib/exchequer/card.rb', line 2

def cvv
  @cvv
end

#expiration_monthObject

Returns the value of attribute expiration_month.



2
3
4
# File 'lib/exchequer/card.rb', line 2

def expiration_month
  @expiration_month
end

#expiration_yearObject

Returns the value of attribute expiration_year.



2
3
4
# File 'lib/exchequer/card.rb', line 2

def expiration_year
  @expiration_year
end

#first_nameObject

Returns the value of attribute first_name.



2
3
4
# File 'lib/exchequer/card.rb', line 2

def first_name
  @first_name
end

#full_numberObject

Returns the value of attribute full_number.



2
3
4
# File 'lib/exchequer/card.rb', line 2

def full_number
  @full_number
end

#last_nameObject

Returns the value of attribute last_name.



2
3
4
# File 'lib/exchequer/card.rb', line 2

def last_name
  @last_name
end

Instance Method Details

#errorsObject



13
14
15
# File 'lib/exchequer/card.rb', line 13

def errors
  @errors ||= ActiveModel::Errors.new(self)
end

#to_hashObject



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/exchequer/card.rb', line 17

def to_hash
  {
    'first_name'       => first_name,
    'last_name'        => last_name,
    'full_number'      => full_number,
    'cvv'              => cvv,
    'expiration_month' => expiration_month,
    'expiration_year'  => expiration_year,
    'billing_address'  => billing_address,
    'billing_city'     => billing_city,
    'billing_state'    => billing_state,
    'billing_zip'      => billing_zip,
    'billing_country'  => billing_country
  }
end