Sha256: 881c9c213f27f6757fcfdb36bdcffe5c036ab008f3ea84329b2c96e5b87e0e4d

Contents?: true

Size: 1.8 KB

Versions: 3

Compression:

Stored size: 1.8 KB

Contents

module FBO::Parser::ModificationHandler
  TAGS = %w( MOD DATE YEAR CBAC PASSWORD ZIP CLASSCOD NAICS OFFADD AGENCY) +
    %w( OFFICE LOCATION SUBJECT SOLNBR NTYPE RESPDATE ARCHDATE CONTACT DESC ) +
    %w( LINK URL EMAIL ADDRESS SETASIDE POPADDRESS POPZIP POPCOUNTRY \/MOD )

  ANY_MOD_TAG          = TAGS.join("|")
  MODIFICATION_PATTERN = /^<MOD>/


  def is_modification?(text)
    text =~ MODIFICATION_PATTERN
  end

  def parse(text)
    params = {
      date: date(text),
      year: year(text),
      zip:  zip(text),
      class_code: classification_code(text),
      naics_code: naics_code(text),
      agency: agency(text),
      office: office(text),
      location: location(text),
      office_address: office_address(text),
      subject: subject(text),
      solicitation_number: solicitation_number(text),
      notice_type: notice_type(text),
      response_date: response_date(text),
      archive_date: archive_date(text),
      contact_info: contact(text),
      description: description(text),
      link_url: link_url(text),
      link_description: link_description(text),
      email_address: email_address(text),
      email_description: email_description(text),
      setaside: set_aside(text),
      pop_address: pop_address(text),
      pop_zip: pop_zip_code(text),
      pop_country: pop_country(text)
    }
    FBO::Notices::Modification.new(params)
  end


  protected

  # Returns a concatenated list of all tags for the notice
  #
  # @return [String]
  def any_notice_tag
    ANY_MOD_TAG
  end

  # Get the notice type that this modification is affecting.
  #
  # @param text [String] the full text of the notice
  # @return [Date] the notice type
  def notice_type(text)
    simple_tag_contents(text, "NTYPE")
  end


  extend FBO::Parser::NoticeHandler
  extend FBO::Parser::ParserHelper
  extend self
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
fbo-0.0.3 lib/fbo/parser/modification_handler.rb
fbo-0.0.2 lib/fbo/parser/modification_handler.rb
fbo-0.0.1 lib/fbo/parser/modification_handler.rb