fbo 0.0.3 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (95) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +3 -5
  3. data/Gemfile +0 -2
  4. data/Rakefile +8 -1
  5. data/fbo.gemspec +14 -9
  6. data/lib/fbo.rb +7 -38
  7. data/lib/fbo/chunked_file.rb +74 -0
  8. data/lib/fbo/dump.treetop +324 -0
  9. data/lib/fbo/file.rb +17 -1
  10. data/lib/fbo/interpreter.rb +87 -0
  11. data/lib/fbo/node_extensions.rb +173 -0
  12. data/lib/fbo/parser.rb +43 -46
  13. data/lib/fbo/remote_file.rb +4 -4
  14. data/lib/fbo/version.rb +1 -1
  15. data/spec/fbo/chunked_file_spec.rb +22 -0
  16. data/spec/fbo/file_spec.rb +26 -9
  17. data/spec/fbo/interpreter_spec.rb +73 -0
  18. data/spec/fbo/parser_spec.rb +36 -38
  19. data/spec/fbo/remote_file_spec.rb +28 -24
  20. data/spec/fixtures/.keep +0 -0
  21. data/spec/fixtures/FBOFeed20130331 +52 -5529
  22. data/spec/fixtures/FBOFeed20131003 +35126 -0
  23. data/spec/spec_helper.rb +14 -16
  24. metadata +70 -108
  25. data/.rspec +0 -2
  26. data/Gemfile.lock +0 -27
  27. data/lib/fbo/notice.rb +0 -9
  28. data/lib/fbo/notices.rb +0 -6
  29. data/lib/fbo/notices/amendment.rb +0 -13
  30. data/lib/fbo/notices/archive.rb +0 -8
  31. data/lib/fbo/notices/award.rb +0 -14
  32. data/lib/fbo/notices/combined_solicitation.rb +0 -14
  33. data/lib/fbo/notices/fair_opportunity.rb +0 -15
  34. data/lib/fbo/notices/foreign_standard.rb +0 -13
  35. data/lib/fbo/notices/intent_to_bundle.rb +0 -13
  36. data/lib/fbo/notices/justification_approval.rb +0 -18
  37. data/lib/fbo/notices/modification.rb +0 -14
  38. data/lib/fbo/notices/presolicitation.rb +0 -14
  39. data/lib/fbo/notices/sale_of_surplus.rb +0 -13
  40. data/lib/fbo/notices/sources_sought.rb +0 -13
  41. data/lib/fbo/notices/special_notice.rb +0 -13
  42. data/lib/fbo/notices/unarchive.rb +0 -9
  43. data/lib/fbo/notices/unknown.rb +0 -7
  44. data/lib/fbo/parser/amendment_handler.rb +0 -58
  45. data/lib/fbo/parser/archive_handler.rb +0 -41
  46. data/lib/fbo/parser/award_handler.rb +0 -62
  47. data/lib/fbo/parser/combined_solicitation_handler.rb +0 -57
  48. data/lib/fbo/parser/fair_opportunity_handler.rb +0 -61
  49. data/lib/fbo/parser/foreign_standard_handler.rb +0 -57
  50. data/lib/fbo/parser/handler_selector.rb +0 -37
  51. data/lib/fbo/parser/intent_to_bundle_handler.rb +0 -56
  52. data/lib/fbo/parser/justification_approval_handler.rb +0 -60
  53. data/lib/fbo/parser/modification_handler.rb +0 -66
  54. data/lib/fbo/parser/notice_handler.rb +0 -27
  55. data/lib/fbo/parser/parser_helper.rb +0 -315
  56. data/lib/fbo/parser/presolicitation_handler.rb +0 -57
  57. data/lib/fbo/parser/sale_of_surplus_handler.rb +0 -57
  58. data/lib/fbo/parser/sources_sought_handler.rb +0 -57
  59. data/lib/fbo/parser/special_notice_handler.rb +0 -57
  60. data/lib/fbo/parser/unarchive_handler.rb +0 -42
  61. data/lib/fbo/parser/unknown_handler.rb +0 -20
  62. data/spec/fbo/parser/amendment_handler_spec.rb +0 -51
  63. data/spec/fbo/parser/archive_handler_spec.rb +0 -36
  64. data/spec/fbo/parser/award_handler_spec.rb +0 -56
  65. data/spec/fbo/parser/combined_solicitation_handler_spec.rb +0 -51
  66. data/spec/fbo/parser/fair_opportunity_handler_spec.rb +0 -56
  67. data/spec/fbo/parser/foreign_standard_handler_spec.rb +0 -51
  68. data/spec/fbo/parser/handler_selector_spec.rb +0 -40
  69. data/spec/fbo/parser/intent_to_bundle_handler_spec.rb +0 -52
  70. data/spec/fbo/parser/justification_approval_handler_spec.rb +0 -53
  71. data/spec/fbo/parser/modification_handler_spec.rb +0 -52
  72. data/spec/fbo/parser/presolicitation_handler_spec.rb +0 -51
  73. data/spec/fbo/parser/sale_of_surplus_handler_spec.rb +0 -53
  74. data/spec/fbo/parser/sources_sought_handler_spec.rb +0 -51
  75. data/spec/fbo/parser/special_notice_handler_spec.rb +0 -53
  76. data/spec/fbo/parser/unarchive_handler_spec.rb +0 -37
  77. data/spec/fbo/parser/unknown_handler_spec.rb +0 -24
  78. data/spec/fixtures/FBOFeed20130404 +0 -45653
  79. data/spec/fixtures/FBOFeed20130406 +0 -10152
  80. data/spec/fixtures/FBOFeed20130407 +0 -6610
  81. data/spec/fixtures/notices/amdcss +0 -26
  82. data/spec/fixtures/notices/archive +0 -10
  83. data/spec/fixtures/notices/award +0 -31
  84. data/spec/fixtures/notices/combine +0 -29
  85. data/spec/fixtures/notices/fairopp +0 -29
  86. data/spec/fixtures/notices/fstd +0 -24
  87. data/spec/fixtures/notices/itb +0 -19
  88. data/spec/fixtures/notices/ja +0 -30
  89. data/spec/fixtures/notices/mod +0 -28
  90. data/spec/fixtures/notices/notanotice +0 -7
  91. data/spec/fixtures/notices/presol +0 -25
  92. data/spec/fixtures/notices/snote +0 -26
  93. data/spec/fixtures/notices/srcsgt +0 -27
  94. data/spec/fixtures/notices/ssale +0 -24
  95. data/spec/fixtures/notices/unarchive +0 -10
@@ -1,57 +0,0 @@
1
- module FBO::Parser::PresolicitationHandler
2
- TAGS = %w( PRESOL DATE YEAR CBAC PASSWORD ZIP CLASSCOD NAICS OFFADD ) +
3
- %w( AGENCY OFFICE LOCATION SUBJECT SOLNBR RESPDATE ARCHDATE CONTACT DESC ) +
4
- %w( LINK URL EMAIL ADDRESS SETASIDE POPADDRESS POPZIP POPCOUNTRY \/PRESOL )
5
-
6
- ANY_PRESOL_TAG = TAGS.join("|")
7
- PRESOLICITATION_PATTERN = /^<PRESOL>/
8
-
9
-
10
- def is_presolicitation?(text)
11
- text =~ PRESOLICITATION_PATTERN
12
- end
13
-
14
- def parse(text)
15
- params = {
16
- date: date(text),
17
- year: year(text),
18
- zip: zip(text),
19
- class_code: classification_code(text),
20
- naics_code: naics_code(text),
21
- agency: agency(text),
22
- office: office(text),
23
- location: location(text),
24
- office_address: office_address(text),
25
- subject: subject(text),
26
- solicitation_number: solicitation_number(text),
27
- response_date: response_date(text),
28
- archive_date: archive_date(text),
29
- contact_info: contact(text),
30
- description: description(text),
31
- link_url: link_url(text),
32
- link_description: link_description(text),
33
- email_address: email_address(text),
34
- email_description: email_description(text),
35
- setaside: set_aside(text),
36
- pop_address: pop_address(text),
37
- pop_zip: pop_zip_code(text),
38
- pop_country: pop_country(text)
39
- }
40
- FBO::Notices::Presolicitation.new(params)
41
- end
42
-
43
-
44
- protected
45
-
46
- # Returns a concatenated list of all tags for the notice
47
- #
48
- # @return [String]
49
- def any_notice_tag
50
- ANY_PRESOL_TAG
51
- end
52
-
53
-
54
- extend FBO::Parser::NoticeHandler
55
- extend FBO::Parser::ParserHelper
56
- extend self
57
- end
@@ -1,57 +0,0 @@
1
- module FBO::Parser::SaleOfSurplusHandler
2
- TAGS = %w( SSALE DATE YEAR CBAC PASSWORD ZIP CLASSCOD NAICS OFFADD AGENCY ) +
3
- %w( OFFICE LOCATION SUBJECT SOLNBR RESPDATE ARCHDATE CONTACT DESC LINK ) +
4
- %w( URL EMAIL ADDRESS SETASIDE POPADDRESS POPZIP POPCOUNTRY \/SSALE )
5
-
6
- ANY_SSALE_TAG = TAGS.join("|")
7
- SALE_OF_SURPLUS_PATTERN = /^<SSALE>/
8
-
9
-
10
- def is_sale_of_surplus?(text)
11
- text =~ SALE_OF_SURPLUS_PATTERN
12
- end
13
-
14
- def parse(text)
15
- params = {
16
- date: date(text),
17
- year: year(text),
18
- zip: zip(text),
19
- class_code: classification_code(text),
20
- naics_code: naics_code(text),
21
- agency: agency(text),
22
- office: office(text),
23
- location: location(text),
24
- office_address: office_address(text),
25
- subject: subject(text),
26
- solicitation_number: solicitation_number(text),
27
- response_date: response_date(text),
28
- archive_date: archive_date(text),
29
- contact_info: contact(text),
30
- description: description(text),
31
- link_url: link_url(text),
32
- link_description: link_description(text),
33
- email_address: email_address(text),
34
- email_description: email_description(text),
35
- setaside: set_aside(text),
36
- pop_address: pop_address(text),
37
- pop_zip: pop_zip_code(text),
38
- pop_country: pop_country(text)
39
- }
40
- FBO::Notices::SaleOfSurplus.new(params)
41
- end
42
-
43
-
44
- protected
45
-
46
- # Returns a concatenated list of all tags for the notice
47
- #
48
- # @return [String]
49
- def any_notice_tag
50
- ANY_SSALE_TAG
51
- end
52
-
53
-
54
- extend FBO::Parser::NoticeHandler
55
- extend FBO::Parser::ParserHelper
56
- extend self
57
- end
@@ -1,57 +0,0 @@
1
- module FBO::Parser::SourcesSoughtHandler
2
- TAGS = %w( SRCSGT DATE YEAR CBAC PASSWORD ZIP CLASSCOD NAICS OFFADD ) +
3
- %w( AGENCY OFFICE LOCATION SUBJECT SOLNBR RESPDATE ARCHDATE CONTACT DESC ) +
4
- %w( LINK URL EMAIL ADDRESS SETASIDE POPADDRESS POPZIP POPCOUNTRY \/SRCSGT )
5
-
6
- ANY_SRCSGT_TAG = TAGS.join("|")
7
- SOURCES_SOUGHT_PATTERN = /^<SRCSGT>/
8
-
9
-
10
- def is_sources_sought?(text)
11
- text =~ SOURCES_SOUGHT_PATTERN
12
- end
13
-
14
- def parse(text)
15
- params = {
16
- date: date(text),
17
- year: year(text),
18
- zip: zip(text),
19
- class_code: classification_code(text),
20
- naics_code: naics_code(text),
21
- agency: agency(text),
22
- office: office(text),
23
- location: location(text),
24
- office_address: office_address(text),
25
- subject: subject(text),
26
- solicitation_number: solicitation_number(text),
27
- response_date: response_date(text),
28
- archive_date: archive_date(text),
29
- contact_info: contact(text),
30
- description: description(text),
31
- link_url: link_url(text),
32
- link_description: link_description(text),
33
- email_address: email_address(text),
34
- email_description: email_description(text),
35
- setaside: set_aside(text),
36
- pop_address: pop_address(text),
37
- pop_zip: pop_zip_code(text),
38
- pop_country: pop_country(text)
39
- }
40
- FBO::Notices::SourcesSought.new(params)
41
- end
42
-
43
-
44
- protected
45
-
46
- # Returns a concatenated list of all tags for the notice
47
- #
48
- # @return [String]
49
- def any_notice_tag
50
- ANY_SRCSGT_TAG
51
- end
52
-
53
-
54
- extend FBO::Parser::NoticeHandler
55
- extend FBO::Parser::ParserHelper
56
- extend self
57
- end
@@ -1,57 +0,0 @@
1
- module FBO::Parser::SpecialNoticeHandler
2
- TAGS = %w( SNOTE DATE YEAR CBAC PASSWORD ZIP CLASSCOD NAICS OFFADD AGENCY ) +
3
- %w( OFFICE LOCATION SUBJECT SOLNBR RESPDATE ARCHDATE CONTACT DESC LINK ) +
4
- %w( URL EMAIL ADDRESS SETASIDE POPADDRESS POPZIP POPCOUNTRY \/SNOTE )
5
-
6
- ANY_SNOTE_TAG = TAGS.join("|")
7
- SPECIAL_NOTICE_PATTERN = /^<SNOTE>/
8
-
9
-
10
- def is_special_notice?(text)
11
- text =~ SPECIAL_NOTICE_PATTERN
12
- end
13
-
14
- def parse(text)
15
- params = {
16
- date: date(text),
17
- year: year(text),
18
- zip: zip(text),
19
- class_code: classification_code(text),
20
- naics_code: naics_code(text),
21
- agency: agency(text),
22
- office: office(text),
23
- location: location(text),
24
- office_address: office_address(text),
25
- subject: subject(text),
26
- solicitation_number: solicitation_number(text),
27
- response_date: response_date(text),
28
- archive_date: archive_date(text),
29
- contact_info: contact(text),
30
- description: description(text),
31
- link_url: link_url(text),
32
- link_description: link_description(text),
33
- email_address: email_address(text),
34
- email_description: email_description(text),
35
- setaside: set_aside(text),
36
- pop_address: pop_address(text),
37
- pop_zip: pop_zip_code(text),
38
- pop_country: pop_country(text)
39
- }
40
- FBO::Notices::SpecialNotice.new(params)
41
- end
42
-
43
-
44
- protected
45
-
46
- # Returns a concatenated list of all tags for the notice
47
- #
48
- # @return [String]
49
- def any_notice_tag
50
- ANY_SNOTE_TAG
51
- end
52
-
53
-
54
- extend FBO::Parser::NoticeHandler
55
- extend FBO::Parser::ParserHelper
56
- extend self
57
- end
@@ -1,42 +0,0 @@
1
- module FBO::Parser::UnarchiveHandler
2
- TAGS = %w( UNARCHIVE DATE YEAR CBAC PASSWORD AGENCY OFFICE LOCATION NTYPE ) +
3
- %w( SOLNBR ARCHDATE AWDNBR \/UNARCHIVE )
4
-
5
- ANY_UNARCHIVE_TAG = TAGS.join("|")
6
- UNARCHIVE_PATTERN = /^<UNARCHIVE>/
7
-
8
-
9
- def is_unarchive?(text)
10
- text =~ UNARCHIVE_PATTERN
11
- end
12
-
13
- def parse(text)
14
- params = {
15
- date: date(text),
16
- year: year(text),
17
- agency: agency(text),
18
- office: office(text),
19
- location: location(text),
20
- solicitation_number: solicitation_number(text),
21
- notice_type: notice_type(text),
22
- archive_date: archive_date(text),
23
- award_number: award_number(text)
24
- }
25
- FBO::Notices::Unarchive.new(params)
26
- end
27
-
28
-
29
- protected
30
-
31
- # Returns a concatenated list of all tags for the notice
32
- #
33
- # @return [String]
34
- def any_notice_tag
35
- ANY_UNARCHIVE_TAG
36
- end
37
-
38
-
39
- extend FBO::Parser::NoticeHandler
40
- extend FBO::Parser::ParserHelper
41
- extend self
42
- end
@@ -1,20 +0,0 @@
1
- module FBO::Parser::UnknownHandler
2
-
3
- def parse(text)
4
- params = {
5
- type: type(text),
6
- text: text
7
- }
8
- FBO::Notices::Unknown.new(params)
9
- end
10
-
11
-
12
- protected
13
-
14
- def type(text)
15
- text =~ /^<([^>]*)>/
16
- $1
17
- end
18
-
19
- extend self
20
- end
@@ -1,51 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe FBO::Parser::AmendmentHandler do
4
- let(:filename) { File.join(File.dirname(__FILE__), "..", "..", "fixtures", "notices", "amdcss") }
5
- let(:file) { File.new(filename) }
6
- let(:contents) { file.read }
7
-
8
- subject { FBO::Parser::AmendmentHandler }
9
-
10
- it "should recognize amendment content" do
11
- subject.is_amendment?(contents).should be_true
12
- end
13
-
14
- it "should parse all fields correctly" do
15
- amendment = subject.parse(contents)
16
- amendment.date.strftime("%Y-%m-%d").should eq Date.parse("2013-03-26").strftime("%Y-%m-%d")
17
- amendment.year.should eq 2013
18
- amendment.agency.should eq "Department of the Air Force"
19
- amendment.office.should eq "Air Force Materiel Command"
20
- amendment.location.should eq "Tinker AFB - OC-ALC/PKO"
21
- amendment.zip.should eq "73145-9106"
22
- amendment.class_code.should eq "R"
23
- amendment.naics_code.should eq "541611"
24
- amendment.office_address.should eq "7858 5th Street Ste 1 Tinker AFB OK 73145-9106"
25
- amendment.subject.should eq "ISO 9001:2008 AS9100/9110 Registration/Surveillance/Reassessment Audit"
26
- amendment.solicitation_number.should eq "FA8101-13-Q-0014"
27
- amendment.response_date.strftime("%Y-%m-%d").should eq "2013-03-27"
28
- amendment.archive_date.strftime("%Y-%m-%d").should eq "2013-04-26"
29
- amendment.contact_info.should eq "Matthew Kinney, Contract Specialist, Phone 4057393745, Email matthew.kinney@tinker.af.mil - Kimberly L DeLong, Contracting Officer, Phone (405) 739-3514, Fax (405) 739-7957, Email kimberly.delong2@tinker.af.mil"
30
- amendment.description.should eq "<p>***All quotes need to be based&nbsp;off of&nbsp;the scope and&nbsp;figures in the&nbsp;PWS and&nbsp;not OASIS<br />***IAW PWS para 1.1(e) the audit will be scheduled in May&nbsp;and must&nbsp;be&nbsp;completed in one week<br />***Organizations&nbsp;OIN 6115237940</p>"
31
- amendment.link_url.should eq "https://www.fbo.gov/spg/USAF/AFMC/OCALCBC/FA8101-13-Q-0014/listing.html"
32
- amendment.link_description.should eq "Link To Document"
33
- amendment.setaside.should eq "Total Small Business"
34
- amendment.pop_country.should eq "US"
35
- amendment.pop_zip.should eq "73145"
36
- amendment.pop_address.should eq "Tinker AFB\nTinker AFB, OK"
37
- end
38
-
39
- it "should return an Amendment notice" do
40
- amendment = subject.parse(contents)
41
- amendment.should be_instance_of(FBO::Notices::Amendment)
42
- end
43
-
44
- context "when not an amendment" do
45
- let(:filename) { File.join(File.dirname(__FILE__), "..", "..", "fixtures", "notices", "presol") }
46
-
47
- it "should not recognize other notice content" do
48
- subject.is_amendment?(contents).should_not be_true
49
- end
50
- end
51
- end
@@ -1,36 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe FBO::Parser::ArchiveHandler do
4
- let(:filename) { File.join(File.dirname(__FILE__), "..", "..", "fixtures", "notices", "archive") }
5
- let(:file) { File.new(filename) }
6
- let(:contents) { file.read }
7
-
8
- it "should recognize archive content" do
9
- subject.is_archive?(contents).should be_true
10
- end
11
-
12
- it "should parse all fields correctly" do
13
- archive = subject.parse(contents)
14
- archive.date.strftime("%Y-%m-%d").should eq Date.parse("2013-03-01").strftime("%Y-%m-%d")
15
- archive.year.should eq 2013
16
- archive.agency.should eq "Department of Veterans Affairs"
17
- archive.office.should eq "VA Technology Acquisition Center"
18
- archive.location.should eq "VA Technology Acquisition Center"
19
- archive.solicitation_number.should eq "VA11813Q0109"
20
- archive.notice_type.should eq "COMBINE"
21
- archive.archive_date.strftime("%Y-%m-%d").should eq "2013-04-07"
22
- end
23
-
24
- it "should return an Archive notice" do
25
- archive = subject.parse(contents)
26
- archive.should be_instance_of(FBO::Notices::Archive)
27
- end
28
-
29
- context "when not an archive notice" do
30
- let(:filename) { File.join(File.dirname(__FILE__), "..", "..", "fixtures", "notices", "presol") }
31
-
32
- it "should not recognize other notice content" do
33
- subject.is_archive?(contents).should_not be_true
34
- end
35
- end
36
- end
@@ -1,56 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe FBO::Parser::AwardHandler do
4
- let(:filename) { File.join(File.dirname(__FILE__), "..", "..", "fixtures", "notices", "award") }
5
- let(:file) { File.new(filename) }
6
- let(:contents) { file.read }
7
-
8
- subject { FBO::Parser::AwardHandler }
9
-
10
- it "should recognize award content" do
11
- subject.is_award?(contents).should be_true
12
- end
13
-
14
- it "should parse all fields correctly" do
15
- award = subject.parse(contents)
16
- award.date.strftime("%Y-%m-%d").should eq Date.parse("2013-03-27").strftime("%Y-%m-%d")
17
- award.year.should eq 2013
18
- award.agency.should eq "Department of the Army"
19
- award.office.should eq "Army Contracting Command, MICC"
20
- award.location.should eq "MICC - Fort Leonard Wood"
21
- award.zip.should eq "65473"
22
- award.class_code.should eq "Z"
23
- award.naics_code.should eq "238320"
24
- award.office_address.should eq "MICC - Fort Leonard Wood, Directorate of Contracting, P.O. Box 140, Fort Leonard Wood, MO 65473-0140"
25
- award.subject.should eq "Z--Painting and General Repairs Requirements for Fort Leonard Wood Military Installation and Lake of the Ozarks Recreation Area, Missouri."
26
- award.solicitation_number.should eq "W911S713B0002"
27
- award.notice_type.should eq "PRESOL"
28
- award.archive_date.strftime("%Y-%m-%d").should eq "2013-04-26"
29
- award.contact_info.should eq "Christine Wilson, 5735960251\n\n<a href=\"mailto:christine.l.wilson2.civ@mail.mil\">MICC - Fort Leonard Wood</a>"
30
- award.description.should eq "Painting and General Repairs Requirements for Fort Leonard Wood Military Installation and Lake of the Ozarks Recreation Area, Missouri."
31
- award.award_number.should eq "W911S713D0003"
32
- award.award_amount.should eq 10_848_912.50
33
- award.line_number.should eq "0001"
34
- award.awardee.should eq "HOWELL & HOWELL CONTRACTORS, INC. (601721483) <br> 2603 GRASSLAND DR <br> LOUISVILLE, KY 40299-2523"
35
- award.awardee_duns.should eq "1234567890123"
36
- award.link_url.should eq "https://www.fbo.gov/notices/4f878388ec8ed40badf141d1c0281dae"
37
- award.link_description.should eq "Link To Document"
38
- award.email_address.should eq "christine.l.wilson2.civ@mail.mil"
39
- award.email_description.should eq "MICC - Fort Leonard Wood"
40
- award.setaside.should be_nil
41
- award.correction.should be_false
42
- end
43
-
44
- it "should return an Award notice" do
45
- award = subject.parse(contents)
46
- award.should be_instance_of(FBO::Notices::Award)
47
- end
48
-
49
- context "when not an award" do
50
- let(:filename) { File.join(File.dirname(__FILE__), "..", "..", "fixtures", "notices", "presol") }
51
-
52
- it "should not recognize other notice content" do
53
- subject.is_award?(contents).should_not be_true
54
- end
55
- end
56
- end