Class: BlingApi::Product
- Inherits:
-
Object
- Object
- BlingApi::Product
- Defined in:
- lib/bling_api/product.rb
Constant Summary collapse
- ACCESS_TOKEN =
"0039bb7d2d3e3c6777983361204dc168ecbf1ef8"
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#nome ⇒ Object
readonly
Returns the value of attribute nome.
-
#sku ⇒ Object
readonly
Returns the value of attribute sku.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(id:, nome:, sku:) ⇒ Product
constructor
A new instance of Product.
Constructor Details
#initialize(id:, nome:, sku:) ⇒ Product
Returns a new instance of Product.
13 14 15 16 17 |
# File 'lib/bling_api/product.rb', line 13 def initialize(id:, nome:, sku:) @id = id @nome = nome @sku = sku end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
12 13 14 |
# File 'lib/bling_api/product.rb', line 12 def id @id end |
#nome ⇒ Object (readonly)
Returns the value of attribute nome.
12 13 14 |
# File 'lib/bling_api/product.rb', line 12 def nome @nome end |
#sku ⇒ Object (readonly)
Returns the value of attribute sku.
12 13 14 |
# File 'lib/bling_api/product.rb', line 12 def sku @sku end |
Class Method Details
.find_by_sku(sku) ⇒ Object
5 6 7 8 9 10 |
# File 'lib/bling_api/product.rb', line 5 def self.find_by_sku sku response_json = Client.new(ACCESS_TOKEN).find_product_by_sku(sku) if response_json new(**build_hash(response_json)) end end |