class Reggora::Product
Public Class Methods
new(client)
click to toggle source
# File lib/reggora/Entity/Lender/product.rb, line 3 def initialize(client) @model = 'product' @client = client end
Public Instance Methods
all(params = {})
click to toggle source
retrieves all products.
# File lib/reggora/Entity/Lender/product.rb, line 8 def all(params = {}) @client.get("/#{@model}s", params) end
create(product_params)
click to toggle source
creates a product and returns the ID of the created product.
# File lib/reggora/Entity/Lender/product.rb, line 18 def create(product_params) @client.post("/#{@model}", product_params) end
delete(id)
click to toggle source
deletes a specific product. If an order or a loan is associated with this product the reference will not be broken.
# File lib/reggora/Entity/Lender/product.rb, line 27 def delete(id) @client.delete("/#{@model}/#{id}") end
edit(id, product_params)
click to toggle source
edits a product and returns the ID of the edited product.
# File lib/reggora/Entity/Lender/product.rb, line 23 def edit(id, product_params) @client.put("/#{@model}/#{id}", product_params) end
find(id)
click to toggle source
retrieves a specific product by id.
# File lib/reggora/Entity/Lender/product.rb, line 13 def find(id) @client.get("/#{@model}/#{id}") end
sample_data()
click to toggle source
# File lib/reggora/Entity/Lender/product.rb, line 31 def sample_data s = (0...50).map { ('a'..'z').to_a[rand(26)] }.join { 'product_name': "Product_#{s[1...5]}", 'amount': '100.00', 'inspection_type': 'interior', 'requested_forms': '1004MC, BPO' } end