Class: Paid::Customer

Inherits:
APIResource show all
Defined in:
lib/paid/customer.rb

Instance Attribute Summary collapse

Attributes inherited from APIResource

#api_method, #json

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from APIResource

add_api_attribute, api_attribute_names, #api_attributes, api_subclass_fetch, api_subclasses, #changed_api_attributes, #clear_api_attributes, determine_api_attribute_value, #determine_api_attribute_value, #initialize, #inspect, #inspect_api_attributes, #inspect_nested, #refresh_from, register_api_subclass, #to_json

Constructor Details

This class inherits a constructor from Paid::APIResource

Instance Attribute Details

#address_cityObject

Returns the value of attribute address_city.



12
13
14
# File 'lib/paid/customer.rb', line 12

def address_city
  @address_city
end

#address_countryObject

Returns the value of attribute address_country.



15
16
17
# File 'lib/paid/customer.rb', line 15

def address_country
  @address_country
end

#address_line1Object

Returns the value of attribute address_line1.



10
11
12
# File 'lib/paid/customer.rb', line 10

def address_line1
  @address_line1
end

#address_line2Object

Returns the value of attribute address_line2.



11
12
13
# File 'lib/paid/customer.rb', line 11

def address_line2
  @address_line2
end

#address_stateObject

Returns the value of attribute address_state.



13
14
15
# File 'lib/paid/customer.rb', line 13

def address_state
  @address_state
end

#address_zipObject

Returns the value of attribute address_zip.



14
15
16
# File 'lib/paid/customer.rb', line 14

def address_zip
  @address_zip
end

#allow_achObject

Returns the value of attribute allow_ach.



16
17
18
# File 'lib/paid/customer.rb', line 16

def allow_ach
  @allow_ach
end

#allow_checkObject

Returns the value of attribute allow_check.



18
19
20
# File 'lib/paid/customer.rb', line 18

def allow_check
  @allow_check
end

#allow_credit_cardObject

Returns the value of attribute allow_credit_card.



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

def allow_credit_card
  @allow_credit_card
end

#allow_wireObject

Returns the value of attribute allow_wire.



17
18
19
# File 'lib/paid/customer.rb', line 17

def allow_wire
  @allow_wire
end

#auto_generateObject

Returns the value of attribute auto_generate.



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

def auto_generate
  @auto_generate
end

#auto_issueObject

Returns the value of attribute auto_issue.



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

def auto_issue
  @auto_issue
end

#billing_cycleObject

Returns the value of attribute billing_cycle.



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

def billing_cycle
  @billing_cycle
end

#billing_typeObject

Returns the value of attribute billing_type.



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

def billing_type
  @billing_type
end

#descriptionObject

Returns the value of attribute description.



7
8
9
# File 'lib/paid/customer.rb', line 7

def description
  @description
end

#emailObject

Returns the value of attribute email.



6
7
8
# File 'lib/paid/customer.rb', line 6

def email
  @email
end

#external_idObject

Returns the value of attribute external_id.



8
9
10
# File 'lib/paid/customer.rb', line 8

def external_id
  @external_id
end

#idObject (readonly)

Returns the value of attribute id.



3
4
5
# File 'lib/paid/customer.rb', line 3

def id
  @id
end

#nameObject

Returns the value of attribute name.



5
6
7
# File 'lib/paid/customer.rb', line 5

def name
  @name
end

#objectObject (readonly)

Returns the value of attribute object.



4
5
6
# File 'lib/paid/customer.rb', line 4

def object
  @object
end

#phoneObject

Returns the value of attribute phone.



9
10
11
# File 'lib/paid/customer.rb', line 9

def phone
  @phone
end

#stripe_customer_idObject

Returns the value of attribute stripe_customer_id.



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

def stripe_customer_id
  @stripe_customer_id
end

#termsObject

Returns the value of attribute terms.



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

def terms
  @terms
end

Class Method Details

.all(params = {}, headers = {}) ⇒ Object



27
28
29
30
# File 'lib/paid/customer.rb', line 27

def self.all(params={}, headers={})
  method = APIMethod.new(:get, "/customers", params, headers, self)
  APIList.new(self, method.execute, method)
end

.by_external_id(external_id, params = {}, headers = {}) ⇒ Object



40
41
42
43
44
45
46
# File 'lib/paid/customer.rb', line 40

def self.by_external_id(external_id, params={}, headers={})
  params = ParamsBuilder.merge(params, {
    :external_id => external_id
  })
  method = APIMethod.new(:get, "/customers/by_external_id", params, headers, self)
  self.new(method.execute, method)
end

.create(params = {}, headers = {}) ⇒ Object



48
49
50
51
# File 'lib/paid/customer.rb', line 48

def self.create(params={}, headers={})
  method = APIMethod.new(:post, "/customers", params, headers, self)
  self.new(method.execute, method)
end

.retrieve(id, params = {}, headers = {}) ⇒ Object



32
33
34
35
36
37
38
# File 'lib/paid/customer.rb', line 32

def self.retrieve(id, params={}, headers={})
  params = ParamsBuilder.merge(params, {
    :id => id
  })
  method = APIMethod.new(:get, "/customers/:id", params, headers, self)
  self.new(method.execute, method)
end

Instance Method Details

#generate_invoice(params = {}, headers = {}) ⇒ Object



64
65
66
67
# File 'lib/paid/customer.rb', line 64

def generate_invoice(params={}, headers={})
  method = APIMethod.new(:post, "/customers/:id/generate_invoice", params, headers, self)
  Util.constantize(:Invoice).new(method.execute, method)
end

#generate_invoices(params = {}, headers = {}) ⇒ Object



69
70
71
72
# File 'lib/paid/customer.rb', line 69

def generate_invoices(params={}, headers={})
  method = APIMethod.new(:post, "/customers/:id/generate_invoices", params, headers, self)
  APIList.new(:Invoice, method.execute, method)
end

#invoices(params = {}, headers = {}) ⇒ Object



74
75
76
77
78
79
80
# File 'lib/paid/customer.rb', line 74

def invoices(params={}, headers={})
  params = ParamsBuilder.merge(params, {
    :customer => self.id,
  })
  method = APIMethod.new(:get, "/invoices", params, headers, self)
  APIList.new(:Invoice, method.execute, method)
end

#refresh(params = {}, headers = {}) ⇒ Object



53
54
55
56
# File 'lib/paid/customer.rb', line 53

def refresh(params={}, headers={})
  method = APIMethod.new(:get, "/customers/:id", params, headers, self)
  self.refresh_from(method.execute, method)
end

#save(params = {}, headers = {}) ⇒ Object



58
59
60
61
62
# File 'lib/paid/customer.rb', line 58

def save(params={}, headers={})
  params = ParamsBuilder.merge(params, changed_api_attributes)
  method = APIMethod.new(:put, "/customers/:id", params, headers, self)
  self.refresh_from(method.execute, method)
end

#transactions(params = {}, headers = {}) ⇒ Object



82
83
84
85
86
87
88
# File 'lib/paid/customer.rb', line 82

def transactions(params={}, headers={})
  params = ParamsBuilder.merge(params, {
    :customer => self.id,
  })
  method = APIMethod.new(:get, "/transactions", params, headers, self)
  APIList.new(:Transaction, method.execute, method)
end