Class: Billingrails::Resources::Products
- Inherits:
-
Object
- Object
- Billingrails::Resources::Products
- Defined in:
- lib/billingrails/resources/products.rb
Overview
Products resource
Instance Method Summary collapse
-
#create(data) ⇒ Hash
Create a product.
-
#initialize(client) ⇒ Products
constructor
A new instance of Products.
-
#list(params: nil) ⇒ Hash
List products.
-
#retrieve(id, params: nil) ⇒ Hash
Retrieve a product.
-
#update(id, data) ⇒ Hash
Update a product.
Constructor Details
#initialize(client) ⇒ Products
Returns a new instance of Products.
10 11 12 |
# File 'lib/billingrails/resources/products.rb', line 10 def initialize(client) @client = client end |
Instance Method Details
#create(data) ⇒ Hash
Create a product
Creates a product.
31 32 33 34 |
# File 'lib/billingrails/resources/products.rb', line 31 def create(data) path = "/seller/products" @client.request(:post, path, body: data) end |
#list(params: nil) ⇒ Hash
List products
Retrieves a list of products.
20 21 22 23 |
# File 'lib/billingrails/resources/products.rb', line 20 def list(params: nil) path = "/seller/products" @client.request(:get, path, params: params) end |
#retrieve(id, params: nil) ⇒ Hash
Retrieve a product
Retrieves a product by ID.
43 44 45 46 |
# File 'lib/billingrails/resources/products.rb', line 43 def retrieve(id, params: nil) path = "/seller/products/#{id}" @client.request(:get, path, params: params) end |
#update(id, data) ⇒ Hash
Update a product
Updates a product.
55 56 57 58 |
# File 'lib/billingrails/resources/products.rb', line 55 def update(id, data) path = "/seller/products/#{id}" @client.request(:put, path, body: data) end |