Class: MaxipagoApi::CustomerModel

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ CustomerModel

Returns a new instance of CustomerModel.



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

def initialize(options = {})
  self.customer_id_ext = options[:customer_id_ext]
  self.first_name = options[:first_name]
  self.last_name = options[:last_name]
  self.zipcode = options[:zipcode]
  self.email = options[:email]
  self.birth_date = options[:birth_date]
  self.document = options[:document]
  self.sex = options[:sex]
  self.address1 = options[:address1]
  self.address2 = options[:address2]
  self.city = options[:city]
  self.state = options[:state]
  self.zipcode = options[:zipcode]
  self.country = options[:country]
  self.phone = options[:phone]
  self.email = options[:email]
end

Instance Attribute Details

#address1Object

Returns the value of attribute address1.



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

def address1
  @address1
end

#address2Object

Returns the value of attribute address2.



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

def address2
  @address2
end

#birth_dateObject

Returns the value of attribute birth_date.



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

def birth_date
  @birth_date
end

#cityObject

Returns the value of attribute city.



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

def city
  @city
end

#countryObject

Returns the value of attribute country.



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

def country
  @country
end

#customer_id_extObject

Returns the value of attribute customer_id_ext.



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

def customer_id_ext
  @customer_id_ext
end

#documentObject

Returns the value of attribute document.



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

def document
  @document
end

#emailObject

Returns the value of attribute email.



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

def email
  @email
end

#first_nameObject

Returns the value of attribute first_name.



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

def first_name
  @first_name
end

#idObject

Returns the value of attribute id.



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

def id
  @id
end

#last_nameObject

Returns the value of attribute last_name.



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

def last_name
  @last_name
end

#phoneObject

Returns the value of attribute phone.



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

def phone
  @phone
end

#response_errorObject

Returns the value of attribute response_error.



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

def response_error
  @response_error
end

#sexObject

Returns the value of attribute sex.



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

def sex
  @sex
end

#stateObject

Returns the value of attribute state.



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

def state
  @state
end

#zipcodeObject

Returns the value of attribute zipcode.



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

def zipcode
  @zipcode
end

Class Method Details

.find(id) ⇒ Object



31
32
33
# File 'lib/maxipago_api/models/customer_model.rb', line 31

def self.find(id)
  MaxipagoApi::CustomerRequest.find(id)
end

Instance Method Details

#saveObject



27
28
29
# File 'lib/maxipago_api/models/customer_model.rb', line 27

def save
  MaxipagoApi::CustomerRequest.create(self)
end

#to_objectObject



35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/maxipago_api/models/customer_model.rb', line 35

def to_object
  {
    customerIdExt: self.customer_id_ext,
    firstName: self.first_name,
    lastName: self.last_name,
    zip: self.zipcode,
    email: self.email,
    dob: self.sex,
    ssn: self.document,
    sex: self.sex
}.select{|k,v| v.present?}
end