class TorgiGov::LoadNotification

Public Class Methods

new(args) click to toggle source
# File lib/torgi_gov/request/load_notification.rb, line 8
def initialize(args)
  @number = args[:number]
end

Public Instance Methods

call() click to toggle source
# File lib/torgi_gov/request/load_notification.rb, line 12
def call
  request = self.class.get("/opendata/notification/#{@number}")
  @body = Nokogiri.XML(request.body)
  parse
end

Private Instance Methods

bid_form() click to toggle source
# File lib/torgi_gov/request/load_notification.rb, line 58
def bid_form
  {
    id:   @body.css('notification common bidForm id').text,
    name: @body.css('notification common bidForm name').text
  }
end
bid_kind() click to toggle source
# File lib/torgi_gov/request/load_notification.rb, line 51
def bid_kind
  {
    id:    @body.css('notification common bidKind id').text,
    name:  @body.css('notification common bidKind name').text,
  }
end
common() click to toggle source
# File lib/torgi_gov/request/load_notification.rb, line 38
def common
  {
    bid_kind:        bid_kind,
    bid_form:        bid_form,
    lotNum:          @body.css('notification common lotNum').text,
    published:       @body.css('notification common published').text,
    lastChanged:     @body.css('notification common lastChanged').text,
    notificationUrl: @body.css('notification common notificationUrl').text,
    bidAuctionDate:  @body.css('notification common bidAuctionDate').text,
    summationDate:   @body.css('notification common summationDate').text,
  }
end
docs() click to toggle source
# File lib/torgi_gov/request/load_notification.rb, line 65
def docs
  @body.css('notification documents doc').collect do |doc|
    {
      docType: doc.css('docType').text,
      created: doc.css('created').text,
      docUrl:  doc.css('docUrl').text
    }
  end
end
number() click to toggle source
# File lib/torgi_gov/request/load_notification.rb, line 24
def number
  @body.css('notification bidNumber').text
end
organization() click to toggle source
# File lib/torgi_gov/request/load_notification.rb, line 28
def organization
  {
    type:     @body.css('notification bidOrganization').text,
    id:       @body.css('notification bidOrgKind').text,
    fullName: @body.css('notification fullName').text,
    headOrg:  @body.css('notification headOrg').text,
    inn:      @body.css('notification inn').text,
  }
end
parse() click to toggle source
# File lib/torgi_gov/request/load_notification.rb, line 20
def parse
  raise NotImplementedError
end