ecfr 1.0.10 → 1.0.12

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: 9b831994e070ea609002c625540be87ee5c8642f0eb0643acd35b37eec986025
4
- data.tar.gz: d81a7ec6ca04d5c6b5793ddb8aa1040fce4cf722083b7551d11f3e71ccb4d18d
3
+ metadata.gz: 44ee6584017e9a07702bb19c563a67803534b903cc767ed4b0cc12195b672a4b
4
+ data.tar.gz: e695f87cb60ef043bff46563fe87a7d356fcf505665921a08cca959498469dd0
5
5
  SHA512:
6
- metadata.gz: 5b8a21441cd709b5892ba8520ac4b06f7958d56122bff98b9864f96f8a7dfd3077d822e5686838214f50ea68c421ba7589205d716ece8c418aded50cd43cb0e4
7
- data.tar.gz: 6d3b97c5c427bfd015ffd5e3bfea2e5343d0f9e5a9d604c11c852a339e1056826ef2d328307c4960e34e1d2a898eba3c0e60290998ddbdbe212544defdd5cd90
6
+ metadata.gz: 92adb0e55e0f28f73f131c718c708436a36c75f568132add0aa1d33203d5744fc02fee26ebf7b99c86ed6a72356c777691dd63eb4a719773b93f6d64f394e8ce
7
+ data.tar.gz: bc82b515d235b30fbb06096ab2a666df28c133c0d5b6dae0efd38f790c13d76f0e28130007c1840eacdbfb47230c26532fb770a089df9dfbc88d5fa0df449a65
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [1.0.12] - 2023-09-11
4
+ ### Updates
5
+ - Support retry-after header (e00ab2d)
6
+
7
+ ## [1.0.11] - 2023-06-22
8
+ ### Updates
9
+ - Support more robust site notifications(24010c96)
10
+
3
11
  ## [1.0.10] - 2023-06-15
4
12
  ### Bugfixes
5
13
  - Fix client to respect port numbers when determing client reuse (1afbb6)
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ecfr (1.0.2)
4
+ ecfr (1.0.12)
5
5
  activemodel (~> 6.0)
6
6
  activesupport (~> 6.0)
7
7
  faraday (~> 2.0)
@@ -21,7 +21,7 @@ GEM
21
21
  ast (2.4.2)
22
22
  coderay (1.1.3)
23
23
  concurrent-ruby (1.1.9)
24
- connection_pool (2.4.0)
24
+ connection_pool (2.4.1)
25
25
  diff-lcs (1.4.4)
26
26
  ethon (0.16.0)
27
27
  ffi (>= 1.15.0)
@@ -3,19 +3,19 @@ module Ecfr
3
3
  class SiteNotification < Base
4
4
  result_key :notifications
5
5
 
6
- attribute :last_updated_by,
7
- desc: "email of user who last updated the notification"
8
6
  attribute :message,
9
7
  desc: "notification content"
10
8
  attribute :notification_type,
11
- desc: "where the notification should be displayed; either `global` or `global_top`"
9
+ desc: "where the notification should be displayed;
10
+ one of 'basic', 'error', 'feature', 'info', 'special', or 'warning'"
11
+ attribute :location,
12
+ desc: "the location on eCFR.gov that notification will be displayed;
13
+ one of 'all', 'content', 'search' or 'table_of_contents'
14
+ ('top' is the only possible value for the 'special' type)"
12
15
 
13
- attribute :active,
16
+ attribute :user_dismissible,
14
17
  type: :boolean
15
18
 
16
- attribute :updated_at,
17
- type: :datetime
18
-
19
19
  SITE_NOTIFICATIONS_PATH = "v1/notifications.json"
20
20
 
21
21
  #
data/lib/ecfr/client.rb CHANGED
@@ -29,6 +29,15 @@ module Ecfr
29
29
  class Unauthorized < Error; end
30
30
  class UnknownStatusCode < Error; end
31
31
 
32
+ class RetryAfter < Error
33
+ attr_reader :delay
34
+
35
+ def initialize(record = nil, message = "", delay: nil)
36
+ @delay = delay.to_i
37
+ super(record, message)
38
+ end
39
+ end
40
+
32
41
  #
33
42
  # Faraday client configured for eCFR usage.
34
43
  #
@@ -313,6 +322,12 @@ module Ecfr
313
322
  raise RecordNotFound
314
323
  when 422
315
324
  raise InvalidRequest
325
+ when 429
326
+ if (retry_after = response.headers["retry-after"]).present?
327
+ raise RetryAfter.new(delay: retry_after.to_i)
328
+ else
329
+ raise UnknownStatusCode.new(errors, "Status code: #{response.status}")
330
+ end
316
331
  when 500
317
332
  raise ServerError.new(errors)
318
333
  else
data/lib/ecfr/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Ecfr
4
- VERSION = "1.0.10"
4
+ VERSION = "1.0.12"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ecfr
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.10
4
+ version: 1.0.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peregrinator
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-06-15 00:00:00.000000000 Z
11
+ date: 2023-09-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel
@@ -383,7 +383,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
383
383
  - !ruby/object:Gem::Version
384
384
  version: '0'
385
385
  requirements: []
386
- rubygems_version: 3.3.7
386
+ rubygems_version: 3.4.10
387
387
  signing_key:
388
388
  specification_version: 4
389
389
  summary: eCFR.gov API client