Class: Pin::Card

Inherits:
Base
  • Object
show all
Defined in:
lib/pin-payments/card.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

all, find, first, last

Constructor Details

#initialize(attributes = {}) ⇒ Card

Returns a new instance of Card.



8
9
10
# File 'lib/pin-payments/card.rb', line 8

def initialize(attributes = {})
  attributes.each {|name, value| send("#{name}=", value)}
end

Instance Attribute Details

#address_cityObject

Returns the value of attribute address_city.



3
4
5
# File 'lib/pin-payments/card.rb', line 3

def address_city
  @address_city
end

#address_countryObject

Returns the value of attribute address_country.



3
4
5
# File 'lib/pin-payments/card.rb', line 3

def address_country
  @address_country
end

#address_line1Object

Returns the value of attribute address_line1.



3
4
5
# File 'lib/pin-payments/card.rb', line 3

def address_line1
  @address_line1
end

#address_line2Object

Returns the value of attribute address_line2.



3
4
5
# File 'lib/pin-payments/card.rb', line 3

def address_line2
  @address_line2
end

#address_postcodeObject

Returns the value of attribute address_postcode.



3
4
5
# File 'lib/pin-payments/card.rb', line 3

def address_postcode
  @address_postcode
end

#address_stateObject

Returns the value of attribute address_state.



3
4
5
# File 'lib/pin-payments/card.rb', line 3

def address_state
  @address_state
end

#cvcObject

Returns the value of attribute cvc.



3
4
5
# File 'lib/pin-payments/card.rb', line 3

def cvc
  @cvc
end

#display_numberObject

Returns the value of attribute display_number.



3
4
5
# File 'lib/pin-payments/card.rb', line 3

def display_number
  @display_number
end

#expiry_monthObject

Returns the value of attribute expiry_month.



3
4
5
# File 'lib/pin-payments/card.rb', line 3

def expiry_month
  @expiry_month
end

#expiry_yearObject

Returns the value of attribute expiry_year.



3
4
5
# File 'lib/pin-payments/card.rb', line 3

def expiry_year
  @expiry_year
end

#nameObject

Returns the value of attribute name.



3
4
5
# File 'lib/pin-payments/card.rb', line 3

def name
  @name
end

#numberObject

Returns the value of attribute number.



3
4
5
# File 'lib/pin-payments/card.rb', line 3

def number
  @number
end

#schemeObject

Returns the value of attribute scheme.



3
4
5
# File 'lib/pin-payments/card.rb', line 3

def scheme
  @scheme
end

#tokenObject

Returns the value of attribute token.



3
4
5
# File 'lib/pin-payments/card.rb', line 3

def token
  @token
end

Class Method Details

.create(options = {}) ⇒ Object

options should be a hash with the following keys: :number, :expiry_month, :expiry_year, :cvc, :name, :address_line1, :address_city, :address_postcode, :address_state, :address_country

it can also have the following optional keys: :address_line2



25
26
27
# File 'lib/pin-payments/card.rb', line 25

def create(options = {})
  super(options)
end

Instance Method Details

#to_hashObject



12
13
14
15
16
# File 'lib/pin-payments/card.rb', line 12

def to_hash
  hash = {}
  instance_variables.each {|var| hash[var.to_s.delete("@")] = instance_variable_get(var) }
  hash
end