lda_gov 0.1.0 → 0.2.1

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
  SHA256:
3
- metadata.gz: 6b11b53da03541ac152c2f82a616f5d148f25df35746066d8407abcaeed0ec2a
4
- data.tar.gz: eed3157d2c8714c4c218652ecc727ecd4c399208a19054063a9ba75dbb4cf626
3
+ metadata.gz: cf17a5d9cbdfc0ff212fb8f075783ddd2f56ac188e8545e1f7d50b5b89be6c37
4
+ data.tar.gz: 7da8f3b41336685e1ac6d76c282f9d391b3908d65cf28d8dd0c400e87765994a
5
5
  SHA512:
6
- metadata.gz: c442d0857cbe0ce7da7e5abc3bc2971ff06c014f21bcde21c5a85a9de52d531187d81b3f0e4556cc98c73b046c961acf3cc3db771f7243ec10e9ab5c7817d671
7
- data.tar.gz: 96c78265857b7b05a135806c09e8c60826575d94cf7b6e963a09e3b538ab9664d01936a76bd11ee94e264019c7d11d038b7b9722b9bf0136d8a43c564cfbc7d3
6
+ metadata.gz: d70c7f8f430f62be97f5bf346b392856c9ffd0eee8bbd55286cd415962c388d78a0bec9131fed99f38ade6fa3a66527d5f210cad2abb6a4699c3bef205169993
7
+ data.tar.gz: a04c274f5636e3c69f9c026d775f4fd65f3e4fc69d9a00cbb1e00409c9ac2135b0159c4cc37450fb388293f06c5c3d201561f8e9eb19b00817b758a83640be66
data/CHANGELOG.md CHANGED
@@ -1,10 +1,24 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.2.1] - 2026-03-23
4
+
5
+ ### Changed
6
+ - Pagination `max_pages` is now configurable via `LDA.configure { |c| c.max_pages = 800 }` instead of a hardcoded constant. Default raised from 100 to 1,000.
7
+
8
+ ## [0.2.0] - 2026-03-22
9
+
10
+ ### Removed
11
+ - `Filings#by_issue` — the LDA.gov API does not support server-side filtering by lobbying issue code. The parameter was silently ignored, returning unfiltered results. Filter client-side via `lobbying_activities` on each filing instead. See README for example.
12
+
13
+ ### Added
14
+ - API Limitations section in README documenting supported vs unsupported server-side filters
15
+ - `filing_type` filter example in README (`Q1`–`Q4`, `RR`, `RA`, etc.)
16
+
3
17
  ## [0.1.0] - 2025-03-13
4
18
 
5
19
  ### Added
6
20
  - Initial release
7
- - Filings resource (list, find, quarterly, by_registrant_and_client, by_issue)
21
+ - Filings resource (list, find, quarterly, by_registrant_and_client)
8
22
  - Contributions resource (list, find)
9
23
  - Registrants resource (list, find)
10
24
  - Clients resource (list, find)
data/README.md CHANGED
@@ -48,8 +48,8 @@ LDA.filings.by_registrant_and_client(
48
48
  client_name: 'Big Corp'
49
49
  )
50
50
 
51
- # Filter by lobbying issue
52
- LDA.filings.by_issue(issue_code: 'HCR')
51
+ # Filter by filing type (quarterly reports, registrations, etc.)
52
+ LDA.filings.list(filing_year: 2024, filing_type: 'Q1')
53
53
  ```
54
54
 
55
55
  ### Contributions
@@ -120,8 +120,9 @@ LDA.lobbyists.all_lobbyists
120
120
  LDA.configure do |config|
121
121
  config.api_key = ENV['LDA_API_KEY'] # Optional — enables higher rate limits
122
122
  config.timeout = 60 # Request timeout in seconds (default: 30)
123
- config.retries = 5 # Max retries on 429/5xx (default: 3)
124
- config.logger = Logger.new($stdout) # Optional request logging
123
+ config.retries = 5 # Max retries on 429/5xx (default: 3)
124
+ config.max_pages = 800 # Max pages per paginate call (default: 1000)
125
+ config.logger = Logger.new($stdout) # Optional request logging
125
126
  end
126
127
  ```
127
128
 
@@ -207,6 +208,30 @@ LDA::Error
207
208
 
208
209
  All `ClientError` and `ServerError` subclasses expose `.status` and `.body`.
209
210
 
211
+ ## API Limitations
212
+
213
+ The LDA.gov API does not support server-side filtering by lobbying issue code. Passing a `lobbying_issue` parameter to the filings endpoint has no effect — the API returns all filings regardless.
214
+
215
+ **Supported filters** (confirmed working server-side):
216
+ - `filing_year` — calendar year
217
+ - `filing_type` — filing type code (`Q1`–`Q4`, `RR`, `RA`, `1T`, `1TY`, etc.)
218
+ - `filing_period` — filing period (`first_quarter`, `second_quarter`, etc.)
219
+ - `registrant_name` — registrant name search
220
+ - `client_name` — client name search
221
+
222
+ To filter by issue code, iterate over filings and check `lobbying_activities` on each filing:
223
+
224
+ ```ruby
225
+ LDA.filings.each_page(filing_year: 2024, filing_type: 'Q1') do |page|
226
+ page.each do |filing|
227
+ issues = filing['lobbying_activities']&.map { |a| a['general_issue_code'] } || []
228
+ next unless issues.include?('DEF')
229
+
230
+ process(filing)
231
+ end
232
+ end
233
+ ```
234
+
210
235
  ## Development
211
236
 
212
237
  ```bash
@@ -223,6 +248,10 @@ bundle exec rubocop # Lint
223
248
  - Ruby >= 3.1
224
249
  - Faraday ~> 2.0
225
250
 
251
+ ## Support
252
+
253
+ [![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/omgjack)
254
+
226
255
  ## License
227
256
 
228
257
  MIT License. See [LICENSE.txt](LICENSE.txt).
@@ -5,8 +5,6 @@ require 'faraday/retry'
5
5
 
6
6
  module LDA
7
7
  class Client
8
- MAX_PAGES = 100
9
-
10
8
  attr_reader :config
11
9
 
12
10
  def initialize(config = LDA.configuration)
@@ -38,7 +36,7 @@ module LDA
38
36
 
39
37
  page = response.next_page_number
40
38
  break if page.nil?
41
- break if iterations >= MAX_PAGES
39
+ break if iterations >= config.max_pages
42
40
  end
43
41
  end
44
42
 
@@ -2,19 +2,21 @@
2
2
 
3
3
  module LDA
4
4
  class Configuration
5
- DEFAULT_BASE_URL = 'https://lda.gov/api/v1/'
6
- DEFAULT_TIMEOUT = 30
7
- DEFAULT_RETRIES = 3
5
+ DEFAULT_BASE_URL = 'https://lda.gov/api/v1/'
6
+ DEFAULT_TIMEOUT = 30
7
+ DEFAULT_RETRIES = 3
8
+ DEFAULT_MAX_PAGES = 1000
8
9
 
9
- attr_accessor :base_url, :timeout, :retries, :logger, :adapter, :api_key
10
+ attr_accessor :base_url, :timeout, :retries, :logger, :adapter, :api_key, :max_pages
10
11
 
11
12
  def initialize
12
- @base_url = DEFAULT_BASE_URL
13
- @timeout = DEFAULT_TIMEOUT
14
- @retries = DEFAULT_RETRIES
15
- @logger = nil
16
- @adapter = Faraday.default_adapter
17
- @api_key = ENV.fetch('LDA_API_KEY', nil)
13
+ @base_url = DEFAULT_BASE_URL
14
+ @timeout = DEFAULT_TIMEOUT
15
+ @retries = DEFAULT_RETRIES
16
+ @max_pages = DEFAULT_MAX_PAGES
17
+ @logger = nil
18
+ @adapter = Faraday.default_adapter
19
+ @api_key = ENV.fetch('LDA_API_KEY', nil)
18
20
  end
19
21
 
20
22
  def to_h
@@ -22,6 +24,7 @@ module LDA
22
24
  base_url: base_url,
23
25
  timeout: timeout,
24
26
  retries: retries,
27
+ max_pages: max_pages,
25
28
  logger: logger,
26
29
  adapter: adapter,
27
30
  api_key: api_key
@@ -26,10 +26,6 @@ module LDA
26
26
  def by_registrant_and_client(registrant_name:, client_name:, **params)
27
27
  get('filings/', params.merge(registrant_name: registrant_name, client_name: client_name))
28
28
  end
29
-
30
- def by_issue(issue_code:, **params)
31
- get('filings/', params.merge(lobbying_issue: issue_code))
32
- end
33
29
  end
34
30
  end
35
31
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module LDA
4
- VERSION = '0.1.0'
4
+ VERSION = '0.2.1'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lda_gov
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jack Killilea
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-03-14 00:00:00.000000000 Z
11
+ date: 2026-03-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday