Module: Teamsupport::REST::Products
Instance Method Summary collapse
-
#create_product(options = {}) ⇒ Teamsupport::Product
Create a product.
-
#delete_product(id, options = {}) ⇒ Object
Deletes the product.
-
#product(id, options = {}) ⇒ Teamsupport::Product
Returns a product.
-
#products(options = {}) ⇒ Array<Teamsupport::Product>
Returns all available products for the TeamSupport organization.
-
#update_product(id, options = {}) ⇒ Teamsupport::Product
Updates the product.
Methods included from Utils
Instance Method Details
#create_product(options = {}) ⇒ Teamsupport::Product
Create a product
69 70 71 |
# File 'lib/teamsupport/rest/products.rb', line 69 def create_product( = {}) perform_post_with_object_from_collection('/api/json/products.json', , Teamsupport::Product, :Product) end |
#delete_product(id, options = {}) ⇒ Object
Deletes the product
108 109 110 |
# File 'lib/teamsupport/rest/products.rb', line 108 def delete_product(id, = {}) perform_delete("/api/json/products/#{id}.json", ) end |
#product(id, options = {}) ⇒ Teamsupport::Product
Returns a product
50 51 52 |
# File 'lib/teamsupport/rest/products.rb', line 50 def product(id, = {}) perform_get_with_object_from_collection("/api/json/products/#{id}.json", , Teamsupport::Product, :Product) end |
#products(options = {}) ⇒ Array<Teamsupport::Product>
Returns all available products for the TeamSupport organization
30 31 32 |
# File 'lib/teamsupport/rest/products.rb', line 30 def products( = {}) perform_get_with_objects_from_collection('/api/json/products.json', , Teamsupport::Product, :Products) end |
#update_product(id, options = {}) ⇒ Teamsupport::Product
Updates the product
89 90 91 92 |
# File 'lib/teamsupport/rest/products.rb', line 89 def update_product(id, = {}) product_hash = product(id).to_h perform_put_with_object_from_collection("/api/json/products/#{id}.json", product_hash.merge(), Teamsupport::Product, :Product) end |