Class: TorgApi::Api::Offer
Overview
Оферта участника
Constant Summary
Constants inherited from Base
Instance Attribute Summary collapse
-
#bidder_id ⇒ Integer
Id участника.
-
#id ⇒ Integer
Id созданного объекта.
-
#lot_id ⇒ Integer
Id лота.
-
#num ⇒ String
номер оферты.
-
#offer_specifications ⇒ Array
Спецификация оферты.
-
#status_id ⇒ Integer
Id статуса.
-
#type_id ⇒ Integer
Id типа оферты.
-
#version ⇒ Integer
версия.
Class Method Summary collapse
- .create(lot_id, bidder_id, hash, torg_spec_id, tender_id) ⇒ Object
- .find(tender_id, bidder_id, lot_id, offer_num, spec_id) ⇒ Object
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
#bidder_id ⇒ Integer
Returns id участника.
15 16 17 |
# File 'lib/torg_api/api/offer.rb', line 15 def bidder_id @bidder_id end |
#id ⇒ Integer
Returns id созданного объекта.
11 12 13 |
# File 'lib/torg_api/api/offer.rb', line 11 def id @id end |
#lot_id ⇒ Integer
Returns id лота.
13 14 15 |
# File 'lib/torg_api/api/offer.rb', line 13 def lot_id @lot_id end |
#num ⇒ String
Returns номер оферты.
17 18 19 |
# File 'lib/torg_api/api/offer.rb', line 17 def num @num end |
#offer_specifications ⇒ Array
Returns Спецификация оферты.
25 26 27 |
# File 'lib/torg_api/api/offer.rb', line 25 def offer_specifications @offer_specifications end |
#status_id ⇒ Integer
Returns id статуса.
23 24 25 |
# File 'lib/torg_api/api/offer.rb', line 23 def status_id @status_id end |
#type_id ⇒ Integer
Returns id типа оферты.
21 22 23 |
# File 'lib/torg_api/api/offer.rb', line 21 def type_id @type_id end |
#version ⇒ Integer
Returns версия.
19 20 21 |
# File 'lib/torg_api/api/offer.rb', line 19 def version @version end |
Class Method Details
.create(lot_id, bidder_id, hash, torg_spec_id, tender_id) ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/torg_api/api/offer.rb', line 28 def create(lot_id, bidder_id, hash, torg_spec_id, tender_id) responce_o = JSON.parse( torg_resource["tenders/#{tender_id}/bidders/#{bidder_id}/offers"].post( offer: { lot_id: lot_id, bidder_id: bidder_id, num: hash[:num], version: 0, type_id: CoverLabels::REQUEST, status_id: OfferStatuses::NEW, offer_specifications_attributes: { '0' => { specification_id: torg_spec_id, cost: hash[:cost], cost_nds: hash[:cost_nds], final_cost: hash[:cost], final_cost_nds: hash[:cost_nds] } } }, accept: :json, content_type: :json, format: :json ), symbolize_names: true ) new(responce_o) end |
.find(tender_id, bidder_id, lot_id, offer_num, spec_id) ⇒ Object
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/torg_api/api/offer.rb', line 57 def find(tender_id, bidder_id, lot_id, offer_num, spec_id) responce = JSON.parse( torg_resource["tenders/#{tender_id}/bidders/#{bidder_id}/offers"].get( accept: :json, content_type: :json, format: :json ), symbolize_names: true ) offer = responce.select { |value| value[:lot_id] == lot_id && value[:num] == offer_num && value[:offer_specifications][0][:offer_specification][:specification_id] == spec_id } offer end |