ecfr 1.1.4 → 1.1.6

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: 93cb578d4fc85f48e9d1d0ac423522886fa575a2425da6836547eb075d4e6cf5
4
- data.tar.gz: b896739d0023e6398da9effbab99ed0b48323d6a61b9f21b94b2680f9ed74146
3
+ metadata.gz: 7a590084cfafab933fe619638898f62eeacb37aa183af6174cb47406df26d4c5
4
+ data.tar.gz: '095a4f5623deb58978f0c00941fa3c89d2f3bb2ef35bf9dff913e0648fb77af6'
5
5
  SHA512:
6
- metadata.gz: cc03bfa1d18e5e202f4e3f069d4cf3f8ee3caf5aa3af26fdf0f9813a1c9c7756fe403764ac69f00268e3c96cbad85f1697e69eb8eab6f74b4d84351e74806e2e
7
- data.tar.gz: 599a3c76236594b98fde583b801922b3bfb686071c9cbf2460610895d229580c428ba02026898b181dd0729dcfa18ccbecd8c1af5fde036edc17229c55ca739d
6
+ metadata.gz: 5fda252dfcbf05c0922c9c06167d2f6a99b833d60a251544a2e3cecacf990378e629b793f96da9744caddcb2819f7f417736c6ebe432174c25530bad452f3097
7
+ data.tar.gz: 44376ecbcfe743b0a105ae3d146a5c7abe01c304521bf140640dd0b7af67d723457df1a102f32d65f4596670d317ad1166d81130d1d456791d2e8b2d743bdd12
data/.rubocop.yml CHANGED
@@ -18,9 +18,11 @@ inherit_mode:
18
18
  merge:
19
19
  - Exclude
20
20
 
21
- require:
21
+ plugins:
22
22
  # Performance cops are bundled with Standard
23
23
  - rubocop-performance
24
+
25
+ require:
24
26
  # Standard's config uses this custom cop,
25
27
  # so it must be loaded
26
28
  - standard/cop/block_single_line_braces
data/CHANGELOG.md CHANGED
@@ -1,8 +1,17 @@
1
- ## [Unreleased]
1
+ ## [1.1.6] - 2025-09-23
2
+ ### Fixes
3
+ - Add missing Gemfile lock changes
4
+ - See 1.1.5
5
+
6
+ ## [1.1.5] - 2025-09-23 - yanked
7
+ ### Additions
8
+ - Add timeline endpoint (8490dbf1)
9
+ - Removed puts from client to cleanup unwanted output (31846f86)
10
+ - Add support for using 'delete' verb when attempting to clear varnish cache. (7d7a5870)
2
11
 
3
12
  ## [1.1.4] - 2025-03-27
4
13
  ### Additions
5
- - Add factory for Agency (38185411)
14
+ - Add factory for Agency (38185411)
6
15
  ### Dependencies
7
16
  - Removed lock to Rails 6 (f6c5024a)
8
17
 
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ecfr (1.1.3)
4
+ ecfr (1.1.6)
5
5
  activemodel
6
6
  activesupport
7
7
  faraday (~> 2.0)
@@ -24,120 +24,128 @@ GEM
24
24
  minitest (>= 5.1)
25
25
  securerandom (>= 0.3)
26
26
  tzinfo (~> 2.0, >= 2.0.5)
27
- ast (2.4.2)
27
+ ast (2.4.3)
28
28
  base64 (0.2.0)
29
- bigdecimal (3.1.8)
29
+ bigdecimal (3.1.9)
30
30
  coderay (1.1.3)
31
- concurrent-ruby (1.3.4)
32
- connection_pool (2.4.1)
33
- diff-lcs (1.5.1)
31
+ concurrent-ruby (1.3.5)
32
+ connection_pool (2.5.3)
33
+ diff-lcs (1.6.2)
34
34
  drb (2.2.1)
35
35
  ethon (0.16.0)
36
36
  ffi (>= 1.15.0)
37
- factory_bot (6.5.0)
38
- activesupport (>= 5.0.0)
39
- faraday (2.12.0)
40
- faraday-net_http (>= 2.0, < 3.4)
37
+ factory_bot (6.5.1)
38
+ activesupport (>= 6.1.0)
39
+ faraday (2.13.1)
40
+ faraday-net_http (>= 2.0, < 3.5)
41
41
  json
42
42
  logger
43
- faraday-net_http (3.3.0)
44
- net-http
43
+ faraday-net_http (3.4.0)
44
+ net-http (>= 0.5.0)
45
45
  faraday-net_http_persistent (2.3.0)
46
46
  faraday (~> 2.5)
47
47
  net-http-persistent (>= 4.0.4, < 5)
48
48
  faraday-typhoeus (1.1.0)
49
49
  faraday (~> 2.0)
50
50
  typhoeus (~> 1.4)
51
- ffi (1.17.0)
52
- i18n (1.14.6)
51
+ ffi (1.17.2-arm64-darwin)
52
+ ffi (1.17.2-x86_64-linux-gnu)
53
+ i18n (1.14.7)
53
54
  concurrent-ruby (~> 1.0)
54
- json (2.7.2)
55
- language_server-protocol (3.17.0.3)
55
+ json (2.12.0)
56
+ language_server-protocol (3.17.0.5)
56
57
  lint_roller (1.1.0)
57
- logger (1.6.1)
58
+ logger (1.7.0)
58
59
  method_source (1.1.0)
59
- mini_portile2 (2.8.7)
60
- minitest (5.25.1)
61
- net-http (0.4.1)
60
+ minitest (5.25.5)
61
+ net-http (0.6.0)
62
62
  uri
63
- net-http-persistent (4.0.4)
63
+ net-http-persistent (4.0.5)
64
64
  connection_pool (~> 2.2)
65
- nokogiri (1.16.7)
66
- mini_portile2 (~> 2.8.2)
65
+ nokogiri (1.18.8-arm64-darwin)
66
+ racc (~> 1.4)
67
+ nokogiri (1.18.8-x86_64-linux-gnu)
67
68
  racc (~> 1.4)
68
69
  ostruct (0.6.1)
69
- parallel (1.26.3)
70
- parallel_tests (4.7.2)
70
+ parallel (1.27.0)
71
+ parallel_tests (4.10.1)
71
72
  parallel
72
- parser (3.3.5.0)
73
+ parser (3.3.8.0)
73
74
  ast (~> 2.4.1)
74
75
  racc
75
- pry (0.14.2)
76
+ prism (1.4.0)
77
+ pry (0.15.2)
76
78
  coderay (~> 1.1)
77
79
  method_source (~> 1.0)
78
80
  racc (1.8.1)
79
- rack (3.1.7)
81
+ rack (3.1.14)
80
82
  rainbow (3.1.1)
81
- regexp_parser (2.9.2)
83
+ regexp_parser (2.10.0)
82
84
  request_store (1.7.0)
83
85
  rack (>= 1.4)
84
86
  rspec (3.13.0)
85
87
  rspec-core (~> 3.13.0)
86
88
  rspec-expectations (~> 3.13.0)
87
89
  rspec-mocks (~> 3.13.0)
88
- rspec-core (3.13.1)
90
+ rspec-core (3.13.3)
89
91
  rspec-support (~> 3.13.0)
90
- rspec-expectations (3.13.3)
92
+ rspec-expectations (3.13.4)
91
93
  diff-lcs (>= 1.2.0, < 2.0)
92
94
  rspec-support (~> 3.13.0)
93
- rspec-mocks (3.13.2)
95
+ rspec-mocks (3.13.4)
94
96
  diff-lcs (>= 1.2.0, < 2.0)
95
97
  rspec-support (~> 3.13.0)
96
- rspec-support (3.13.1)
98
+ rspec-support (3.13.3)
97
99
  rspec_junit_formatter (0.6.0)
98
100
  rspec-core (>= 2, < 4, != 2.12.0)
99
- rubocop (1.66.1)
101
+ rubocop (1.75.6)
100
102
  json (~> 2.3)
101
- language_server-protocol (>= 3.17.0)
103
+ language_server-protocol (~> 3.17.0.2)
104
+ lint_roller (~> 1.1.0)
102
105
  parallel (~> 1.10)
103
106
  parser (>= 3.3.0.2)
104
107
  rainbow (>= 2.2.2, < 4.0)
105
- regexp_parser (>= 2.4, < 3.0)
106
- rubocop-ast (>= 1.32.2, < 2.0)
108
+ regexp_parser (>= 2.9.3, < 3.0)
109
+ rubocop-ast (>= 1.44.0, < 2.0)
107
110
  ruby-progressbar (~> 1.7)
108
- unicode-display_width (>= 2.4.0, < 3.0)
109
- rubocop-ast (1.32.3)
110
- parser (>= 3.3.1.0)
111
- rubocop-performance (1.22.1)
112
- rubocop (>= 1.48.1, < 2.0)
113
- rubocop-ast (>= 1.31.1, < 2.0)
111
+ unicode-display_width (>= 2.4.0, < 4.0)
112
+ rubocop-ast (1.44.1)
113
+ parser (>= 3.3.7.2)
114
+ prism (~> 1.4)
115
+ rubocop-performance (1.25.0)
116
+ lint_roller (~> 1.1)
117
+ rubocop (>= 1.75.0, < 2.0)
118
+ rubocop-ast (>= 1.38.0, < 2.0)
114
119
  ruby-progressbar (1.13.0)
115
- securerandom (0.3.1)
116
- standard (1.41.0)
120
+ securerandom (0.4.1)
121
+ standard (1.50.0)
117
122
  language_server-protocol (~> 3.17.0.2)
118
123
  lint_roller (~> 1.0)
119
- rubocop (~> 1.66.0)
124
+ rubocop (~> 1.75.5)
120
125
  standard-custom (~> 1.0.0)
121
- standard-performance (~> 1.5)
126
+ standard-performance (~> 1.8)
122
127
  standard-custom (1.0.2)
123
128
  lint_roller (~> 1.0)
124
129
  rubocop (~> 1.50)
125
- standard-performance (1.5.0)
130
+ standard-performance (1.8.0)
126
131
  lint_roller (~> 1.1)
127
- rubocop-performance (~> 1.22.0)
128
- turbo_tests (2.2.4)
132
+ rubocop-performance (~> 1.25.0)
133
+ turbo_tests (2.2.5)
129
134
  parallel_tests (>= 3.3.0, < 5)
130
135
  rspec (>= 3.10)
131
136
  typhoeus (1.4.1)
132
137
  ethon (>= 0.9.0)
133
138
  tzinfo (2.0.6)
134
139
  concurrent-ruby (~> 1.0)
135
- unicode-display_width (2.6.0)
136
- uri (0.13.1)
140
+ unicode-display_width (3.1.4)
141
+ unicode-emoji (~> 4.0, >= 4.0.4)
142
+ unicode-emoji (4.0.4)
143
+ uri (1.0.3)
137
144
  yard (0.9.37)
138
145
 
139
146
  PLATFORMS
140
- ruby
147
+ arm64-darwin
148
+ x86_64-linux-gnu
141
149
 
142
150
  DEPENDENCIES
143
151
  ecfr!
@@ -155,4 +163,4 @@ DEPENDENCIES
155
163
  yard
156
164
 
157
165
  BUNDLED WITH
158
- 2.6.5
166
+ 2.6.7
@@ -43,10 +43,7 @@ module Ecfr
43
43
  end
44
44
 
45
45
  if options[:type] == :boolean
46
- define_method :"#{attr}?" do
47
- val = extract_value(attr, options)
48
- Ecfr::AttributeCaster.cast_attr(val, options[:type], options[:options] || {})
49
- end
46
+ alias_method :"#{attr}?", :"#{attr}"
50
47
  end
51
48
  end
52
49
  end
data/lib/ecfr/base.rb CHANGED
@@ -35,9 +35,10 @@ module Ecfr
35
35
  delegate(*SUPPORTED_ARRAY_ACCESSORS, to: :results)
36
36
  alias_method :all, :results
37
37
 
38
+ DEFAULT_OPTIONS = {base: true}
39
+
38
40
  def initialize(attributes = {}, options = {})
39
- default_options = {base: true}
40
- options = default_options.merge(options)
41
+ options.reverse_merge!(DEFAULT_OPTIONS)
41
42
 
42
43
  @response_status = options.delete(:response_status)
43
44
  @request_data = options.delete(:request_data)
data/lib/ecfr/client.rb CHANGED
@@ -142,7 +142,8 @@ module Ecfr
142
142
 
143
143
  response = instrument("Ecfr::Perform #{cache_key.to_s.tr("\"", "'")}") do
144
144
  RequestStore.fetch(cache_key) do
145
- puts "Request not in eCFR gem cache, fetching..."
145
+ # TODO: replace this puts with a logger
146
+ # puts "Request not in eCFR gem cache, fetching..."
146
147
 
147
148
  response = fetch(method, path, params: params,
148
149
  client_options: client_options)
@@ -201,7 +202,6 @@ module Ecfr
201
202
  #
202
203
  def self.build(response:,
203
204
  request_data: {}, build_options: {})
204
-
205
205
  default_build_options = {parse_response: true}
206
206
  build_options = default_build_options.merge(build_options)
207
207
 
@@ -26,6 +26,7 @@ module Ecfr
26
26
  subscriptions_service_path: nil,
27
27
  varnish_cache_service_url: nil,
28
28
  varnish_cache_service_path: nil,
29
+ varnish_cache_service_clear_method: "purge",
29
30
  versioner_service_url: nil,
30
31
  versioner_service_path: nil,
31
32
  # basic auth - some endpoints require auth
@@ -7,6 +7,7 @@ module Ecfr
7
7
  require_relative "content_version"
8
8
  require_relative "facet_base"
9
9
  require_relative "date_facet"
10
+ require_relative "timeline"
10
11
  require_relative "title_facet"
11
12
 
12
13
  def self.base_url
@@ -0,0 +1,29 @@
1
+ module Ecfr
2
+ module SearchService
3
+ class Timeline < FacetBase
4
+ include AttributeMethodDefinition
5
+
6
+ class Entry < Base
7
+ include AttributeMethodDefinition
8
+
9
+ def initialize(attributes = {}, options = {})
10
+ date, attributes, _ = attributes
11
+ attributes["date"] = date
12
+ attributes["change_types"].compact!
13
+ super
14
+ end
15
+
16
+ attribute :change_types, type: Array(:symbol)
17
+ attribute :count, type: :integer
18
+ attribute :date, type: :date, as: :key
19
+ end
20
+
21
+ attribute :timeline, type: Array(Entry)
22
+
23
+ # @return [<Timeline::Entry>]
24
+ def self.search(options = {})
25
+ super(:timeline, options)
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,13 @@
1
+ class Ecfr::SearchService::Timeline
2
+ extend ResponseHelper
3
+
4
+ def self.response_for(timeline)
5
+ results = {
6
+ timeline: timeline
7
+ }.to_json
8
+
9
+ build(
10
+ response: stubbed_response(results)
11
+ )
12
+ end
13
+ end
@@ -0,0 +1,9 @@
1
+ FactoryBot.define do
2
+ factory :timeline, class: "Ecfr::SearchService::Timeline" do
3
+ skip_create
4
+
5
+ initialize_with {
6
+ new(attributes.deep_stringify_keys)
7
+ }
8
+ end
9
+ end
@@ -14,7 +14,13 @@ module Ecfr
14
14
  end
15
15
 
16
16
  def self.expire(path)
17
- purge(path)
17
+ # not all backends support the purge verb
18
+ # - the varnish purge proxy expects delete
19
+ if Ecfr.config.varnish_cache_service_clear_method.to_s == "delete"
20
+ delete(path)
21
+ else
22
+ purge(path)
23
+ end
18
24
  end
19
25
 
20
26
  def self.expire_everything
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.1.4"
4
+ VERSION = "1.1.6"
5
5
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ecfr
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.4
4
+ version: 1.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peregrinator
8
8
  bindir: exe
9
9
  cert_chain: []
10
- date: 2025-03-27 00:00:00.000000000 Z
10
+ date: 2025-09-23 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: activemodel
@@ -325,6 +325,7 @@ files:
325
325
  - lib/ecfr/search_service/date_facet.rb
326
326
  - lib/ecfr/search_service/facet_base.rb
327
327
  - lib/ecfr/search_service/status.rb
328
+ - lib/ecfr/search_service/timeline.rb
328
329
  - lib/ecfr/search_service/title_facet.rb
329
330
  - lib/ecfr/subscriptions_service/base.rb
330
331
  - lib/ecfr/subscriptions_service/status.rb
@@ -335,6 +336,7 @@ files:
335
336
  - lib/ecfr/testing/extensions/renderer_service/origin_extensions.rb
336
337
  - lib/ecfr/testing/extensions/search_service/content_version_result_extensions.rb
337
338
  - lib/ecfr/testing/extensions/search_service/date_facet_extensions.rb
339
+ - lib/ecfr/testing/extensions/search_service/timeline_extensions.rb
338
340
  - lib/ecfr/testing/extensions/versioner_service/ancestors_extensions.rb
339
341
  - lib/ecfr/testing/extensions/versioner_service/title_extenstions.rb
340
342
  - lib/ecfr/testing/factories/admin_service/agency_factory.rb
@@ -347,6 +349,7 @@ files:
347
349
  - lib/ecfr/testing/factories/search_service/content_version_count_factory.rb
348
350
  - lib/ecfr/testing/factories/search_service/content_version_result_factory.rb
349
351
  - lib/ecfr/testing/factories/search_service/date_facet_factory.rb
352
+ - lib/ecfr/testing/factories/search_service/timeline_factory.rb
350
353
  - lib/ecfr/testing/factories/versioner_service/ancestors_factory.rb
351
354
  - lib/ecfr/testing/factories/versioner_service/metadata_node_info_factory.rb
352
355
  - lib/ecfr/testing/factories/versioner_service/node_summary_factory.rb