restful_resource 2.10.3 → 2.13.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
  SHA256:
3
- metadata.gz: 68a4372ef797bce4031a74263c47edd86898a4f10c7a3516d08cfecdb52b59c5
4
- data.tar.gz: 46ebcfbb5dbdda37c06c678369e838bdf646f0b3e4d6ea103ddd25407e3e98bb
3
+ metadata.gz: cec2e659ed71ca619e9330f081ea3fca44f3c8c81f99b64c61da09fdfb10eba3
4
+ data.tar.gz: 3bb1d23623d56833ccd47633322b198acae8167cd60a55112fcd5e3a93f73ec4
5
5
  SHA512:
6
- metadata.gz: 58bec55b531529a570598f66ab67c7fd113a9315ee7f8fa1cbb9219b7ac326c734a43f8697feb81debb59cb02447c9853d37e8b630a7f0d477c6ce388261c4a8
7
- data.tar.gz: 7dd64a01a76e08587f2c1f9b122648b2a00a0436b4dc8233b8fb94f3677c96e21e03ff829f829e7c8450dbb8c8536c2c2851cb717c0c89239aa0ea9b56dcaa7c
6
+ metadata.gz: 9c4c9daef6e98629a3cbfd5dff8def60dec64c9c9dcc2c98522a27936fffa898f8621c56dbbc535327e4560bb3481618bf3d7c450084a61cfd8b74fa92881b90
7
+ data.tar.gz: 2be3a33eefb0985c586ccdd42dcbc8dce6cd0b62bc0789eab7f0fbc50d150d032da23daf8893ace5cd79b4a51d546f1ef5ffc0b4b501d909fce5cdbf5eef9395
data/.circleci/config.yml CHANGED
@@ -1,29 +1,28 @@
1
- version: 2
1
+ version: 2.1
2
+
2
3
  jobs:
3
- build:
4
+ test:
5
+ parameters:
6
+ ruby:
7
+ type: string
4
8
  docker:
5
- - image: circleci/ruby:2.7
9
+ - image: cimg/ruby:<< parameters.ruby >>
6
10
  steps:
7
11
  - checkout
12
+ - run: bundle install
8
13
  - run:
9
- name: Bundle Install
10
- command: |
11
- gem install bundler && \
12
- bundle check || bundle install
13
- - run:
14
- name: Run rspec in parallel
14
+ name: rspec
15
15
  command: |
16
- bundle exec rspec --profile 10 \
17
- --format RspecJunitFormatter \
18
- --out test_results/rspec.xml \
19
- --format progress \
20
- $(circleci tests glob "spec/**/*_spec.rb" | circleci tests split --split-by=timings)
16
+ bundle exec rspec --format progress \
17
+ --format RspecJunitFormatter --out test-results/rspec.xml
21
18
  - store_test_results:
22
- path: test_results
23
-
19
+ path: test-results
24
20
 
25
21
  workflows:
26
22
  version: 2
27
- build:
23
+ test:
28
24
  jobs:
29
- - build
25
+ - test:
26
+ matrix:
27
+ parameters:
28
+ ruby: ['2.7', '3.0']
@@ -0,0 +1,23 @@
1
+ version: 2
2
+ registries:
3
+ rubygems-server-rubygems-pkg-github-com-carwow:
4
+ type: rubygems-server
5
+ url: https://rubygems.pkg.github.com/carwow
6
+ username: "${{secrets.RUBYGEMS_SERVER_RUBYGEMS_PKG_GITHUB_COM_CARWOW_USERNAME}}"
7
+ password: "${{secrets.RUBYGEMS_SERVER_RUBYGEMS_PKG_GITHUB_COM_CARWOW_PASSWORD}}"
8
+
9
+ updates:
10
+ - package-ecosystem: bundler
11
+ directory: "/"
12
+ schedule:
13
+ interval: daily
14
+ time: "09:00"
15
+ open-pull-requests-limit: 10
16
+ ignore:
17
+ - dependency-name: activesupport
18
+ versions:
19
+ - 6.1.2
20
+ - 6.1.2.1
21
+ - 6.1.3
22
+ registries:
23
+ - rubygems-server-rubygems-pkg-github-com-carwow
data/.gitignore CHANGED
@@ -18,3 +18,4 @@ tmp
18
18
  *.swp
19
19
  *.swo
20
20
  /tags
21
+ /Gemfile.lock
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ 2.13.0
4
+ ---
5
+
6
+ - Require ruby >= 2.7
7
+
3
8
  2.10.0
4
9
  ---
5
10
 
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RestfulResource
4
+ class Deprecator < ActiveSupport::Deprecation
5
+ GEM_NAME = 'restful_resource'
6
+
7
+ def self.build(horizon: 'soon')
8
+ @deprecators ||= {}
9
+ @deprecators["#{GEM_NAME}@#{horizon}"] ||= new(horizon)
10
+ end
11
+
12
+ def initialize(horizon)
13
+ super(horizon, GEM_NAME)
14
+
15
+ @app_deprecator = ActiveSupport::Deprecation.instance
16
+ end
17
+
18
+ # inherit the default configured behavior for the app
19
+ delegate :behavior, to: :app_deprecator
20
+
21
+ private
22
+
23
+ attr_reader :app_deprecator
24
+ end
25
+ end
@@ -1,7 +1,7 @@
1
1
  module RestfulResource
2
2
  class OpenObject
3
3
  def initialize(attributes = {}, _hack_for_activeresource = false)
4
- @inner_object = OpenStruct.new(attributes)
4
+ @inner_object = StrictOpenStruct.new(attributes)
5
5
  end
6
6
 
7
7
  def method_missing(method, *args, &block)
@@ -0,0 +1,5 @@
1
+ module RestfulResource
2
+ class StrictOpenStruct < ::OpenStruct
3
+ deprecate :dig, :[], deprecator: Deprecator.build
4
+ end
5
+ end
@@ -1,3 +1,3 @@
1
1
  module RestfulResource
2
- VERSION = '2.10.3'.freeze
2
+ VERSION = '2.13.0'.freeze
3
3
  end
@@ -9,11 +9,13 @@ require 'faraday/encoding'
9
9
  require 'active_support'
10
10
  require 'active_support/all'
11
11
  require 'resolv-replace'
12
+ require_relative 'restful_resource/deprecator'
12
13
  require_relative 'restful_resource/version'
13
14
  require_relative 'restful_resource/null_logger'
14
15
  require_relative 'restful_resource/paginated_array'
15
16
  require_relative 'restful_resource/parameter_missing_error'
16
17
  require_relative 'restful_resource/resource_id_missing_error'
18
+ require_relative 'restful_resource/strict_open_struct'
17
19
  require_relative 'restful_resource/open_object'
18
20
  require_relative 'restful_resource/response'
19
21
  require_relative 'restful_resource/request'
@@ -16,7 +16,7 @@ Gem::Specification.new do |spec|
16
16
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
17
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
18
  spec.require_paths = ['lib']
19
- spec.required_ruby_version = '>= 2.4'
19
+ spec.required_ruby_version = Gem::Requirement.new('>= 2.7.0')
20
20
 
21
21
  spec.add_development_dependency 'bundler'
22
22
  spec.add_development_dependency 'carwow_rubocop'
@@ -0,0 +1,21 @@
1
+ require_relative '../spec_helper'
2
+
3
+ RSpec.describe RestfulResource::StrictOpenStruct do
4
+ let(:instance) { described_class.new(foo: 'bar') }
5
+
6
+ describe '#dig' do
7
+ it 'is deprecated' do
8
+ expect { instance.dig(:foo) }.to output(
9
+ /dig is deprecated and will be removed from restful_resource soon/
10
+ ).to_stderr
11
+ end
12
+ end
13
+
14
+ describe '#[]' do
15
+ it 'is deprecated' do
16
+ expect { instance[:foo] }.to output(
17
+ /\[\] is deprecated and will be removed from restful_resource soon/
18
+ ).to_stderr
19
+ end
20
+ end
21
+ end
data/spec/spec_helper.rb CHANGED
@@ -7,6 +7,7 @@ require_relative 'fixtures'
7
7
  RSpec.configure do |config|
8
8
  config.color = true
9
9
  config.formatter = :progress
10
+ config.filter_run_when_matching :focus
10
11
  end
11
12
 
12
13
  def expect_get(url, response, headers: {}, open_timeout: nil, timeout: nil)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: restful_resource
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.10.3
4
+ version: 2.13.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Santoro
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2020-11-12 00:00:00.000000000 Z
12
+ date: 2021-11-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -246,12 +246,12 @@ extra_rdoc_files: []
246
246
  files:
247
247
  - ".circleci/config.yml"
248
248
  - ".codeclimate.yml"
249
+ - ".github/dependabot.yml"
249
250
  - ".gitignore"
250
251
  - ".rubocop.yml"
251
252
  - ".rubocop_todo.yml"
252
253
  - CHANGELOG.md
253
254
  - Gemfile
254
- - Gemfile.lock
255
255
  - LICENSE.txt
256
256
  - README.md
257
257
  - Rakefile
@@ -260,6 +260,7 @@ files:
260
260
  - lib/restful_resource/associations.rb
261
261
  - lib/restful_resource/authorization.rb
262
262
  - lib/restful_resource/base.rb
263
+ - lib/restful_resource/deprecator.rb
263
264
  - lib/restful_resource/http_client.rb
264
265
  - lib/restful_resource/instrumentation.rb
265
266
  - lib/restful_resource/null_logger.rb
@@ -271,6 +272,7 @@ files:
271
272
  - lib/restful_resource/request.rb
272
273
  - lib/restful_resource/resource_id_missing_error.rb
273
274
  - lib/restful_resource/response.rb
275
+ - lib/restful_resource/strict_open_struct.rb
274
276
  - lib/restful_resource/version.rb
275
277
  - restful_resource.gemspec
276
278
  - spec/fixtures.rb
@@ -283,6 +285,7 @@ files:
283
285
  - spec/restful_resource/rails_validations_spec.rb
284
286
  - spec/restful_resource/redirections_spec.rb
285
287
  - spec/restful_resource/request_spec.rb
288
+ - spec/restful_resource/strict_open_struct_spec.rb
286
289
  - spec/spec_helper.rb
287
290
  homepage: http://www.github.com/carwow/restful_resource
288
291
  licenses:
@@ -296,14 +299,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
296
299
  requirements:
297
300
  - - ">="
298
301
  - !ruby/object:Gem::Version
299
- version: '2.4'
302
+ version: 2.7.0
300
303
  required_rubygems_version: !ruby/object:Gem::Requirement
301
304
  requirements:
302
305
  - - ">="
303
306
  - !ruby/object:Gem::Version
304
307
  version: '0'
305
308
  requirements: []
306
- rubygems_version: 3.1.2
309
+ rubygems_version: 3.1.4
307
310
  signing_key:
308
311
  specification_version: 4
309
312
  summary: A simple activerecord inspired rest resource base class implemented using
@@ -319,4 +322,5 @@ test_files:
319
322
  - spec/restful_resource/rails_validations_spec.rb
320
323
  - spec/restful_resource/redirections_spec.rb
321
324
  - spec/restful_resource/request_spec.rb
325
+ - spec/restful_resource/strict_open_struct_spec.rb
322
326
  - spec/spec_helper.rb
data/Gemfile.lock DELETED
@@ -1,122 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- restful_resource (2.10.3)
5
- activesupport (~> 6.0)
6
- faraday (~> 1.0)
7
- faraday-cdn-metrics (~> 0.2)
8
- faraday-encoding
9
- faraday-http-cache (~> 2.2)
10
- faraday_middleware (~> 1.0)
11
- link_header
12
- rack (~> 2.2)
13
- typhoeus (~> 1.4)
14
-
15
- GEM
16
- remote: https://rubygems.org/
17
- specs:
18
- activesupport (6.0.3.4)
19
- concurrent-ruby (~> 1.0, >= 1.0.2)
20
- i18n (>= 0.7, < 2)
21
- minitest (~> 5.1)
22
- tzinfo (~> 1.1)
23
- zeitwerk (~> 2.2, >= 2.2.2)
24
- ast (2.4.1)
25
- carwow_rubocop (3.4.1)
26
- rubocop (>= 0.93)
27
- rubocop-performance
28
- rubocop-rspec
29
- coderay (1.1.2)
30
- concurrent-ruby (1.1.7)
31
- diff-lcs (1.4.4)
32
- ethon (0.12.0)
33
- ffi (>= 1.3.0)
34
- faraday (1.1.0)
35
- multipart-post (>= 1.2, < 3)
36
- ruby2_keywords
37
- faraday-cdn-metrics (0.2.0)
38
- faraday (~> 1)
39
- faraday-encoding (0.0.5)
40
- faraday
41
- faraday-http-cache (2.2.0)
42
- faraday (>= 0.8)
43
- faraday_middleware (1.0.0)
44
- faraday (~> 1.0)
45
- ffi (1.13.1)
46
- i18n (1.8.5)
47
- concurrent-ruby (~> 1.0)
48
- link_header (0.0.8)
49
- method_source (1.0.0)
50
- minitest (5.14.2)
51
- multipart-post (2.1.1)
52
- parallel (1.20.0)
53
- parser (2.7.2.0)
54
- ast (~> 2.4.1)
55
- pry (0.13.1)
56
- coderay (~> 1.1)
57
- method_source (~> 1.0)
58
- rack (2.2.3)
59
- rainbow (3.0.0)
60
- rake (13.0.1)
61
- regexp_parser (1.8.2)
62
- rexml (3.2.4)
63
- rspec (3.10.0)
64
- rspec-core (~> 3.10.0)
65
- rspec-expectations (~> 3.10.0)
66
- rspec-mocks (~> 3.10.0)
67
- rspec-core (3.10.0)
68
- rspec-support (~> 3.10.0)
69
- rspec-expectations (3.10.0)
70
- diff-lcs (>= 1.2.0, < 2.0)
71
- rspec-support (~> 3.10.0)
72
- rspec-its (1.3.0)
73
- rspec-core (>= 3.0.0)
74
- rspec-expectations (>= 3.0.0)
75
- rspec-mocks (3.10.0)
76
- diff-lcs (>= 1.2.0, < 2.0)
77
- rspec-support (~> 3.10.0)
78
- rspec-support (3.10.0)
79
- rspec_junit_formatter (0.4.1)
80
- rspec-core (>= 2, < 4, != 2.12.0)
81
- rubocop (1.3.0)
82
- parallel (~> 1.10)
83
- parser (>= 2.7.1.5)
84
- rainbow (>= 2.2.2, < 4.0)
85
- regexp_parser (>= 1.8)
86
- rexml
87
- rubocop-ast (>= 1.1.1)
88
- ruby-progressbar (~> 1.7)
89
- unicode-display_width (>= 1.4.0, < 2.0)
90
- rubocop-ast (1.1.1)
91
- parser (>= 2.7.1.5)
92
- rubocop-performance (1.8.1)
93
- rubocop (>= 0.87.0)
94
- rubocop-ast (>= 0.4.0)
95
- rubocop-rspec (2.0.0)
96
- rubocop (~> 1.0)
97
- rubocop-ast (>= 1.1.0)
98
- ruby-progressbar (1.10.1)
99
- ruby2_keywords (0.0.2)
100
- thread_safe (0.3.6)
101
- typhoeus (1.4.0)
102
- ethon (>= 0.9.0)
103
- tzinfo (1.2.7)
104
- thread_safe (~> 0.1)
105
- unicode-display_width (1.7.0)
106
- zeitwerk (2.4.0)
107
-
108
- PLATFORMS
109
- ruby
110
-
111
- DEPENDENCIES
112
- bundler
113
- carwow_rubocop
114
- pry
115
- rake
116
- restful_resource!
117
- rspec
118
- rspec-its
119
- rspec_junit_formatter
120
-
121
- BUNDLED WITH
122
- 2.1.4