Class: Brightpearl::Product
- Defined in:
- lib/brightpearl/resources/product.rb
Instance Attribute Summary collapse
-
#barcode ⇒ Object
Returns the value of attribute barcode.
-
#brand_id ⇒ Object
Returns the value of attribute brand_id.
-
#bright_pearl_category_code ⇒ Object
Returns the value of attribute bright_pearl_category_code.
-
#created_on ⇒ Object
Returns the value of attribute created_on.
-
#ean ⇒ Object
Returns the value of attribute ean.
-
#id ⇒ Object
Returns the value of attribute id.
-
#isbn ⇒ Object
Returns the value of attribute isbn.
-
#mpn ⇒ Object
Returns the value of attribute mpn.
-
#primary_supplier_id ⇒ Object
Returns the value of attribute primary_supplier_id.
-
#product_group_id ⇒ Object
Returns the value of attribute product_group_id.
-
#product_name ⇒ Object
Returns the value of attribute product_name.
-
#product_status ⇒ Object
Returns the value of attribute product_status.
-
#product_type_id ⇒ Object
Returns the value of attribute product_type_id.
-
#sales_channel_name ⇒ Object
Returns the value of attribute sales_channel_name.
-
#sku ⇒ Object
Returns the value of attribute sku.
-
#stock_tracked ⇒ Object
Returns the value of attribute stock_tracked.
-
#upc ⇒ Object
Returns the value of attribute upc.
-
#updated_on ⇒ Object
Returns the value of attribute updated_on.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(ara) ⇒ Product
constructor
DSL ARA => API Record Array.
Methods included from APIOperations::Get
Methods included from APIOperations::Post
Methods included from APIOperations::Put
Methods included from APIOperations::Options
Methods inherited from Resource
Constructor Details
#initialize(ara) ⇒ Product
DSL ARA => API Record Array
35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/brightpearl/resources/product.rb', line 35 def initialize(ara) @id = ara[0]; @product_name = ara[1]; @sku = ara[2]; @barcode = ara[3]; @ean = ara[4]; @upc = ara[5]; @isbn = ara[6]; @mpn = ara[7]; @stock_tracked = ara[8]; @sales_channel_name = ara[9]; @created_on = ara[10]; @updated_on = ara[11]; @bright_pearl_category_code = ara[12]; @product_group_id = ara[13]; @brand_id = ara[14]; @product_type_id = ara[15]; @product_status = ara[16]; @primary_supplier_id = ara[17]; end |
Instance Attribute Details
#barcode ⇒ Object
Returns the value of attribute barcode.
8 9 10 |
# File 'lib/brightpearl/resources/product.rb', line 8 def @barcode end |
#brand_id ⇒ Object
Returns the value of attribute brand_id.
8 9 10 |
# File 'lib/brightpearl/resources/product.rb', line 8 def brand_id @brand_id end |
#bright_pearl_category_code ⇒ Object
Returns the value of attribute bright_pearl_category_code.
8 9 10 |
# File 'lib/brightpearl/resources/product.rb', line 8 def bright_pearl_category_code @bright_pearl_category_code end |
#created_on ⇒ Object
Returns the value of attribute created_on.
8 9 10 |
# File 'lib/brightpearl/resources/product.rb', line 8 def created_on @created_on end |
#ean ⇒ Object
Returns the value of attribute ean.
8 9 10 |
# File 'lib/brightpearl/resources/product.rb', line 8 def ean @ean end |
#id ⇒ Object
Returns the value of attribute id.
8 9 10 |
# File 'lib/brightpearl/resources/product.rb', line 8 def id @id end |
#isbn ⇒ Object
Returns the value of attribute isbn.
8 9 10 |
# File 'lib/brightpearl/resources/product.rb', line 8 def isbn @isbn end |
#mpn ⇒ Object
Returns the value of attribute mpn.
8 9 10 |
# File 'lib/brightpearl/resources/product.rb', line 8 def mpn @mpn end |
#primary_supplier_id ⇒ Object
Returns the value of attribute primary_supplier_id.
8 9 10 |
# File 'lib/brightpearl/resources/product.rb', line 8 def primary_supplier_id @primary_supplier_id end |
#product_group_id ⇒ Object
Returns the value of attribute product_group_id.
8 9 10 |
# File 'lib/brightpearl/resources/product.rb', line 8 def product_group_id @product_group_id end |
#product_name ⇒ Object
Returns the value of attribute product_name.
8 9 10 |
# File 'lib/brightpearl/resources/product.rb', line 8 def product_name @product_name end |
#product_status ⇒ Object
Returns the value of attribute product_status.
8 9 10 |
# File 'lib/brightpearl/resources/product.rb', line 8 def product_status @product_status end |
#product_type_id ⇒ Object
Returns the value of attribute product_type_id.
8 9 10 |
# File 'lib/brightpearl/resources/product.rb', line 8 def product_type_id @product_type_id end |
#sales_channel_name ⇒ Object
Returns the value of attribute sales_channel_name.
8 9 10 |
# File 'lib/brightpearl/resources/product.rb', line 8 def sales_channel_name @sales_channel_name end |
#sku ⇒ Object
Returns the value of attribute sku.
8 9 10 |
# File 'lib/brightpearl/resources/product.rb', line 8 def sku @sku end |
#stock_tracked ⇒ Object
Returns the value of attribute stock_tracked.
8 9 10 |
# File 'lib/brightpearl/resources/product.rb', line 8 def stock_tracked @stock_tracked end |
#upc ⇒ Object
Returns the value of attribute upc.
8 9 10 |
# File 'lib/brightpearl/resources/product.rb', line 8 def upc @upc end |
#updated_on ⇒ Object
Returns the value of attribute updated_on.
8 9 10 |
# File 'lib/brightpearl/resources/product.rb', line 8 def updated_on @updated_on end |
Class Method Details
.resource_path ⇒ Object
15 16 17 |
# File 'lib/brightpearl/resources/product.rb', line 15 def resource_path "product-service/product" end |
.search(query_params = {}) ⇒ Object
25 26 27 28 29 30 |
# File 'lib/brightpearl/resources/product.rb', line 25 def search(query_params = {}) response = send_request(path: "product-service/product-search?#{to_query(query_params)}", method: :get) return response.merge({ # modify final payload to set search results as objects records: response[:payload]["response"]["results"].map { |item| Product.new(item) }, }) end |