restful_resource 2.12.0 → 2.12.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 07d4d828bec908de39e82dafb3758b8d5aba824156cfab777e6f7cc1023ad780
4
- data.tar.gz: 0bc035ca2730ac59ea88cdc4ed09ace71694de18da2049651472f860a1d07cb5
3
+ metadata.gz: 6d99c38a79730e832e99b155798ae920f45eed26dd44435ce71efcb58fd6094c
4
+ data.tar.gz: 46ea4b63768ee7cf60ee5aa33fe02c96f5e715e6512d0a0cff38483ff975325b
5
5
  SHA512:
6
- metadata.gz: bc2785c662982c44946272a01c012d908f65e6dbb4226ce33c69ed907472af8b6866f12052e6ef4dc44f4d94868e44ce48a2de62d84bd30acfa40e8a314c20d5
7
- data.tar.gz: '06982f1adf0b187610157a049b35ca24516cccddad936aa2d52a04415a1e8f5d10bd6b7e95d0a510a9fb680a38ed26a0550aed5ea67ba71b06b2482d0fb2bd1f'
6
+ metadata.gz: fc155eb1cd1fd0d3e70654dd6d5b4b6824409533f8d3d72a0aed79eca56501b8eea9745732fb7fd26406df9051edfde3a20fe31e9042666cfe1b7f8e47b7a735
7
+ data.tar.gz: 9f7bb0b92f5dcff2161547829cc4b798d00e5ac1a614559e6785dee231a0a4552e54998d927c8d947dba005e555b81144eba8f78e8e5eabee707ea70aff2c422
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- restful_resource (2.12.0)
4
+ restful_resource (2.12.1)
5
5
  activesupport (~> 6.0)
6
6
  faraday (~> 1.0)
7
7
  faraday-cdn-metrics (~> 0.2)
@@ -45,7 +45,7 @@ GEM
45
45
  faraday_middleware (1.0.0)
46
46
  faraday (~> 1.0)
47
47
  ffi (1.15.0)
48
- i18n (1.8.9)
48
+ i18n (1.8.10)
49
49
  concurrent-ruby (~> 1.0)
50
50
  link_header (0.0.8)
51
51
  method_source (1.0.0)
@@ -9,6 +9,7 @@ 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'
@@ -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,5 +1,5 @@
1
1
  module RestfulResource
2
2
  class StrictOpenStruct < ::OpenStruct
3
- deprecate :dig, :[]
3
+ deprecate :dig, :[], deprecator: Deprecator.build
4
4
  end
5
5
  end
@@ -1,3 +1,3 @@
1
1
  module RestfulResource
2
- VERSION = '2.12.0'.freeze
2
+ VERSION = '2.12.1'.freeze
3
3
  end
@@ -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.12.0
4
+ version: 2.12.1
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: 2021-03-29 00:00:00.000000000 Z
12
+ date: 2021-04-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -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
@@ -284,6 +285,7 @@ files:
284
285
  - spec/restful_resource/rails_validations_spec.rb
285
286
  - spec/restful_resource/redirections_spec.rb
286
287
  - spec/restful_resource/request_spec.rb
288
+ - spec/restful_resource/strict_open_struct_spec.rb
287
289
  - spec/spec_helper.rb
288
290
  homepage: http://www.github.com/carwow/restful_resource
289
291
  licenses:
@@ -304,7 +306,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
304
306
  - !ruby/object:Gem::Version
305
307
  version: '0'
306
308
  requirements: []
307
- rubygems_version: 3.1.4
309
+ rubygems_version: 3.1.2
308
310
  signing_key:
309
311
  specification_version: 4
310
312
  summary: A simple activerecord inspired rest resource base class implemented using
@@ -320,4 +322,5 @@ test_files:
320
322
  - spec/restful_resource/rails_validations_spec.rb
321
323
  - spec/restful_resource/redirections_spec.rb
322
324
  - spec/restful_resource/request_spec.rb
325
+ - spec/restful_resource/strict_open_struct_spec.rb
323
326
  - spec/spec_helper.rb