Class: Billingrails::Resources::Products
- Inherits:
-
Object
- Object
- Billingrails::Resources::Products
- Defined in:
- lib/billingrails/resources/products.rb
Overview
Products resource
Instance Method Summary collapse
-
#archive(id) ⇒ Hash
Archive a product.
-
#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.
-
#unarchive(id) ⇒ Hash
Unarchive 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
#archive(id) ⇒ Hash
Archive a product
Archives a product.
66 67 68 69 |
# File 'lib/billingrails/resources/products.rb', line 66 def archive(id) path = "/products/#{id}/archive" @client.request(:post, path) end |
#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 = "/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 = "/products" @client.request(:get, path, params: params) end |
#retrieve(id, params: nil) ⇒ Hash
Retrieve a product
Retrieves product by ID.
43 44 45 46 |
# File 'lib/billingrails/resources/products.rb', line 43 def retrieve(id, params: nil) path = "/products/#{id}" @client.request(:get, path, params: params) end |
#unarchive(id) ⇒ Hash
Unarchive a product
Restores an archived product.
77 78 79 80 |
# File 'lib/billingrails/resources/products.rb', line 77 def unarchive(id) path = "/products/#{id}/unarchive" @client.request(:post, path) 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 = "/products/#{id}" @client.request(:put, path, body: data) end |