fech-search 0.1.0 → 0.2.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: dd2966cc82225142ba65490ea702ce5a2c43b024
4
- data.tar.gz: 2ba7b2ae6ff2fcf40d325684b9e44a78ce540ced
3
+ metadata.gz: 02fb914d11fe0702167fb2f61130c7351e5ef2a9
4
+ data.tar.gz: 1c8bcd3bd5b097968dd7a22f2a258cfe5b46a191
5
5
  SHA512:
6
- metadata.gz: 563565fb0c897400bcd8973a9e38184e63d63a7f9eed3f65a4688864636bbd8a9eae18c34716b5ac92eda6f77e525d52c9614a1a60b3fbe78ed62d03ab097c1a
7
- data.tar.gz: 92a475a7072ad9ecc0f448daf9d05807da4594fc82e404eb3494582528dfc10a72d634ec37f34d4df246655c4b5adf0745828a607e01c9d991a5f1bc3c875339
6
+ metadata.gz: c30a966d0e7df39bcd6a7d6164d4dbf3d1785b28fe73b99efbbf893446abe312524d47c180a3bb1648b1dd4f2aa7db4eed93cbd7523bc53a8d89785db9cd56b9
7
+ data.tar.gz: 0389836009e9e4553e192b0edc86afef149a4003894eecdf29533e772816214d1911207c97a0c4abe479ac70d0f913b243673fd3378299275288010cdb3e5775
@@ -1,18 +1,26 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- fech-search (0.0.1)
5
- fech (= 1.4.1)
4
+ fech-search (0.1.0)
5
+ fech (~> 1.8)
6
+ nokogiri (~> 1.6)
6
7
 
7
8
  GEM
8
9
  remote: https://rubygems.org/
9
10
  specs:
10
11
  diff-lcs (1.2.4)
12
+ ensure-encoding (0.1)
11
13
  fastercsv (1.5.5)
12
- fech (1.4.1)
14
+ fech (1.8)
15
+ ensure-encoding
13
16
  fastercsv
14
17
  people
18
+ mini_portile2 (2.1.0)
19
+ nokogiri (1.6.8)
20
+ mini_portile2 (~> 2.1.0)
21
+ pkg-config (~> 1.1.7)
15
22
  people (0.2.1)
23
+ pkg-config (1.1.7)
16
24
  rspec (2.13.0)
17
25
  rspec-core (~> 2.13.0)
18
26
  rspec-expectations (~> 2.13.0)
@@ -27,4 +35,7 @@ PLATFORMS
27
35
 
28
36
  DEPENDENCIES
29
37
  fech-search!
30
- rspec (= 2.13.0)
38
+ rspec (~> 2.13.0)
39
+
40
+ BUNDLED WITH
41
+ 1.10.5
@@ -3,7 +3,7 @@ require File.expand_path('../lib/fech-search/version', __FILE__)
3
3
 
4
4
  Gem::Specification.new do |gem|
5
5
  gem.authors = ["Aaron Bycoffe"]
6
- gem.email = ["bycoffe@huffingtonpost.com"]
6
+ gem.email = ["bycoffe@gmail.com"]
7
7
  gem.description = %q{A Fech plugin for searching electronic FEC filings}
8
8
  gem.summary = %q{Fech-Search provides an interface for searching for electronic filings submitted to the FEC, and accessing the data in those filings using Fech}
9
9
  gem.homepage = ""
@@ -15,8 +15,8 @@ Gem::Specification.new do |gem|
15
15
  gem.require_paths = ["lib"]
16
16
  gem.version = Fech::Search::VERSION
17
17
 
18
- gem.add_dependency "fech", "~> 1.6.2"
19
- gem.add_dependency "nokogiri", "1.6.6.2"
18
+ gem.add_dependency "fech", "~> 1.8"
19
+ gem.add_dependency "nokogiri", "~> 1.6"
20
20
 
21
21
  gem.add_development_dependency "rspec", "~> 2.13.0"
22
22
  end
@@ -93,7 +93,7 @@ module Fech
93
93
  # Parse a line that contains committee information
94
94
  def parse_committee_line(line)
95
95
  match = line.match(/<A.*?>(?<name>.*?) - (?<id>C\d{8})<\/A/)
96
- {:committee_name => match['name'], :committee_id => match['id']}
96
+ {committee_name: match['name'], committee_id: match['id']}
97
97
  end
98
98
 
99
99
  # Parse a line that contains a filing
@@ -107,4 +107,3 @@ module Fech
107
107
  end
108
108
 
109
109
  end
110
-
@@ -3,7 +3,7 @@ module Fech
3
3
  # Fech:SearchResult is a class representing a search result
4
4
  # from Fech::Search.
5
5
  class SearchResult
6
- attr_reader :committee_name, :committee_id, :filing_id, :form_type, :period, :date_filed, :description, :amended_by
6
+ attr_reader :committee_name, :committee_id, :filing_id, :form_type, :period, :date_filed, :description, :amended_by, :amendment
7
7
 
8
8
  # @param [Hash] attrs The attributes of the search result.
9
9
  def initialize(attrs)
@@ -15,8 +15,9 @@ module Fech
15
15
  @form_type = attrs[:form_type]
16
16
  @period = parse_period(attrs[:from], attrs[:to])
17
17
  @date_filed = Date.strptime(attrs[:date_filed], @date_format)
18
- @description = attrs[:description]
18
+ @description = parse_description(attrs)
19
19
  @amended_by = attrs[:amended_by]
20
+ @amendment = parse_form_type(attrs[:form_type])
20
21
  end
21
22
 
22
23
  # Parse the strings representing a filing period.
@@ -27,7 +28,34 @@ module Fech
27
28
  return unless valid_date(from.to_s) && valid_date(to.to_s)
28
29
  from = Date.strptime(from, @date_format)
29
30
  to = Date.strptime(to, @date_format)
30
- {:from => from, :to => to}
31
+ {from: from, to: to}
32
+ end
33
+
34
+ def parse_description(attrs)
35
+ if attrs[:form_type] == 'F1A' or attrs[:form_type] == 'F1N'
36
+ description = 'STATEMENT OF ORGANIZATION'
37
+ elsif attrs[:form_type] == 'F2A' or attrs[:form_type] == 'F2N'
38
+ description = "STATEMENT OF CANDIDACY"
39
+ elsif attrs[:form_type] == 'F5A' or attrs[:form_type] == 'F5N'
40
+ description = "REPORT OF INDEPENDENT EXPENDITURES MADE"
41
+ elsif attrs[:form_type] == 'F1M'
42
+ description = "NOTIFICATION OF MULTICANDIDATE STATUS"
43
+ elsif attrs[:form_type] == 'F13'
44
+ description = "INAUGURAL COMMITTEE DONATIONS"
45
+ else
46
+ description = attrs[:description].strip
47
+ end
48
+ description
49
+ end
50
+
51
+ # Checks form_type to see if a filing is an amendment
52
+ # and returns a boolean.
53
+ def parse_form_type(form_type)
54
+ if form_type.end_with?('A')
55
+ true
56
+ else
57
+ false
58
+ end
31
59
  end
32
60
 
33
61
  # Check whether a date string is valid
@@ -1,5 +1,5 @@
1
1
  module Fech
2
2
  class Search
3
- VERSION = "0.1.0"
3
+ VERSION = "0.2.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,65 +1,65 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fech-search
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aaron Bycoffe
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-16 00:00:00.000000000 Z
11
+ date: 2016-08-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fech
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ~>
18
18
  - !ruby/object:Gem::Version
19
- version: 1.6.2
19
+ version: '1.8'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ~>
25
25
  - !ruby/object:Gem::Version
26
- version: 1.6.2
26
+ version: '1.8'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: nokogiri
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '='
31
+ - - ~>
32
32
  - !ruby/object:Gem::Version
33
- version: 1.6.6.2
33
+ version: '1.6'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '='
38
+ - - ~>
39
39
  - !ruby/object:Gem::Version
40
- version: 1.6.6.2
40
+ version: '1.6'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ~>
46
46
  - !ruby/object:Gem::Version
47
47
  version: 2.13.0
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - ~>
53
53
  - !ruby/object:Gem::Version
54
54
  version: 2.13.0
55
55
  description: A Fech plugin for searching electronic FEC filings
56
56
  email:
57
- - bycoffe@huffingtonpost.com
57
+ - bycoffe@gmail.com
58
58
  executables: []
59
59
  extensions: []
60
60
  extra_rdoc_files: []
61
61
  files:
62
- - ".gitignore"
62
+ - .gitignore
63
63
  - Gemfile
64
64
  - Gemfile.lock
65
65
  - LICENSE
@@ -81,17 +81,17 @@ require_paths:
81
81
  - lib
82
82
  required_ruby_version: !ruby/object:Gem::Requirement
83
83
  requirements:
84
- - - ">="
84
+ - - '>='
85
85
  - !ruby/object:Gem::Version
86
86
  version: '0'
87
87
  required_rubygems_version: !ruby/object:Gem::Requirement
88
88
  requirements:
89
- - - ">="
89
+ - - '>='
90
90
  - !ruby/object:Gem::Version
91
91
  version: '0'
92
92
  requirements: []
93
93
  rubyforge_project:
94
- rubygems_version: 2.2.2
94
+ rubygems_version: 2.4.7
95
95
  signing_key:
96
96
  specification_version: 4
97
97
  summary: Fech-Search provides an interface for searching for electronic filings submitted