Class: Binda::Shopify::Item
- Inherits:
-
Object
- Object
- Binda::Shopify::Item
- Defined in:
- lib/binda/shopify/item.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#item ⇒ Object
Returns the value of attribute item.
-
#shop ⇒ Object
Returns the value of attribute shop.
Instance Method Summary collapse
- #edit_url ⇒ Object
- #id ⇒ Object
-
#initialize(item, shop) ⇒ Item
constructor
A new instance of Item.
- #method_missing(name, params = nil, &block) ⇒ Object
Constructor Details
#initialize(item, shop) ⇒ Item
Returns a new instance of Item.
6 7 8 9 |
# File 'lib/binda/shopify/item.rb', line 6 def initialize item, shop @item = item @shop = shop end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, params = nil, &block) ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/binda/shopify/item.rb', line 19 def method_missing name, params = nil, &block if item.respond_to? name item.send(name, params) else super end end |
Instance Attribute Details
#item ⇒ Object
Returns the value of attribute item.
4 5 6 |
# File 'lib/binda/shopify/item.rb', line 4 def item @item end |
#shop ⇒ Object
Returns the value of attribute shop.
4 5 6 |
# File 'lib/binda/shopify/item.rb', line 4 def shop @shop end |
Instance Method Details
#edit_url ⇒ Object
15 16 17 |
# File 'lib/binda/shopify/item.rb', line 15 def edit_url "https://#{shop.domain}/admin/#{item.model_name.element.pluralize}/#{item.id}" end |
#id ⇒ Object
11 12 13 |
# File 'lib/binda/shopify/item.rb', line 11 def id item.id end |