Class: Paddle::Address
- Inherits:
-
Object
- Object
- OpenStruct
- Object
- Paddle::Address
show all
- Defined in:
- lib/paddle/models/address.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(customer:, country_code:, postal_code:, **params) ⇒ Object
9
10
11
12
13
|
# File 'lib/paddle/models/address.rb', line 9
def create(customer:, country_code:, postal_code:, **params)
attrs = { country_code: country_code, postal_code: postal_code }
response = Client.post_request("customers/#{customer}/addresses", body: attrs.merge(params))
Address.new(response.body["data"])
end
|
.list(customer:, **params) ⇒ Object
.retrieve(customer:, id:) ⇒ Object
15
16
17
18
|
# File 'lib/paddle/models/address.rb', line 15
def retrieve(customer:, id:)
response = Client.get_request("customers/#{customer}/addresses/#{id}")
Address.new(response.body["data"])
end
|
.update(customer:, id:, **params) ⇒ Object
20
21
22
23
|
# File 'lib/paddle/models/address.rb', line 20
def update(customer:, id:, **params)
response = Client.patch_request("customers/#{customer}/addresses/#{id}", body: params)
Address.new(response.body["data"])
end
|