Class: KondutoCustomer

Inherits:
Object
  • Object
show all
Defined in:
lib/konduto-ruby/konduto_customer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ KondutoCustomer

Returns a new instance of KondutoCustomer.



4
5
6
7
8
9
10
# File 'lib/konduto-ruby/konduto_customer.rb', line 4

def initialize(*args)
  unless args[0].nil?
    args[0].each do |k,v|
      instance_variable_set("@#{k}", v) unless v.nil?
    end
  end
end

Instance Attribute Details

#created_atObject

Returns the value of attribute created_at.



2
3
4
# File 'lib/konduto-ruby/konduto_customer.rb', line 2

def created_at
  @created_at
end

#dobObject

Returns the value of attribute dob.



2
3
4
# File 'lib/konduto-ruby/konduto_customer.rb', line 2

def dob
  @dob
end

#emailObject

Returns the value of attribute email.



2
3
4
# File 'lib/konduto-ruby/konduto_customer.rb', line 2

def email
  @email
end

#idObject

Returns the value of attribute id.



2
3
4
# File 'lib/konduto-ruby/konduto_customer.rb', line 2

def id
  @id
end

#nameObject

Returns the value of attribute name.



2
3
4
# File 'lib/konduto-ruby/konduto_customer.rb', line 2

def name
  @name
end

#newObject

Returns the value of attribute new.



2
3
4
# File 'lib/konduto-ruby/konduto_customer.rb', line 2

def new
  @new
end

#phone1Object

Returns the value of attribute phone1.



2
3
4
# File 'lib/konduto-ruby/konduto_customer.rb', line 2

def phone1
  @phone1
end

#phone2Object

Returns the value of attribute phone2.



2
3
4
# File 'lib/konduto-ruby/konduto_customer.rb', line 2

def phone2
  @phone2
end

#tax_idObject

Returns the value of attribute tax_id.



2
3
4
# File 'lib/konduto-ruby/konduto_customer.rb', line 2

def tax_id
  @tax_id
end

#vipObject

Returns the value of attribute vip.



2
3
4
# File 'lib/konduto-ruby/konduto_customer.rb', line 2

def vip
  @vip
end

Instance Method Details

#to_hashObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/konduto-ruby/konduto_customer.rb', line 12

def to_hash
  hash = {
      id: self.id,
      name: self.name,
      email: self.email,
      dob: self.dob,
      tax_id: self.tax_id,
      phone1: self.phone1,
      phone2: self.phone2,
      created_at: self.created_at,
      new: self.new,
      vip: self.vip
  }
  KondutoUtils.remove_nil_keys_from_hash(hash)
end

#to_jsonObject



28
29
30
# File 'lib/konduto-ruby/konduto_customer.rb', line 28

def to_json
  self.to_hash.to_json
end