Class: MaxipagoApi::CreditCardModel

Inherits:
Object
  • Object
show all
Defined in:
lib/maxipago_api/models/credit_card_model.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ CreditCardModel

Returns a new instance of CreditCardModel.



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/maxipago_api/models/credit_card_model.rb', line 9

def initialize(options = {})
  self.customer_id = options[:customer_id]
  self.credit_card_number = options[:credit_card_number]
  self.expiration_month = options[:expiration_month]
  self.expiration_year = options[:expiration_year]
  self.billing_name = options[:billing_name]
  self.billing_address1 = options[:billing_address1]
  self.billing_address2 = options[:billing_address2]
  self.billing_city = options[:billing_city]
  self.billing_state = options[:billing_state]
  self.billing_zipcode = options[:billing_zipcode]
  self.billing_country = options[:billing_country]
  self.billing_phone = options[:billing_phone]
  self.billing_email = options[:billing_email]
end

Instance Attribute Details

#billing_address1Object

Returns the value of attribute billing_address1.



4
5
6
# File 'lib/maxipago_api/models/credit_card_model.rb', line 4

def billing_address1
  @billing_address1
end

#billing_address2Object

Returns the value of attribute billing_address2.



4
5
6
# File 'lib/maxipago_api/models/credit_card_model.rb', line 4

def billing_address2
  @billing_address2
end

#billing_cityObject

Returns the value of attribute billing_city.



4
5
6
# File 'lib/maxipago_api/models/credit_card_model.rb', line 4

def billing_city
  @billing_city
end

#billing_countryObject

Returns the value of attribute billing_country.



4
5
6
# File 'lib/maxipago_api/models/credit_card_model.rb', line 4

def billing_country
  @billing_country
end

#billing_emailObject

Returns the value of attribute billing_email.



4
5
6
# File 'lib/maxipago_api/models/credit_card_model.rb', line 4

def billing_email
  @billing_email
end

#billing_nameObject

Returns the value of attribute billing_name.



4
5
6
# File 'lib/maxipago_api/models/credit_card_model.rb', line 4

def billing_name
  @billing_name
end

#billing_phoneObject

Returns the value of attribute billing_phone.



4
5
6
# File 'lib/maxipago_api/models/credit_card_model.rb', line 4

def billing_phone
  @billing_phone
end

#billing_stateObject

Returns the value of attribute billing_state.



4
5
6
# File 'lib/maxipago_api/models/credit_card_model.rb', line 4

def billing_state
  @billing_state
end

#billing_zipcodeObject

Returns the value of attribute billing_zipcode.



4
5
6
# File 'lib/maxipago_api/models/credit_card_model.rb', line 4

def billing_zipcode
  @billing_zipcode
end

#credit_card_numberObject

Returns the value of attribute credit_card_number.



4
5
6
# File 'lib/maxipago_api/models/credit_card_model.rb', line 4

def credit_card_number
  @credit_card_number
end

#customer_idObject

Returns the value of attribute customer_id.



4
5
6
# File 'lib/maxipago_api/models/credit_card_model.rb', line 4

def customer_id
  @customer_id
end

#expiration_monthObject

Returns the value of attribute expiration_month.



4
5
6
# File 'lib/maxipago_api/models/credit_card_model.rb', line 4

def expiration_month
  @expiration_month
end

#expiration_yearObject

Returns the value of attribute expiration_year.



4
5
6
# File 'lib/maxipago_api/models/credit_card_model.rb', line 4

def expiration_year
  @expiration_year
end

Instance Method Details

#saveObject



25
26
27
# File 'lib/maxipago_api/models/credit_card_model.rb', line 25

def save
  MaxipagoApi::CreditCardRequest.save(self)
end

#to_objectObject



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/maxipago_api/models/credit_card_model.rb', line 29

def to_object
  {
    customerId: self.customer_id,
    creditCardNumber: self.credit_card_number,
    expirationMonth: self.expiration_month,
    expirationYear: self.expiration_year,
    billingName: self.billing_name,
    billingAddress1: self.billing_address1,
    billingAddress2: self.billing_address2,
    billingCity: self.billing_city,
    billingState: self.billing_state,
    billingZip: self.billing_zipcode,
    billingCountry: self.billing_country,
    billingPhone: self.billing_phone,
    billingEmail: self.billing_email,
  }.select{|k,v| v.present?}
end