Class: Flexibee::ProductList
- Inherits:
-
Object
- Object
- Flexibee::ProductList
- Defined in:
- lib/flexibee/product_list.rb
Instance Method Summary collapse
- #all(params = {}) ⇒ Object
- #find(filter = nil, params = {}) ⇒ Object
- #find_by_ean(ean) ⇒ Object
- #find_by_id(id) ⇒ Object
- #find_by_name(name) ⇒ Object
-
#initialize(client) ⇒ ProductList
constructor
By default called with { detail: ‘full’ }, normal response does not have any usefull information in it.
Constructor Details
#initialize(client) ⇒ ProductList
By default called with { detail: ‘full’ }, normal response does not have any usefull information in it
6 7 8 |
# File 'lib/flexibee/product_list.rb', line 6 def initialize(client) @client = client end |
Instance Method Details
#all(params = {}) ⇒ Object
10 11 12 |
# File 'lib/flexibee/product_list.rb', line 10 def all(params={}) create_products(find(nil, params)) end |
#find(filter = nil, params = {}) ⇒ Object
14 15 16 |
# File 'lib/flexibee/product_list.rb', line 14 def find(filter=nil, params={}) @client.get("/cenik", params.merge({ detail: 'full' }), filter)['winstrom']['cenik'] end |
#find_by_ean(ean) ⇒ Object
26 27 28 |
# File 'lib/flexibee/product_list.rb', line 26 def find_by_ean(ean) create_products(find("eanKod='#{ean}'")).first end |
#find_by_id(id) ⇒ Object
18 19 20 |
# File 'lib/flexibee/product_list.rb', line 18 def find_by_id(id) create_products(find("id='#{id}'")).first end |
#find_by_name(name) ⇒ Object
22 23 24 |
# File 'lib/flexibee/product_list.rb', line 22 def find_by_name(name) create_products(find("nazev='#{name}'")).first end |