scorpio 0.4.5 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +13 -0
- data/LICENSE.md +613 -0
- data/README.md +31 -18
- data/documents/github.com/OAI/OpenAPI-Specification/blob/oas3-schema/schemas/v3.0/schema.yaml +30 -22
- data/lib/scorpio/google_api_document.rb +27 -15
- data/lib/scorpio/openapi/document.rb +8 -6
- data/lib/scorpio/openapi/operation.rb +92 -42
- data/lib/scorpio/openapi/operations_scope.rb +13 -11
- data/lib/scorpio/openapi/reference.rb +44 -0
- data/lib/scorpio/openapi/tag.rb +15 -0
- data/lib/scorpio/openapi/v3/server.rb +4 -2
- data/lib/scorpio/openapi.rb +186 -135
- data/lib/scorpio/pickle_adapter.rb +2 -0
- data/lib/scorpio/request.rb +60 -41
- data/lib/scorpio/resource_base.rb +238 -198
- data/lib/scorpio/response.rb +10 -6
- data/lib/scorpio/ur.rb +16 -15
- data/lib/scorpio/version.rb +3 -1
- data/lib/scorpio.rb +5 -6
- data/scorpio.gemspec +16 -23
- metadata +23 -206
- data/.simplecov +0 -1
- data/LICENSE.txt +0 -21
- data/Rakefile +0 -10
- data/bin/documents_to_yml.rb +0 -33
data/lib/scorpio.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require "scorpio/version"
|
2
4
|
require "jsi"
|
3
5
|
require "ur"
|
@@ -20,12 +22,9 @@ module Scorpio
|
|
20
22
|
|
21
23
|
proc { |v| define_singleton_method(:error_classes_by_status) { v } }.call({})
|
22
24
|
# Scorpio::Error encompasses certain Scorpio-defined errors encountered in using Scorpio.
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
# [^1]: unless I have, since writing this, implemented other things but forgotten to update this
|
27
|
-
# comment, which does seem likely enough.
|
28
|
-
class Error < StandardError; end
|
25
|
+
class Error < StandardError
|
26
|
+
end
|
27
|
+
|
29
28
|
class HTTPError < Error
|
30
29
|
# for HTTPError subclasses representing a single status, sets and/or returns the represented status.
|
31
30
|
#
|
data/scorpio.gemspec
CHANGED
@@ -12,29 +12,22 @@ Gem::Specification.new do |spec|
|
|
12
12
|
spec.summary = 'Scorpio REST client'
|
13
13
|
spec.description = 'ORM style REST client'
|
14
14
|
spec.homepage = "https://github.com/notEthan/scorpio"
|
15
|
-
spec.license = "
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
15
|
+
spec.license = "AGPL-3.0"
|
16
|
+
|
17
|
+
spec.files = [
|
18
|
+
'LICENSE.md',
|
19
|
+
'CHANGELOG.md',
|
20
|
+
'README.md',
|
21
|
+
'.yardopts',
|
22
|
+
'scorpio.gemspec',
|
23
|
+
*Dir['lib/**/*'],
|
24
|
+
*Dir['documents/**/*'],
|
25
|
+
].reject { |f| File.lstat(f).ftype == 'directory' }
|
26
|
+
|
21
27
|
spec.require_paths = ["lib"]
|
22
28
|
|
23
|
-
spec.add_dependency "jsi", "~> 0.
|
24
|
-
spec.add_dependency "ur", "~> 0.1
|
25
|
-
spec.add_dependency "faraday"
|
26
|
-
spec.
|
27
|
-
spec.add_development_dependency "minitest", "~> 5.0"
|
28
|
-
spec.add_development_dependency "minitest-around"
|
29
|
-
spec.add_development_dependency "minitest-reporters"
|
30
|
-
spec.add_development_dependency "sinatra", "~> 1.0"
|
31
|
-
spec.add_development_dependency "rack", "~> 1.0"
|
32
|
-
spec.add_development_dependency "rack-accept"
|
33
|
-
spec.add_development_dependency "rack-test"
|
34
|
-
spec.add_development_dependency "api_hammer"
|
35
|
-
spec.add_development_dependency "activerecord"
|
36
|
-
spec.add_development_dependency "sqlite3", "~> 1.3.6" # loosen this in accordance with active_record/connection_adapters/sqlite3_adapter.rb
|
37
|
-
spec.add_development_dependency "database_cleaner"
|
38
|
-
spec.add_development_dependency "simplecov"
|
39
|
-
spec.add_development_dependency "yard"
|
29
|
+
spec.add_dependency "jsi", "~> 0.6.0"
|
30
|
+
spec.add_dependency "ur", "~> 0.2.1"
|
31
|
+
spec.add_dependency "faraday", "< 2.0"
|
32
|
+
spec.add_dependency "addressable", '~> 2.3'
|
40
33
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: scorpio
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ethan
|
8
|
-
autorequire:
|
9
|
-
bindir:
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-02-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jsi
|
@@ -16,238 +16,56 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.
|
19
|
+
version: 0.6.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.
|
26
|
+
version: 0.6.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: ur
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.1
|
33
|
+
version: 0.2.1
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0.1
|
40
|
+
version: 0.2.1
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: faraday
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - "<"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '0'
|
47
|
+
version: '2.0'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - "
|
52
|
+
- - "<"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '0'
|
54
|
+
version: '2.0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: addressable
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
62
|
-
type: :
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - "~>"
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '10.0'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: minitest
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - "~>"
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: '5.0'
|
76
|
-
type: :development
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - "~>"
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: '5.0'
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: minitest-around
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - ">="
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: '0'
|
90
|
-
type: :development
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - ">="
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: '0'
|
97
|
-
- !ruby/object:Gem::Dependency
|
98
|
-
name: minitest-reporters
|
99
|
-
requirement: !ruby/object:Gem::Requirement
|
100
|
-
requirements:
|
101
|
-
- - ">="
|
102
|
-
- !ruby/object:Gem::Version
|
103
|
-
version: '0'
|
104
|
-
type: :development
|
105
|
-
prerelease: false
|
106
|
-
version_requirements: !ruby/object:Gem::Requirement
|
107
|
-
requirements:
|
108
|
-
- - ">="
|
109
|
-
- !ruby/object:Gem::Version
|
110
|
-
version: '0'
|
111
|
-
- !ruby/object:Gem::Dependency
|
112
|
-
name: sinatra
|
113
|
-
requirement: !ruby/object:Gem::Requirement
|
114
|
-
requirements:
|
115
|
-
- - "~>"
|
116
|
-
- !ruby/object:Gem::Version
|
117
|
-
version: '1.0'
|
118
|
-
type: :development
|
119
|
-
prerelease: false
|
120
|
-
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
requirements:
|
122
|
-
- - "~>"
|
123
|
-
- !ruby/object:Gem::Version
|
124
|
-
version: '1.0'
|
125
|
-
- !ruby/object:Gem::Dependency
|
126
|
-
name: rack
|
127
|
-
requirement: !ruby/object:Gem::Requirement
|
128
|
-
requirements:
|
129
|
-
- - "~>"
|
130
|
-
- !ruby/object:Gem::Version
|
131
|
-
version: '1.0'
|
132
|
-
type: :development
|
133
|
-
prerelease: false
|
134
|
-
version_requirements: !ruby/object:Gem::Requirement
|
135
|
-
requirements:
|
136
|
-
- - "~>"
|
137
|
-
- !ruby/object:Gem::Version
|
138
|
-
version: '1.0'
|
139
|
-
- !ruby/object:Gem::Dependency
|
140
|
-
name: rack-accept
|
141
|
-
requirement: !ruby/object:Gem::Requirement
|
142
|
-
requirements:
|
143
|
-
- - ">="
|
144
|
-
- !ruby/object:Gem::Version
|
145
|
-
version: '0'
|
146
|
-
type: :development
|
147
|
-
prerelease: false
|
148
|
-
version_requirements: !ruby/object:Gem::Requirement
|
149
|
-
requirements:
|
150
|
-
- - ">="
|
151
|
-
- !ruby/object:Gem::Version
|
152
|
-
version: '0'
|
153
|
-
- !ruby/object:Gem::Dependency
|
154
|
-
name: rack-test
|
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'
|
167
|
-
- !ruby/object:Gem::Dependency
|
168
|
-
name: api_hammer
|
169
|
-
requirement: !ruby/object:Gem::Requirement
|
170
|
-
requirements:
|
171
|
-
- - ">="
|
172
|
-
- !ruby/object:Gem::Version
|
173
|
-
version: '0'
|
174
|
-
type: :development
|
175
|
-
prerelease: false
|
176
|
-
version_requirements: !ruby/object:Gem::Requirement
|
177
|
-
requirements:
|
178
|
-
- - ">="
|
179
|
-
- !ruby/object:Gem::Version
|
180
|
-
version: '0'
|
181
|
-
- !ruby/object:Gem::Dependency
|
182
|
-
name: activerecord
|
183
|
-
requirement: !ruby/object:Gem::Requirement
|
184
|
-
requirements:
|
185
|
-
- - ">="
|
186
|
-
- !ruby/object:Gem::Version
|
187
|
-
version: '0'
|
188
|
-
type: :development
|
189
|
-
prerelease: false
|
190
|
-
version_requirements: !ruby/object:Gem::Requirement
|
191
|
-
requirements:
|
192
|
-
- - ">="
|
193
|
-
- !ruby/object:Gem::Version
|
194
|
-
version: '0'
|
195
|
-
- !ruby/object:Gem::Dependency
|
196
|
-
name: sqlite3
|
197
|
-
requirement: !ruby/object:Gem::Requirement
|
198
|
-
requirements:
|
199
|
-
- - "~>"
|
200
|
-
- !ruby/object:Gem::Version
|
201
|
-
version: 1.3.6
|
202
|
-
type: :development
|
61
|
+
version: '2.3'
|
62
|
+
type: :runtime
|
203
63
|
prerelease: false
|
204
64
|
version_requirements: !ruby/object:Gem::Requirement
|
205
65
|
requirements:
|
206
66
|
- - "~>"
|
207
67
|
- !ruby/object:Gem::Version
|
208
|
-
version:
|
209
|
-
- !ruby/object:Gem::Dependency
|
210
|
-
name: database_cleaner
|
211
|
-
requirement: !ruby/object:Gem::Requirement
|
212
|
-
requirements:
|
213
|
-
- - ">="
|
214
|
-
- !ruby/object:Gem::Version
|
215
|
-
version: '0'
|
216
|
-
type: :development
|
217
|
-
prerelease: false
|
218
|
-
version_requirements: !ruby/object:Gem::Requirement
|
219
|
-
requirements:
|
220
|
-
- - ">="
|
221
|
-
- !ruby/object:Gem::Version
|
222
|
-
version: '0'
|
223
|
-
- !ruby/object:Gem::Dependency
|
224
|
-
name: simplecov
|
225
|
-
requirement: !ruby/object:Gem::Requirement
|
226
|
-
requirements:
|
227
|
-
- - ">="
|
228
|
-
- !ruby/object:Gem::Version
|
229
|
-
version: '0'
|
230
|
-
type: :development
|
231
|
-
prerelease: false
|
232
|
-
version_requirements: !ruby/object:Gem::Requirement
|
233
|
-
requirements:
|
234
|
-
- - ">="
|
235
|
-
- !ruby/object:Gem::Version
|
236
|
-
version: '0'
|
237
|
-
- !ruby/object:Gem::Dependency
|
238
|
-
name: yard
|
239
|
-
requirement: !ruby/object:Gem::Requirement
|
240
|
-
requirements:
|
241
|
-
- - ">="
|
242
|
-
- !ruby/object:Gem::Version
|
243
|
-
version: '0'
|
244
|
-
type: :development
|
245
|
-
prerelease: false
|
246
|
-
version_requirements: !ruby/object:Gem::Requirement
|
247
|
-
requirements:
|
248
|
-
- - ">="
|
249
|
-
- !ruby/object:Gem::Version
|
250
|
-
version: '0'
|
68
|
+
version: '2.3'
|
251
69
|
description: ORM style REST client
|
252
70
|
email:
|
253
71
|
- ethan@unth.net
|
@@ -255,13 +73,10 @@ executables: []
|
|
255
73
|
extensions: []
|
256
74
|
extra_rdoc_files: []
|
257
75
|
files:
|
258
|
-
- ".simplecov"
|
259
76
|
- ".yardopts"
|
260
77
|
- CHANGELOG.md
|
261
|
-
- LICENSE.
|
78
|
+
- LICENSE.md
|
262
79
|
- README.md
|
263
|
-
- Rakefile
|
264
|
-
- bin/documents_to_yml.rb
|
265
80
|
- documents/github.com/OAI/OpenAPI-Specification/blob/oas3-schema/schemas/v3.0/schema.yaml
|
266
81
|
- documents/swagger.io/v2/schema.json
|
267
82
|
- documents/swagger.io/v2/schema.yml
|
@@ -273,6 +88,8 @@ files:
|
|
273
88
|
- lib/scorpio/openapi/document.rb
|
274
89
|
- lib/scorpio/openapi/operation.rb
|
275
90
|
- lib/scorpio/openapi/operations_scope.rb
|
91
|
+
- lib/scorpio/openapi/reference.rb
|
92
|
+
- lib/scorpio/openapi/tag.rb
|
276
93
|
- lib/scorpio/openapi/v3/server.rb
|
277
94
|
- lib/scorpio/pickle_adapter.rb
|
278
95
|
- lib/scorpio/request.rb
|
@@ -283,9 +100,9 @@ files:
|
|
283
100
|
- scorpio.gemspec
|
284
101
|
homepage: https://github.com/notEthan/scorpio
|
285
102
|
licenses:
|
286
|
-
-
|
103
|
+
- AGPL-3.0
|
287
104
|
metadata: {}
|
288
|
-
post_install_message:
|
105
|
+
post_install_message:
|
289
106
|
rdoc_options: []
|
290
107
|
require_paths:
|
291
108
|
- lib
|
@@ -300,8 +117,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
300
117
|
- !ruby/object:Gem::Version
|
301
118
|
version: '0'
|
302
119
|
requirements: []
|
303
|
-
rubygems_version: 3.
|
304
|
-
signing_key:
|
120
|
+
rubygems_version: 3.1.2
|
121
|
+
signing_key:
|
305
122
|
specification_version: 4
|
306
123
|
summary: Scorpio REST client
|
307
124
|
test_files: []
|
data/.simplecov
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
SimpleCov.start
|
data/LICENSE.txt
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
The MIT License (MIT)
|
2
|
-
|
3
|
-
Copyright (c) 2016 Ethan
|
4
|
-
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
7
|
-
in the Software without restriction, including without limitation the rights
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
10
|
-
furnished to do so, subject to the following conditions:
|
11
|
-
|
12
|
-
The above copyright notice and this permission notice shall be included in
|
13
|
-
all copies or substantial portions of the Software.
|
14
|
-
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
-
THE SOFTWARE.
|
data/Rakefile
DELETED
data/bin/documents_to_yml.rb
DELETED
@@ -1,33 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require 'pathname'
|
4
|
-
require 'json'
|
5
|
-
require 'yaml'
|
6
|
-
|
7
|
-
root = Pathname.new(__FILE__).dirname.join('..')
|
8
|
-
|
9
|
-
document_dirs = [root.join('documents'), root.join('test/documents')]
|
10
|
-
documents = document_dirs.map { |d| Pathname.glob(d.join('**/*')) }.inject([], &:+)
|
11
|
-
json_documents = documents.select { |p| p.file? && !['.yml', '.yaml'].include?(p.extname) }
|
12
|
-
|
13
|
-
json_documents.each do |file|
|
14
|
-
begin
|
15
|
-
json_contents = JSON.parse(file.read)
|
16
|
-
yaml = YAML.dump(json_contents, line_width: -1)
|
17
|
-
yaml_filepath = Pathname.new(file.to_path.chomp('.json') + '.yml')
|
18
|
-
if yaml_filepath.exist?
|
19
|
-
contents = yaml_filepath.read
|
20
|
-
if contents == yaml
|
21
|
-
puts "#{yaml_filepath.to_path} unchanged"
|
22
|
-
else
|
23
|
-
yaml_filepath.write(yaml)
|
24
|
-
puts "#{yaml_filepath.to_path} changed; updated"
|
25
|
-
end
|
26
|
-
else
|
27
|
-
yaml_filepath.write(yaml)
|
28
|
-
puts "#{yaml_filepath.to_path} created"
|
29
|
-
end
|
30
|
-
rescue JSON::ParserError
|
31
|
-
puts "#{file.to_path}: not json"
|
32
|
-
end
|
33
|
-
end
|