Class: GoCardlessPro::Resources::Customer

Inherits:
Object
  • Object
show all
Defined in:
lib/gocardless_pro/resources/customer.rb

Overview

Customer objects hold the contact details for a customer. A customer can have several customer bank accounts (https://developer.gocardless.com/api-reference/#core-endpoints-customer-bank-accounts), which in turn can have several Direct Debit mandates (https://developer.gocardless.com/api-reference/#core-endpoints-mandates).

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(object, response = nil) ⇒ Customer

Initialize a customer resource instance

Parameters:

  • object (Hash)

    an object returned from the API



40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/gocardless_pro/resources/customer.rb', line 40

def initialize(object, response = nil)
  @object = object

  @address_line1 = object['address_line1']
  @address_line2 = object['address_line2']
  @address_line3 = object['address_line3']
  @city = object['city']
  @company_name = object['company_name']
  @country_code = object['country_code']
  @created_at = object['created_at']
  @danish_identity_number = object['danish_identity_number']
  @email = object['email']
  @family_name = object['family_name']
  @given_name = object['given_name']
  @id = object['id']
  @language = object['language']
  @metadata = object['metadata']
  @phone_number = object['phone_number']
  @postal_code = object['postal_code']
  @region = object['region']
  @swedish_identity_number = object['swedish_identity_number']
  @response = response
end

Instance Attribute Details

#address_line1Object (readonly)

Returns the value of attribute address_line1.



19
20
21
# File 'lib/gocardless_pro/resources/customer.rb', line 19

def address_line1
  @address_line1
end

#address_line2Object (readonly)

Returns the value of attribute address_line2.



20
21
22
# File 'lib/gocardless_pro/resources/customer.rb', line 20

def address_line2
  @address_line2
end

#address_line3Object (readonly)

Returns the value of attribute address_line3.



21
22
23
# File 'lib/gocardless_pro/resources/customer.rb', line 21

def address_line3
  @address_line3
end

#cityObject (readonly)

Returns the value of attribute city.



22
23
24
# File 'lib/gocardless_pro/resources/customer.rb', line 22

def city
  @city
end

#company_nameObject (readonly)

Returns the value of attribute company_name.



23
24
25
# File 'lib/gocardless_pro/resources/customer.rb', line 23

def company_name
  @company_name
end

#country_codeObject (readonly)

Returns the value of attribute country_code.



24
25
26
# File 'lib/gocardless_pro/resources/customer.rb', line 24

def country_code
  @country_code
end

#created_atObject (readonly)

Returns the value of attribute created_at.



25
26
27
# File 'lib/gocardless_pro/resources/customer.rb', line 25

def created_at
  @created_at
end

#danish_identity_numberObject (readonly)

Returns the value of attribute danish_identity_number.



26
27
28
# File 'lib/gocardless_pro/resources/customer.rb', line 26

def danish_identity_number
  @danish_identity_number
end

#emailObject (readonly)

Returns the value of attribute email.



27
28
29
# File 'lib/gocardless_pro/resources/customer.rb', line 27

def email
  @email
end

#family_nameObject (readonly)

Returns the value of attribute family_name.



28
29
30
# File 'lib/gocardless_pro/resources/customer.rb', line 28

def family_name
  @family_name
end

#given_nameObject (readonly)

Returns the value of attribute given_name.



29
30
31
# File 'lib/gocardless_pro/resources/customer.rb', line 29

def given_name
  @given_name
end

#idObject (readonly)

Returns the value of attribute id.



30
31
32
# File 'lib/gocardless_pro/resources/customer.rb', line 30

def id
  @id
end

#languageObject (readonly)

Returns the value of attribute language.



31
32
33
# File 'lib/gocardless_pro/resources/customer.rb', line 31

def language
  @language
end

#metadataObject (readonly)

Returns the value of attribute metadata.



32
33
34
# File 'lib/gocardless_pro/resources/customer.rb', line 32

def 
  @metadata
end

#phone_numberObject (readonly)

Returns the value of attribute phone_number.



33
34
35
# File 'lib/gocardless_pro/resources/customer.rb', line 33

def phone_number
  @phone_number
end

#postal_codeObject (readonly)

Returns the value of attribute postal_code.



34
35
36
# File 'lib/gocardless_pro/resources/customer.rb', line 34

def postal_code
  @postal_code
end

#regionObject (readonly)

Returns the value of attribute region.



35
36
37
# File 'lib/gocardless_pro/resources/customer.rb', line 35

def region
  @region
end

#swedish_identity_numberObject (readonly)

Returns the value of attribute swedish_identity_number.



36
37
38
# File 'lib/gocardless_pro/resources/customer.rb', line 36

def swedish_identity_number
  @swedish_identity_number
end

Instance Method Details

#api_responseObject



64
65
66
# File 'lib/gocardless_pro/resources/customer.rb', line 64

def api_response
  ApiResponse.new(@response)
end

#to_hObject

Provides the customer resource as a hash of all its readable attributes



69
70
71
# File 'lib/gocardless_pro/resources/customer.rb', line 69

def to_h
  @object
end