class TorgApi::Api::Offer

Оферта участника

Attributes

bidder_id[RW]

@return [Integer] id участника

id[RW]

@return [Integer] id созданного объекта

lot_id[RW]

@return [Integer] id лота

num[RW]

@return [String] номер оферты

offer_specifications[RW]

@return [Array] Спецификация оферты

status_id[RW]

@return [Integer] id статуса

type_id[RW]

@return [Integer] id типа оферты

version[RW]

@return [Integer] версия

Public Class Methods

create(lot_id, bidder_id, hash, torg_spec_id, tender_id) click to toggle source
# 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) click to toggle source
# 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