api_client_base 1.9.0 → 1.10.0

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: 8b9fd36954265d22fd5c8b2ae143ccf63a54b941ffbfd4230022683501e5b674
4
- data.tar.gz: 5bf06572c3e6c65ccc66dd6c98e650c8cd33b639f720b5cbd56a397daa8815e1
3
+ metadata.gz: d0d7688c1ef8b38a3f6dabd86884a22d199f06793b66ac821e83560bfb3c9a52
4
+ data.tar.gz: 3ff78a2323c040fbac2c5b59963910c291273c1d096074b36af32333d943a616
5
5
  SHA512:
6
- metadata.gz: d4e2dcc49429d9d20a65daff58d433aeb0170e0b5b0bbf9fc2feb2121be17ea28894e8a196175e095eb8f29526042d4418e2d0822a22e1c80aecc0c8eec56638
7
- data.tar.gz: 441e6aeeb41f95255f35522f43e558370df1cc25b6954684c5eea40b0a4d0bffb6d47e10be187b209f9fd21515f3f4559a70a7a4d557d971edbedd408a5c8491
6
+ metadata.gz: 32eefbc1cf3d275bf534fc68611baa123ef809da3d7fd90af4116beb4912e9fb1f57aaca902a41ef0509a82f27676d38f16f2ec2cd08b568efbf76ddbf0345a3
7
+ data.tar.gz: c1eb95b14c639e6a29e23eb8a779a522fa6f7462239b2e35e0893de7d6d85a292665258715b73d3aebd2418abcf1f8222db38cd857399e6e42bf1723f07da7c7
@@ -0,0 +1,37 @@
1
+ # This workflow uses actions that are not certified by GitHub.
2
+ # They are provided by a third-party and are governed by
3
+ # separate terms of service, privacy policy, and support
4
+ # documentation.
5
+ # This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
6
+ # For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
7
+
8
+ name: Ruby
9
+
10
+ on:
11
+ push:
12
+ branches: [ master ]
13
+ pull_request:
14
+ branches: [ master ]
15
+
16
+ jobs:
17
+ test:
18
+
19
+ runs-on: ubuntu-latest
20
+ strategy:
21
+ matrix:
22
+ ruby-version: ['2.6', '2.7']
23
+
24
+ steps:
25
+ - uses: actions/checkout@v2
26
+ - name: Set up Ruby
27
+ # To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
28
+ # change this to (see https://github.com/ruby/setup-ruby#versioning):
29
+ # uses: ruby/setup-ruby@v1
30
+ uses: ruby/setup-ruby@473e4d8fe5dd94ee328fdfca9f8c9c7afc9dae5e
31
+ with:
32
+ ruby-version: ${{ matrix.ruby-version }}
33
+ bundler-cache: true # runs 'bundle install' and caches installed gems automatically
34
+ - name: Install appraisal gems
35
+ run: bundle exec appraisal install
36
+ - name: Run tests
37
+ run: bundle exec appraisal rspec
data/Appraisals ADDED
@@ -0,0 +1,7 @@
1
+ appraise "dry-validation-0.x" do
2
+ gem "dry-validation", "~> 0.13"
3
+ end
4
+
5
+ appraise "dry-validation-1.x" do
6
+ gem "dry-validation", "~> 1.6"
7
+ end
data/CHANGELOG.md CHANGED
@@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
4
4
  The format is based on [Keep a Changelog](http://keepachangelog.com/)
5
5
  and this project adheres to [Semantic Versioning](http://semver.org/).
6
6
 
7
+ ## [1.10.0] - 2021-06-15
8
+ ### Added
9
+ - `dry-validation` 1.x support (0.x support has not been dropped)
10
+
7
11
  ## [1.9.0] - 2020-06-30
8
12
  ### Added
9
13
  - Allow users to override typhoeus_options to pass any args that we haven't defined
data/Gemfile CHANGED
@@ -3,7 +3,5 @@ source 'https://rubygems.org'
3
3
  # Specify your gem's dependencies in api_client_base.gemspec
4
4
  gemspec
5
5
 
6
- ruby "2.6.5"
7
-
8
6
  gem "pry-byebug", "~> 3.9"
9
7
  gem "typhoeus"
@@ -40,5 +40,6 @@ Gem::Specification.new do |spec|
40
40
  spec.add_development_dependency "virtus-matchers"
41
41
  spec.add_development_dependency "vcr", "~> 3.0"
42
42
  spec.add_development_dependency "webmock"
43
- spec.add_development_dependency "dry-validation", "< 1.0"
43
+ spec.add_development_dependency "dry-validation", "< 2.0"
44
+ spec.add_development_dependency "appraisal"
44
45
  end
@@ -0,0 +1,2 @@
1
+ ---
2
+ BUNDLE_RETRY: "1"
@@ -0,0 +1,9 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "pry-byebug", "~> 3.9"
6
+ gem "typhoeus"
7
+ gem "dry-validation", "~> 0.13"
8
+
9
+ gemspec path: "../"
@@ -0,0 +1,140 @@
1
+ PATH
2
+ remote: ..
3
+ specs:
4
+ api_client_base (1.9.0)
5
+ activesupport (>= 3.0)
6
+ gem_config (>= 0.3.1)
7
+ virtus (>= 1.0)
8
+
9
+ GEM
10
+ remote: https://rubygems.org/
11
+ specs:
12
+ activesupport (6.1.3.1)
13
+ concurrent-ruby (~> 1.0, >= 1.0.2)
14
+ i18n (>= 1.6, < 2)
15
+ minitest (>= 5.1)
16
+ tzinfo (~> 2.0)
17
+ zeitwerk (~> 2.3)
18
+ addressable (2.7.0)
19
+ public_suffix (>= 2.0.2, < 5.0)
20
+ appraisal (2.4.0)
21
+ bundler
22
+ rake
23
+ thor (>= 0.14.0)
24
+ axiom-types (0.1.1)
25
+ descendants_tracker (~> 0.0.4)
26
+ ice_nine (~> 0.11.0)
27
+ thread_safe (~> 0.3, >= 0.3.1)
28
+ byebug (11.1.3)
29
+ coderay (1.1.3)
30
+ coercible (1.0.0)
31
+ descendants_tracker (~> 0.0.1)
32
+ concurrent-ruby (1.1.8)
33
+ crack (0.4.5)
34
+ rexml
35
+ descendants_tracker (0.0.4)
36
+ thread_safe (~> 0.3, >= 0.3.1)
37
+ diff-lcs (1.4.4)
38
+ dry-configurable (0.11.5)
39
+ concurrent-ruby (~> 1.0)
40
+ dry-core (~> 0.4, >= 0.4.7)
41
+ dry-equalizer (~> 0.2)
42
+ dry-container (0.7.2)
43
+ concurrent-ruby (~> 1.0)
44
+ dry-configurable (~> 0.1, >= 0.1.3)
45
+ dry-core (0.4.9)
46
+ concurrent-ruby (~> 1.0)
47
+ dry-equalizer (0.3.0)
48
+ dry-inflector (0.2.0)
49
+ dry-logic (0.6.1)
50
+ concurrent-ruby (~> 1.0)
51
+ dry-core (~> 0.2)
52
+ dry-equalizer (~> 0.2)
53
+ dry-types (0.14.1)
54
+ concurrent-ruby (~> 1.0)
55
+ dry-container (~> 0.3)
56
+ dry-core (~> 0.4, >= 0.4.4)
57
+ dry-equalizer (~> 0.2)
58
+ dry-inflector (~> 0.1, >= 0.1.2)
59
+ dry-logic (~> 0.5, >= 0.5)
60
+ dry-validation (0.13.3)
61
+ concurrent-ruby (~> 1.0)
62
+ dry-configurable (~> 0.1, >= 0.1.3)
63
+ dry-core (~> 0.2, >= 0.2.1)
64
+ dry-equalizer (~> 0.2)
65
+ dry-logic (~> 0.5, >= 0.5.0)
66
+ dry-types (~> 0.14.0)
67
+ equalizer (0.0.11)
68
+ ethon (0.12.0)
69
+ ffi (>= 1.3.0)
70
+ ffi (1.15.0)
71
+ gem_config (0.3.2)
72
+ hashdiff (1.0.1)
73
+ i18n (1.8.10)
74
+ concurrent-ruby (~> 1.0)
75
+ ice_nine (0.11.2)
76
+ method_source (1.0.0)
77
+ minitest (5.14.4)
78
+ pry (0.13.1)
79
+ coderay (~> 1.1)
80
+ method_source (~> 1.0)
81
+ pry-byebug (3.9.0)
82
+ byebug (~> 11.0)
83
+ pry (~> 0.13.0)
84
+ public_suffix (4.0.6)
85
+ rake (10.5.0)
86
+ rexml (3.2.4)
87
+ rspec (3.10.0)
88
+ rspec-core (~> 3.10.0)
89
+ rspec-expectations (~> 3.10.0)
90
+ rspec-mocks (~> 3.10.0)
91
+ rspec-core (3.10.1)
92
+ rspec-support (~> 3.10.0)
93
+ rspec-expectations (3.10.1)
94
+ diff-lcs (>= 1.2.0, < 2.0)
95
+ rspec-support (~> 3.10.0)
96
+ rspec-mocks (3.10.1)
97
+ diff-lcs (>= 1.2.0, < 2.0)
98
+ rspec-support (~> 3.10.0)
99
+ rspec-support (3.10.1)
100
+ thor (1.1.0)
101
+ thread_safe (0.3.6)
102
+ typhoeus (1.4.0)
103
+ ethon (>= 0.9.0)
104
+ tzinfo (2.0.4)
105
+ concurrent-ruby (~> 1.0)
106
+ vcr (3.0.3)
107
+ virtus (1.0.5)
108
+ axiom-types (~> 0.1)
109
+ coercible (~> 1.0)
110
+ descendants_tracker (~> 0.0, >= 0.0.3)
111
+ equalizer (~> 0.0, >= 0.0.9)
112
+ virtus-matchers (0.4.0)
113
+ virtus (~> 1.0.0)
114
+ webmock (3.11.1)
115
+ addressable (>= 2.3.6)
116
+ crack (>= 0.3.2)
117
+ hashdiff (>= 0.4.0, < 2.0.0)
118
+ zeitwerk (2.4.2)
119
+
120
+ PLATFORMS
121
+ ruby
122
+
123
+ DEPENDENCIES
124
+ api_client_base!
125
+ appraisal
126
+ bundler (~> 2.1)
127
+ dry-validation (~> 0.13)
128
+ pry-byebug (~> 3.9)
129
+ rake (~> 10.0)
130
+ rspec (~> 3.0)
131
+ typhoeus
132
+ vcr (~> 3.0)
133
+ virtus-matchers
134
+ webmock
135
+
136
+ RUBY VERSION
137
+ ruby 2.7.3p183
138
+
139
+ BUNDLED WITH
140
+ 2.1.4
@@ -0,0 +1,9 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "pry-byebug", "~> 3.9"
6
+ gem "typhoeus"
7
+ gem "dry-validation", "~> 1.6"
8
+
9
+ gemspec path: "../"
@@ -0,0 +1,145 @@
1
+ PATH
2
+ remote: ..
3
+ specs:
4
+ api_client_base (1.9.0)
5
+ activesupport (>= 3.0)
6
+ gem_config (>= 0.3.1)
7
+ virtus (>= 1.0)
8
+
9
+ GEM
10
+ remote: https://rubygems.org/
11
+ specs:
12
+ activesupport (6.1.3.2)
13
+ concurrent-ruby (~> 1.0, >= 1.0.2)
14
+ i18n (>= 1.6, < 2)
15
+ minitest (>= 5.1)
16
+ tzinfo (~> 2.0)
17
+ zeitwerk (~> 2.3)
18
+ addressable (2.7.0)
19
+ public_suffix (>= 2.0.2, < 5.0)
20
+ appraisal (2.4.0)
21
+ bundler
22
+ rake
23
+ thor (>= 0.14.0)
24
+ axiom-types (0.1.1)
25
+ descendants_tracker (~> 0.0.4)
26
+ ice_nine (~> 0.11.0)
27
+ thread_safe (~> 0.3, >= 0.3.1)
28
+ byebug (11.1.3)
29
+ coderay (1.1.3)
30
+ coercible (1.0.0)
31
+ descendants_tracker (~> 0.0.1)
32
+ concurrent-ruby (1.1.9)
33
+ crack (0.4.5)
34
+ rexml
35
+ descendants_tracker (0.0.4)
36
+ thread_safe (~> 0.3, >= 0.3.1)
37
+ diff-lcs (1.4.4)
38
+ dry-configurable (0.12.1)
39
+ concurrent-ruby (~> 1.0)
40
+ dry-core (~> 0.5, >= 0.5.0)
41
+ dry-container (0.8.0)
42
+ concurrent-ruby (~> 1.0)
43
+ dry-configurable (~> 0.1, >= 0.1.3)
44
+ dry-core (0.6.0)
45
+ concurrent-ruby (~> 1.0)
46
+ dry-equalizer (0.3.0)
47
+ dry-inflector (0.2.0)
48
+ dry-initializer (3.0.4)
49
+ dry-logic (1.2.0)
50
+ concurrent-ruby (~> 1.0)
51
+ dry-core (~> 0.5, >= 0.5)
52
+ dry-schema (1.6.2)
53
+ concurrent-ruby (~> 1.0)
54
+ dry-configurable (~> 0.8, >= 0.8.3)
55
+ dry-core (~> 0.5, >= 0.5)
56
+ dry-initializer (~> 3.0)
57
+ dry-logic (~> 1.0)
58
+ dry-types (~> 1.5)
59
+ dry-types (1.5.1)
60
+ concurrent-ruby (~> 1.0)
61
+ dry-container (~> 0.3)
62
+ dry-core (~> 0.5, >= 0.5)
63
+ dry-inflector (~> 0.1, >= 0.1.2)
64
+ dry-logic (~> 1.0, >= 1.0.2)
65
+ dry-validation (1.6.0)
66
+ concurrent-ruby (~> 1.0)
67
+ dry-container (~> 0.7, >= 0.7.1)
68
+ dry-core (~> 0.4)
69
+ dry-equalizer (~> 0.2)
70
+ dry-initializer (~> 3.0)
71
+ dry-schema (~> 1.5, >= 1.5.2)
72
+ equalizer (0.0.11)
73
+ ethon (0.14.0)
74
+ ffi (>= 1.15.0)
75
+ ffi (1.15.1)
76
+ gem_config (0.3.2)
77
+ hashdiff (1.0.1)
78
+ i18n (1.8.10)
79
+ concurrent-ruby (~> 1.0)
80
+ ice_nine (0.11.2)
81
+ method_source (1.0.0)
82
+ minitest (5.14.4)
83
+ pry (0.13.1)
84
+ coderay (~> 1.1)
85
+ method_source (~> 1.0)
86
+ pry-byebug (3.9.0)
87
+ byebug (~> 11.0)
88
+ pry (~> 0.13.0)
89
+ public_suffix (4.0.6)
90
+ rake (10.5.0)
91
+ rexml (3.2.5)
92
+ rspec (3.10.0)
93
+ rspec-core (~> 3.10.0)
94
+ rspec-expectations (~> 3.10.0)
95
+ rspec-mocks (~> 3.10.0)
96
+ rspec-core (3.10.1)
97
+ rspec-support (~> 3.10.0)
98
+ rspec-expectations (3.10.1)
99
+ diff-lcs (>= 1.2.0, < 2.0)
100
+ rspec-support (~> 3.10.0)
101
+ rspec-mocks (3.10.2)
102
+ diff-lcs (>= 1.2.0, < 2.0)
103
+ rspec-support (~> 3.10.0)
104
+ rspec-support (3.10.2)
105
+ thor (1.1.0)
106
+ thread_safe (0.3.6)
107
+ typhoeus (1.4.0)
108
+ ethon (>= 0.9.0)
109
+ tzinfo (2.0.4)
110
+ concurrent-ruby (~> 1.0)
111
+ vcr (3.0.3)
112
+ virtus (1.0.5)
113
+ axiom-types (~> 0.1)
114
+ coercible (~> 1.0)
115
+ descendants_tracker (~> 0.0, >= 0.0.3)
116
+ equalizer (~> 0.0, >= 0.0.9)
117
+ virtus-matchers (0.4.0)
118
+ virtus (~> 1.0.0)
119
+ webmock (3.13.0)
120
+ addressable (>= 2.3.6)
121
+ crack (>= 0.3.2)
122
+ hashdiff (>= 0.4.0, < 2.0.0)
123
+ zeitwerk (2.4.2)
124
+
125
+ PLATFORMS
126
+ ruby
127
+
128
+ DEPENDENCIES
129
+ api_client_base!
130
+ appraisal
131
+ bundler (~> 2.1)
132
+ dry-validation (~> 1.6)
133
+ pry-byebug (~> 3.9)
134
+ rake (~> 10.0)
135
+ rspec (~> 3.0)
136
+ typhoeus
137
+ vcr (~> 3.0)
138
+ virtus-matchers
139
+ webmock
140
+
141
+ RUBY VERSION
142
+ ruby 2.7.3p183
143
+
144
+ BUNDLED WITH
145
+ 2.1.4
@@ -11,11 +11,16 @@ module APIClientBase
11
11
  def self.errors_of(klass, attrs)
12
12
  schema = schema_of(klass)
13
13
  return [] if schema.nil?
14
- schema.(attrs).errors
14
+
15
+ schema.(attrs).errors.to_h
15
16
  end
16
17
 
17
18
  def self.schema_of(klass)
18
- "#{klass.name}Schema".constantize
19
+ contract_class = "#{klass.name}Schema".constantize
20
+
21
+ return contract_class if Dry::Validation.const_defined?("Schema")
22
+
23
+ contract_class.new
19
24
  rescue NameError
20
25
  end
21
26
 
@@ -1,3 +1,3 @@
1
1
  module APIClientBase
2
- VERSION = "1.9.0"
2
+ VERSION = "1.10.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: api_client_base
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.9.0
4
+ version: 1.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ramon Tayag
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-06-30 00:00:00.000000000 Z
11
+ date: 2021-06-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -142,14 +142,28 @@ dependencies:
142
142
  requirements:
143
143
  - - "<"
144
144
  - !ruby/object:Gem::Version
145
- version: '1.0'
145
+ version: '2.0'
146
146
  type: :development
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
150
  - - "<"
151
151
  - !ruby/object:Gem::Version
152
- version: '1.0'
152
+ version: '2.0'
153
+ - !ruby/object:Gem::Dependency
154
+ name: appraisal
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - ">="
158
+ - !ruby/object:Gem::Version
159
+ version: '0'
160
+ type: :development
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - ">="
165
+ - !ruby/object:Gem::Version
166
+ version: '0'
153
167
  description: Abstractions to help author API wrappers in Ruby.
154
168
  email:
155
169
  - ramon.tayag@gmail.com
@@ -157,9 +171,10 @@ executables: []
157
171
  extensions: []
158
172
  extra_rdoc_files: []
159
173
  files:
174
+ - ".github/workflows/ruby.yml"
160
175
  - ".gitignore"
161
176
  - ".rspec"
162
- - ".travis.yml"
177
+ - Appraisals
163
178
  - CHANGELOG.md
164
179
  - CODE_OF_CONDUCT.md
165
180
  - Gemfile
@@ -169,6 +184,11 @@ files:
169
184
  - api_client_base.gemspec
170
185
  - bin/console
171
186
  - bin/setup
187
+ - gemfiles/.bundle/config
188
+ - gemfiles/dry_validation_0.x.gemfile
189
+ - gemfiles/dry_validation_0.x.gemfile.lock
190
+ - gemfiles/dry_validation_1.x.gemfile
191
+ - gemfiles/dry_validation_1.x.gemfile.lock
172
192
  - lib/api_client_base.rb
173
193
  - lib/api_client_base/base.rb
174
194
  - lib/api_client_base/base/class_methods.rb
@@ -200,7 +220,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
200
220
  - !ruby/object:Gem::Version
201
221
  version: '0'
202
222
  requirements: []
203
- rubygems_version: 3.0.8
223
+ rubygems_version: 3.1.6
204
224
  signing_key:
205
225
  specification_version: 4
206
226
  summary: Abstractions to help author API wrappers in Ruby.
data/.travis.yml DELETED
@@ -1,5 +0,0 @@
1
- sudo: false
2
- language: ruby
3
- rvm:
4
- - 2.6.3
5
- before_install: gem install bundler -v 2.1.4