Class: TorgApi::Api::Lot
Overview
Лот
Constant Summary
Constants inherited from Base
Instance Attribute Summary collapse
-
#id ⇒ Integer
Id.
-
#num ⇒ Integer
Номер.
-
#specifications ⇒ Array
Спецификации.
Class Method Summary collapse
-
.find(tender_id, num) ⇒ Tender
Поиск закупки по id.
Methods inherited from Base
attr_accessor, attributes, #initialize, #to_h, torg_resource
Constructor Details
This class inherits a constructor from TorgApi::Base
Instance Attribute Details
#id ⇒ Integer
Returns id.
6 7 8 |
# File 'lib/torg_api/api/lot.rb', line 6 def id @id end |
#num ⇒ Integer
Returns Номер.
8 9 10 |
# File 'lib/torg_api/api/lot.rb', line 8 def num @num end |
#specifications ⇒ Array
Returns Спецификации.
10 11 12 |
# File 'lib/torg_api/api/lot.rb', line 10 def specifications @specifications end |
Class Method Details
.find(tender_id, num) ⇒ Tender
Поиск закупки по id
15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/torg_api/api/lot.rb', line 15 def find(tender_id, num) responce = JSON.parse( torg_resource["tenders/#{tender_id}"].get( accept: :json, content_type: :json, format: :json ), symbolize_names: true ) lot = responce[:lots].select { |value| value[:num] == num }.first new(lot) if lot end |