Class: Paddle::Customer
- Inherits:
-
Object
- Object
- OpenStruct
- Object
- Paddle::Customer
show all
- Defined in:
- lib/paddle/models/customer.rb
Class Method Summary
collapse
Methods inherited from Object
#initialize, #to_ostruct, #update
Constructor Details
This class inherits a constructor from Paddle::Object
Class Method Details
.create(email:, **params) ⇒ Object
9
10
11
12
13
|
# File 'lib/paddle/models/customer.rb', line 9
def create(email:, **params)
attrs = { email: email.gsub(/\s+/, "") }
response = Client.post_request("customers", body: attrs.merge(params))
Customer.new(response.body["data"])
end
|
.credit(id:) ⇒ Object
25
26
27
28
|
# File 'lib/paddle/models/customer.rb', line 25
def credit(id:)
response = Client.get_request("customers/#{id}/credit-balances")
CreditBalance.new(response.body["data"][0])
end
|
.retrieve(id:) ⇒ Object
15
16
17
18
|
# File 'lib/paddle/models/customer.rb', line 15
def retrieve(id:)
response = Client.get_request("customers/#{id}")
Customer.new(response.body["data"])
end
|
.update(id:, **params) ⇒ Object
20
21
22
23
|
# File 'lib/paddle/models/customer.rb', line 20
def update(id:, **params)
response = Client.patch_request("customers/#{id}", body: params)
Customer.new(response.body["data"])
end
|