Class: QNE::Stocks
Constant Summary
Constants included from QueryBuilder
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
Attributes inherited from Base
Instance Method Summary collapse
- #all(params = {}) ⇒ Object
- #find(id) ⇒ Object
- #find_stocks_available_by_stock_code(stock_code) ⇒ Object
- #find_uoms_by_id(id) ⇒ Object
Methods included from QueryBuilder
#eq_query, #multi_query, #uri_query, #where
Methods inherited from Base
#initialize, #parse_to_json, #success?
Constructor Details
This class inherits a constructor from QNE::Base
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
12 13 14 |
# File 'lib/stocks.rb', line 12 def id @id end |
Instance Method Details
#all(params = {}) ⇒ Object
30 31 32 33 34 35 36 |
# File 'lib/stocks.rb', line 30 def all(params = {}) @response = QNE::Stock::All.new( conn, params: uri_query(params) ).call parse_to_json(@response.body) end |
#find(id) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/stocks.rb', line 14 def find(id) finder = QNE::Stocks::Find.new(conn, id: id).call return unless finder.success? define_singleton_method 'uoms' do find_uoms_by_id(id) end define_singleton_method 'show' do @response = parse_to_json(finder.body) end self end |