Class: Paddle::Business

Inherits:
Object
  • Object
show all
Defined in:
lib/paddle/models/business.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:, name:, **params) ⇒ Object



9
10
11
12
13
# File 'lib/paddle/models/business.rb', line 9

def create(customer:, name:, **params)
  attrs = { name: name }
  response = Client.post_request("customers/#{customer}/businesses", body: attrs.merge(params))
  Business.new(response.body["data"])
end

.list(customer:, **params) ⇒ Object



4
5
6
7
# File 'lib/paddle/models/business.rb', line 4

def list(customer:, **params)
  response = Client.get_request("customers/#{customer}/businesses", params: params)
  Collection.from_response(response, type: Business)
end

.retrieve(customer:, id:) ⇒ Object



15
16
17
18
# File 'lib/paddle/models/business.rb', line 15

def retrieve(customer:, id:)
  response = Client.get_request("customers/#{customer}/businesses/#{id}")
  Business.new(response.body["data"])
end

.update(customer:, id:, **params) ⇒ Object



20
21
22
23
# File 'lib/paddle/models/business.rb', line 20

def update(customer:, id:, **params)
  response = Client.patch_request("customers/#{customer}/businesses/#{id}", body: params)
  Business.new(response.body["data"])
end