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,14 +0,0 @@
1
- module FBO
2
- module Notices
3
- class Presolicitation < Struct.new(:date, :year, :zip, :class_code,
4
- :naics_code, :agency, :office, :location,
5
- :office_address, :subject, :solicitation_number,
6
- :response_date, :archive_date,
7
- :contact_info, :description, :link_url,
8
- :link_description, :email_address,
9
- :email_description, :setaside, :pop_address,
10
- :pop_zip, :pop_country)
11
- include FBO::Notice
12
- end
13
- end
14
- end
@@ -1,13 +0,0 @@
1
- module FBO
2
- module Notices
3
- class SaleOfSurplus < Struct.new(:date, :year, :zip, :class_code, :naics_code,
4
- :agency, :office, :location, :office_address,
5
- :subject, :solicitation_number, :response_date,
6
- :archive_date, :description, :contact_info,
7
- :link_url, :link_description, :email_address,
8
- :email_description, :setaside, :pop_country,
9
- :pop_zip, :pop_address)
10
- include FBO::Notice
11
- end
12
- end
13
- end
@@ -1,13 +0,0 @@
1
- module FBO
2
- module Notices
3
- class SourcesSought < Struct.new(:date, :year, :zip, :class_code, :naics_code,
4
- :agency, :office, :location, :office_address,
5
- :subject, :solicitation_number,
6
- :response_date, :archive_date, :contact_info,
7
- :description, :link_url, :link_description,
8
- :email_address, :email_description, :setaside,
9
- :pop_address, :pop_zip, :pop_country)
10
- include FBO::Notice
11
- end
12
- end
13
- end
@@ -1,13 +0,0 @@
1
- module FBO
2
- module Notices
3
- class SpecialNotice < Struct.new(:date, :year, :zip, :class_code, :naics_code,
4
- :agency, :office, :location, :office_address,
5
- :subject, :solicitation_number, :response_date,
6
- :archive_date, :description, :contact_info,
7
- :link_url, :link_description, :email_address,
8
- :email_description, :setaside, :pop_country,
9
- :pop_zip, :pop_address)
10
- include FBO::Notice
11
- end
12
- end
13
- end
@@ -1,9 +0,0 @@
1
- module FBO
2
- module Notices
3
- class Unarchive < Struct.new(:date, :year, :agency, :office, :location,
4
- :solicitation_number, :notice_type, :archive_date,
5
- :award_number)
6
- include FBO::Notice
7
- end
8
- end
9
- end
@@ -1,7 +0,0 @@
1
- module FBO
2
- module Notices
3
- class Unknown < Struct.new(:type, :text)
4
- include FBO::Notice
5
- end
6
- end
7
- end
@@ -1,58 +0,0 @@
1
- module FBO::Parser::AmendmentHandler
2
- TAGS = %w( AMDCSS DATE YEAR CBAC PASSWORD ZIP CLASSCOD NAICS OFFADD NTYPE) +
3
- %w( AGENCY OFFICE LOCATION SUBJECT SOLNBR RESPDATE ARCHDATE CONTACT DESC ) +
4
- %w( LINK URL EMAIL ADDRESS SETASIDE POPADDRESS POPZIP POPCOUNTRY \/AMDCSS )
5
-
6
- ANY_AMDCSS_TAG = TAGS.join("|")
7
- AMENDMENT_PATTERN = /^<AMDCSS>/
8
-
9
-
10
- def is_amendment?(text)
11
- text =~ AMENDMENT_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
- notice_type: notice_type(text),
28
- response_date: response_date(text),
29
- archive_date: archive_date(text),
30
- contact_info: contact(text),
31
- description: description(text),
32
- link_url: link_url(text),
33
- link_description: link_description(text),
34
- email_address: email_address(text),
35
- email_description: email_description(text),
36
- setaside: set_aside(text),
37
- pop_address: pop_address(text),
38
- pop_zip: pop_zip_code(text),
39
- pop_country: pop_country(text)
40
- }
41
- FBO::Notices::Amendment.new(params)
42
- end
43
-
44
-
45
- protected
46
-
47
- # Returns a concatenated list of all tags for the notice
48
- #
49
- # @return [String]
50
- def any_notice_tag
51
- ANY_AMDCSS_TAG
52
- end
53
-
54
-
55
- extend FBO::Parser::NoticeHandler
56
- extend FBO::Parser::ParserHelper
57
- extend self
58
- end
@@ -1,41 +0,0 @@
1
- module FBO::Parser::ArchiveHandler
2
- TAGS = %w( ARCHIVE DATE YEAR CBAC PASSWORD AGENCY OFFICE LOCATION NTYPE ) +
3
- %w( SOLNBR ARCHDATE \/ARCHIVE )
4
-
5
- ANY_ARCHIVE_TAG = TAGS.join("|")
6
- ARCHIVE_PATTERN = /^<ARCHIVE>/
7
-
8
-
9
- def is_archive?(text)
10
- text =~ ARCHIVE_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
- }
24
- FBO::Notices::Archive.new(params)
25
- end
26
-
27
-
28
- protected
29
-
30
- # Returns a concatenated list of all tags for the notice
31
- #
32
- # @return [String]
33
- def any_notice_tag
34
- ANY_ARCHIVE_TAG
35
- end
36
-
37
-
38
- extend FBO::Parser::NoticeHandler
39
- extend FBO::Parser::ParserHelper
40
- extend self
41
- end
@@ -1,62 +0,0 @@
1
- module FBO::Parser::AwardHandler
2
- TAGS = %w( AWARD DATE YEAR CBAC PASSWORD ZIP CLASSCOD NAICS OFFADD ) +
3
- %w( AGENCY OFFICE LOCATION SUBJECT SOLNBR NTYPE DESC CONTACT AWDNBR AWDAMT ) +
4
- %w( LINENBR AWDDATE ARCHDATE AWARDEE AWARDEEDUNS LINK URL EMAIL ADDRESS ) +
5
- %w( SETASIDE CORRECTION /AWARD )
6
-
7
- ANY_AWARD_TAG = TAGS.join("|")
8
- AWARD_PATTERN = /^<AWARD>/
9
-
10
-
11
- def is_award?(text)
12
- text =~ AWARD_PATTERN
13
- end
14
-
15
- def parse(text)
16
- params = {
17
- date: date(text),
18
- year: year(text),
19
- zip: zip(text),
20
- class_code: classification_code(text),
21
- naics_code: naics_code(text),
22
- agency: agency(text),
23
- office: office(text),
24
- location: location(text),
25
- office_address: office_address(text),
26
- subject: subject(text),
27
- solicitation_number: solicitation_number(text),
28
- notice_type: notice_type(text),
29
- description: description(text),
30
- contact_info: contact(text),
31
- award_number: award_number(text),
32
- award_amount: award_amount(text),
33
- line_number: line_number(text),
34
- award_date: award_date(text),
35
- archive_date: archive_date(text),
36
- awardee: awardee(text),
37
- awardee_duns: awardee_duns(text),
38
- link_url: link_url(text),
39
- link_description: link_description(text),
40
- email_address: email_address(text),
41
- email_description: email_description(text),
42
- setaside: set_aside(text),
43
- correction: correction?(text)
44
- }
45
- FBO::Notices::Award.new(params)
46
- end
47
-
48
-
49
- protected
50
-
51
- # Returns a concatenated list of all tags for the notice
52
- #
53
- # @return [String]
54
- def any_notice_tag
55
- ANY_AWARD_TAG
56
- end
57
-
58
-
59
- extend FBO::Parser::NoticeHandler
60
- extend FBO::Parser::ParserHelper
61
- extend self
62
- end
@@ -1,57 +0,0 @@
1
- module FBO::Parser::CombinedSolicitationHandler
2
- TAGS = %w( COMBINE 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 \/COMBINE )
5
-
6
- ANY_COMBINE_TAG = TAGS.join("|")
7
- COMBINED_PATTERN = /^<COMBINE>/
8
-
9
-
10
- def is_combined_solicitation?(text)
11
- text =~ COMBINED_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::CombinedSolicitation.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_COMBINE_TAG
51
- end
52
-
53
-
54
- extend FBO::Parser::NoticeHandler
55
- extend FBO::Parser::ParserHelper
56
- extend self
57
- end
@@ -1,61 +0,0 @@
1
- module FBO::Parser::FairOpportunityHandler
2
- TAGS = %w( FAIROPP DATE YEAR CBAC PASSWORD ZIP CLASSCOD NAICS OFFADD AGENCY ) +
3
- %w( OFFICE LOCATION SUBJECT SOLNBR NTYPE FOJA AWDNBR DONBR MODNBR AWDDATE ) +
4
- %w( ARCHDATE DESC CONTACT LINK URL EMAIL ADDRESS FILELIST FILE MIMETYPE ) +
5
- %w( /FILE /FILELIST CORRECTION /FAIROPP )
6
-
7
- ANY_FAIROPP_TAG = TAGS.join("|")
8
- FAIR_OPPORTUNITY_PATTERN = /^<FAIROPP>/
9
-
10
-
11
- def is_fair_opportunity?(text)
12
- text =~ FAIR_OPPORTUNITY_PATTERN
13
- end
14
-
15
- def parse(text)
16
- params = {
17
- date: date(text),
18
- year: year(text),
19
- zip: zip(text),
20
- class_code: classification_code(text),
21
- naics_code: naics_code(text),
22
- agency: agency(text),
23
- office: office(text),
24
- location: location(text),
25
- office_address: office_address(text),
26
- subject: subject(text),
27
- solicitation_number: solicitation_number(text),
28
- notice_type: notice_type(text),
29
- justification_authority: justification_authority(text),
30
- award_number: award_number(text),
31
- delivery_order_number: delivery_order_number(text),
32
- modification_number: modification_number(text),
33
- award_date: award_date(text),
34
- archive_date: archive_date(text),
35
- description: description(text),
36
- contact_info: contact(text),
37
- link_url: link_url(text),
38
- link_description: link_description(text),
39
- email_address: email_address(text),
40
- email_description: email_description(text),
41
- file_list: file_list(text),
42
- correction: correction?(text)
43
- }
44
- FBO::Notices::FairOpportunity.new(params)
45
- end
46
-
47
-
48
- protected
49
-
50
- # Returns a concatenated list of all tags for the notice
51
- #
52
- # @return [String]
53
- def any_notice_tag
54
- ANY_FAIROPP_TAG
55
- end
56
-
57
-
58
- extend FBO::Parser::NoticeHandler
59
- extend FBO::Parser::ParserHelper
60
- extend self
61
- end
@@ -1,57 +0,0 @@
1
- module FBO::Parser::ForeignStandardHandler
2
- TAGS = %w( FSTD 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 POPCOUNTRY POPADDRESS POPZIP \/FSTD )
5
-
6
- ANY_FSTD_TAG = TAGS.join("|")
7
- FOREIGN_STANDARD_PATTERN = /^<FSTD>/
8
-
9
-
10
- def is_foreign_standard?(text)
11
- text =~ FOREIGN_STANDARD_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::ForeignStandard.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_FSTD_TAG
51
- end
52
-
53
-
54
- extend FBO::Parser::NoticeHandler
55
- extend FBO::Parser::ParserHelper
56
- extend self
57
- end
@@ -1,37 +0,0 @@
1
- class FBO::Parser::HandlerSelector
2
-
3
- def self.select(text)
4
- if FBO::Parser::PresolicitationHandler.is_presolicitation?(text)
5
- FBO::Parser::PresolicitationHandler
6
- elsif FBO::Parser::CombinedSolicitationHandler.is_combined_solicitation?(text)
7
- FBO::Parser::CombinedSolicitationHandler
8
- elsif FBO::Parser::SourcesSoughtHandler.is_sources_sought?(text)
9
- FBO::Parser::SourcesSoughtHandler
10
- elsif FBO::Parser::AmendmentHandler.is_amendment?(text)
11
- FBO::Parser::AmendmentHandler
12
- elsif FBO::Parser::ModificationHandler.is_modification?(text)
13
- FBO::Parser::ModificationHandler
14
- elsif FBO::Parser::AwardHandler.is_award?(text)
15
- FBO::Parser::AwardHandler
16
- elsif FBO::Parser::FairOpportunityHandler.is_fair_opportunity?(text)
17
- FBO::Parser::FairOpportunityHandler
18
- elsif FBO::Parser::ForeignStandardHandler.is_foreign_standard?(text)
19
- FBO::Parser::ForeignStandardHandler
20
- elsif FBO::Parser::ArchiveHandler.is_archive?(text)
21
- FBO::Parser::ArchiveHandler
22
- elsif FBO::Parser::IntentToBundleHandler.is_intent_to_bundle?(text)
23
- FBO::Parser::IntentToBundleHandler
24
- elsif FBO::Parser::JustificationApprovalHandler.is_justification_approval?(text)
25
- FBO::Parser::JustificationApprovalHandler
26
- elsif FBO::Parser::SaleOfSurplusHandler.is_sale_of_surplus?(text)
27
- FBO::Parser::SaleOfSurplusHandler
28
- elsif FBO::Parser::SpecialNoticeHandler.is_special_notice?(text)
29
- FBO::Parser::SpecialNoticeHandler
30
- elsif FBO::Parser::UnarchiveHandler.is_unarchive?(text)
31
- FBO::Parser::UnarchiveHandler
32
- else
33
- FBO::Parser::UnknownHandler
34
- end
35
- end
36
-
37
- end