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 участника.
16 17 18 |
# File 'lib/torg_api/api/offer.rb', line 16 def bidder_id @bidder_id end |
#id ⇒ Integer
Returns id созданного объекта.
12 13 14 |
# File 'lib/torg_api/api/offer.rb', line 12 def id @id end |
#lot_id ⇒ Integer
Returns id лота.
14 15 16 |
# File 'lib/torg_api/api/offer.rb', line 14 def lot_id @lot_id end |
#num ⇒ String
Returns номер оферты.
18 19 20 |
# File 'lib/torg_api/api/offer.rb', line 18 def num @num end |
#offer_specifications ⇒ Array
Returns Спецификация оферты.
26 27 28 |
# File 'lib/torg_api/api/offer.rb', line 26 def offer_specifications @offer_specifications end |
#status_id ⇒ Integer
Returns id статуса.
24 25 26 |
# File 'lib/torg_api/api/offer.rb', line 24 def status_id @status_id end |
#type_id ⇒ Integer
Returns id типа оферты.
22 23 24 |
# File 'lib/torg_api/api/offer.rb', line 22 def type_id @type_id end |
#version ⇒ Integer
Returns версия.
20 21 22 |
# File 'lib/torg_api/api/offer.rb', line 20 def version @version end |
Class Method Details
.create(lot_id, bidder_id, hash, torg_spec_id, tender_id) ⇒ Object
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 56 |
# File 'lib/torg_api/api/offer.rb', line 29 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
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/torg_api/api/offer.rb', line 58 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[:version] == 0 && value[:offer_specifications][0][:specification_id] == spec_id } offer end |