Module: Vindi::Rest::ProductItem

Included in:
Vindi::Rest
Defined in:
lib/vindi/rest/product_item.rb

Overview

Methods for the product_items API

Instance Method Summary collapse

Instance Method Details

#create_product_item(options = {}) ⇒ Hash

Create a product_item for a merchant vindi

Examples:

Create a product_item for a merchant vindi

client.create_product_item(product_id: 26, quantity: 1)

Parameters:

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • :options (Hash)

    product_item attributes

Returns:

  • (Hash)

    The product_item created

See Also:



26
27
28
# File 'lib/vindi/rest/product_item.rb', line 26

def create_product_item(options = {})
  post('product_items', options)[:product_item]
end

#delete_product_item(product_item_id, options = {}) ⇒ Object

Delete a product_item from merchant vindi

Examples:

Delete product_item #2

client.delete_product_item(2)

Parameters:

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • :options (Hash)

    product_item attributes

See Also:



49
50
51
# File 'lib/vindi/rest/product_item.rb', line 49

def delete_product_item(product_item_id, options = {})
  delete("product_items/#{product_item_id}", options)[:product_item]
end

#product_item(product_item_id, options = {}) ⇒ Hash

Get a single product_item from a merchant

Examples:

Get product_item #2 from vindi

client.product_item(2)

Parameters:

  • product_item_id (Integer)

    ID of the product_item

Returns:

  • (Hash)

    The product_item you requested, if it exists

See Also:



15
16
17
# File 'lib/vindi/rest/product_item.rb', line 15

def product_item(product_item_id, options = {})
  get("product_items/#{product_item_id}", options)[:product_item]
end

#update_product_item(product_item_id, options = {}) ⇒ Object

Edit a product_item

Examples:

Update product_item #2

client.update_product_item(2, quantity: 2)

Parameters:

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • :options (Hash)

    product_item attributes

See Also:



37
38
39
# File 'lib/vindi/rest/product_item.rb', line 37

def update_product_item(product_item_id, options = {})
  put("product_items/#{product_item_id}", options)[:product_item]
end