Class: MaliPoPay::Resources::Products
- Inherits:
-
Object
- Object
- MaliPoPay::Resources::Products
- Defined in:
- lib/malipopay/resources/products.rb
Instance Method Summary collapse
-
#create(params) ⇒ Hash
Create a new product.
-
#get(id) ⇒ Hash
Get a product by ID.
-
#get_by_number(number) ⇒ Hash
Get a product by product number.
-
#initialize(http_client) ⇒ Products
constructor
A new instance of Products.
-
#list(params = {}) ⇒ Hash
List all products.
-
#update(id, params) ⇒ Hash
Update an existing product.
Constructor Details
#initialize(http_client) ⇒ Products
Returns a new instance of Products.
6 7 8 |
# File 'lib/malipopay/resources/products.rb', line 6 def initialize(http_client) @http = http_client end |
Instance Method Details
#create(params) ⇒ Hash
Create a new product
13 14 15 |
# File 'lib/malipopay/resources/products.rb', line 13 def create(params) @http.post("/api/v1/product", body: params) end |
#get(id) ⇒ Hash
Get a product by ID
27 28 29 |
# File 'lib/malipopay/resources/products.rb', line 27 def get(id) @http.get("/api/v1/product/#{id}") end |
#get_by_number(number) ⇒ Hash
Get a product by product number
34 35 36 |
# File 'lib/malipopay/resources/products.rb', line 34 def get_by_number(number) @http.get("/api/v1/product", params: { productNumber: number }) end |
#list(params = {}) ⇒ Hash
List all products
20 21 22 |
# File 'lib/malipopay/resources/products.rb', line 20 def list(params = {}) @http.get("/api/v1/product", params: params) end |
#update(id, params) ⇒ Hash
Update an existing product
42 43 44 |
# File 'lib/malipopay/resources/products.rb', line 42 def update(id, params) @http.put("/api/v1/product/#{id}", body: params) end |