kosapi_client 0.13.0 → 0.14.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -11
- data/kosapi_client.gemspec +9 -12
- data/lib/kosapi_client/entity/link.rb +8 -2
- data/lib/kosapi_client/oauth2_http_adapter.rb +1 -1
- data/lib/kosapi_client/request_builder_delegator.rb +62 -25
- data/lib/kosapi_client/version.rb +1 -1
- data/lib/kosapi_client.rb +0 -1
- metadata +37 -73
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 61088283521ad7523da40145d94966e01b5055e857ebac8770bc706be0ae0a30
|
4
|
+
data.tar.gz: ff3314eb5fbe7a71c00ba832ef849d302f07148d0513dd2a0eecd6f2c358f6d8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 04f18b7afdcbbca5814e11dee949b56f8f72f8af4ae6e15c1824383abd9f33dedefab497ec2abdbc1a2f45eb3062bdc26b030cd3cfe15668b829a1d98e7f8c38
|
7
|
+
data.tar.gz: f6809d741d7a69d8b07fd316a9c9253126e3766a9e4d2a3d7b774a19d655bee74dc36f2e2908dad7586123cec1796ad024c919771a778ee4ef720d303710b036
|
data/README.md
CHANGED
@@ -1,18 +1,9 @@
|
|
1
1
|
# KOSapi Client
|
2
2
|
|
3
|
-
[![Gem Version](https://img.shields.io/gem/v/kosapi_client.svg)](rubygems)
|
4
|
-
[![Build Status](
|
5
|
-
[![Dependency Status](http://img.shields.io/gemnasium/cvut/kosapi_client.rb.svg)][gemnasium]
|
6
|
-
[![Code Climate](http://img.shields.io/codeclimate/github/cvut/kosapi_client.rb.svg)][codeclimate]
|
7
|
-
[![Coverage Status](https://img.shields.io/coveralls/cvut/kosapi_client.rb.svg)][coveralls]
|
3
|
+
[![Gem Version](https://img.shields.io/gem/v/kosapi_client.svg)](https://rubygems.org/gems/kosapi_client)
|
4
|
+
[![Build Status](https://github.com/cvut/kosapi_client.rb/workflows/CI/badge.svg)](https://github.com/cvut/kosapi_client.rb/actions?query=workflow%3A%22CI%22)
|
8
5
|
[![Inline docs](http://inch-ci.org/github/cvut/kosapi_client.rb.svg)](http://inch-ci.org/github/cvut/kosapi_client.rb)
|
9
6
|
|
10
|
-
[rubygems]: https://rubygems.org/gems/kosapi_client
|
11
|
-
[travis]: http://travis-ci.org/cvut/kosapi_client.rb
|
12
|
-
[gemnasium]: https://gemnasium.com/cvut/kosapi_client.rb
|
13
|
-
[codeclimate]: https://codeclimate.com/github/cvut/kosapi_client.rb
|
14
|
-
[coveralls]: https://coveralls.io/r/cvut/kosapi_client.rb
|
15
|
-
|
16
7
|
A simple Ruby client library for [KOSapi RESTful service](https://kosapi.fit.cvut.cz).
|
17
8
|
|
18
9
|
## Installation
|
data/kosapi_client.gemspec
CHANGED
@@ -4,7 +4,7 @@ require File.expand_path('../lib/kosapi_client/version', __FILE__)
|
|
4
4
|
Gem::Specification.new do |spec|
|
5
5
|
spec.name = 'kosapi_client'
|
6
6
|
spec.version = KOSapiClient::VERSION
|
7
|
-
spec.authors = ['Tibor Szolár']
|
7
|
+
spec.authors = ['Tibor Szolár', 'Jakub Jirutka']
|
8
8
|
spec.email = 'szolatib@fit.cvut.cz'
|
9
9
|
spec.description = 'REST client for KOSapi service'
|
10
10
|
spec.summary = 'Simple Ruby client library for accessing KOSapi service resources'
|
@@ -17,21 +17,18 @@ Gem::Specification.new do |spec|
|
|
17
17
|
spec.required_ruby_version = '>= 2.0.0'
|
18
18
|
|
19
19
|
spec.add_development_dependency 'bundler', '~> 2.0'
|
20
|
-
spec.add_development_dependency 'rake'
|
21
|
-
spec.add_development_dependency 'rspec'
|
22
|
-
spec.add_development_dependency 'rspec-given'
|
23
|
-
spec.add_development_dependency 'dotenv'
|
20
|
+
spec.add_development_dependency 'rake', '~> 13.0'
|
21
|
+
spec.add_development_dependency 'rspec', '~> 3.9'
|
22
|
+
spec.add_development_dependency 'rspec-given', '~> 3.8'
|
23
|
+
spec.add_development_dependency 'dotenv', '~> 2.7'
|
24
24
|
spec.add_development_dependency 'vcr', '~> 3.0'
|
25
|
-
spec.add_development_dependency '
|
26
|
-
spec.add_development_dependency 'guard-rspec'
|
27
|
-
spec.add_development_dependency 'coveralls'
|
25
|
+
spec.add_development_dependency 'guard-rspec', '~> 4.7'
|
28
26
|
spec.add_development_dependency 'fuubar', '~> 2.2.0'
|
29
|
-
spec.add_development_dependency 'simplecov'
|
27
|
+
spec.add_development_dependency 'simplecov', '~> 0.12'
|
30
28
|
|
31
|
-
spec.add_runtime_dependency 'oauth2', '~>
|
32
|
-
spec.add_runtime_dependency 'faraday', '
|
29
|
+
spec.add_runtime_dependency 'oauth2', '~> 2.0'
|
30
|
+
spec.add_runtime_dependency 'faraday', '>= 0.9', '< 3.0'
|
33
31
|
spec.add_runtime_dependency 'corefines', '~> 1.6'
|
34
|
-
spec.add_runtime_dependency 'escape_utils', '~> 1.0' unless RUBY_PLATFORM == 'java' # used for uri_template
|
35
32
|
spec.add_runtime_dependency 'uri_template', '~> 0.7.0'
|
36
33
|
# Required for correct XML namespace handling (MultiXML, oauth2).
|
37
34
|
spec.add_runtime_dependency 'ox', '~> 2.1'
|
@@ -37,8 +37,14 @@ module KOSapiClient
|
|
37
37
|
{ href: link_href, rel: link_rel, title: link_title }
|
38
38
|
end
|
39
39
|
|
40
|
-
|
41
|
-
|
40
|
+
if RUBY_VERSION >= '3.0'
|
41
|
+
def method_missing(method, *args, **kwargs, &block)
|
42
|
+
target.send(method, *args, **kwargs, &block)
|
43
|
+
end
|
44
|
+
else
|
45
|
+
def method_missing(method, *args, &block)
|
46
|
+
target.send(method, *args, &block)
|
47
|
+
end
|
42
48
|
end
|
43
49
|
|
44
50
|
def respond_to_missing?(method_name, include_private = false)
|
@@ -8,14 +8,6 @@ module KOSapiClient
|
|
8
8
|
|
9
9
|
alias :super_method_missing :method_missing
|
10
10
|
|
11
|
-
def method_missing(method, *args, &block)
|
12
|
-
if @response
|
13
|
-
delegate_to_response(method, *args, &block)
|
14
|
-
else
|
15
|
-
delegate_to_builder(method, *args, &block)
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
11
|
def respond_to_missing?(method, include_all)
|
20
12
|
if @response
|
21
13
|
@response.respond_to?(method, include_all)
|
@@ -24,27 +16,72 @@ module KOSapiClient
|
|
24
16
|
end
|
25
17
|
end
|
26
18
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
19
|
+
if RUBY_VERSION >= '3.0'
|
20
|
+
def method_missing(method, *args, **kwargs, &block)
|
21
|
+
if @response
|
22
|
+
delegate_to_response(method, *args, **kwargs, &block)
|
23
|
+
else
|
24
|
+
delegate_to_builder(method, *args, **kwargs, &block)
|
25
|
+
end
|
33
26
|
end
|
34
|
-
end
|
35
27
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
if
|
40
|
-
|
28
|
+
private
|
29
|
+
|
30
|
+
def delegate_to_response(method, *args, **kwargs, &block)
|
31
|
+
if @response.respond_to?(method)
|
32
|
+
@response.send(method, *args, **kwargs, &block)
|
41
33
|
else
|
42
|
-
|
34
|
+
super_method_missing(method, *args, **kwargs)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def delegate_to_builder(method, *args, **kwargs, &block)
|
39
|
+
if @request_builder.respond_to?(method)
|
40
|
+
res = @request_builder.send(method, *args, **kwargs, &block)
|
41
|
+
if res.equal?(@request_builder)
|
42
|
+
self
|
43
|
+
else
|
44
|
+
res
|
45
|
+
end
|
46
|
+
else
|
47
|
+
@request_builder.finalize
|
48
|
+
@response = @request_builder.response
|
49
|
+
delegate_to_response(method, *args, **kwargs, &block)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
else # RUBY_VERSION < '3.0'
|
54
|
+
def method_missing(method, *args, &block)
|
55
|
+
if @response
|
56
|
+
delegate_to_response(method, *args, &block)
|
57
|
+
else
|
58
|
+
delegate_to_builder(method, *args, &block)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
private
|
63
|
+
|
64
|
+
def delegate_to_response(method, *args, &block)
|
65
|
+
if @response.respond_to?(method)
|
66
|
+
@response.send(method, *args, &block)
|
67
|
+
else
|
68
|
+
super_method_missing(method, *args)
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
def delegate_to_builder(method, *args, &block)
|
73
|
+
if @request_builder.respond_to?(method)
|
74
|
+
res = @request_builder.send(method, *args, &block)
|
75
|
+
if res.equal?(@request_builder)
|
76
|
+
self
|
77
|
+
else
|
78
|
+
res
|
79
|
+
end
|
80
|
+
else
|
81
|
+
@request_builder.finalize
|
82
|
+
@response = @request_builder.response
|
83
|
+
delegate_to_response(method, *args, &block)
|
43
84
|
end
|
44
|
-
else
|
45
|
-
@request_builder.finalize
|
46
|
-
@response = @request_builder.response
|
47
|
-
delegate_to_response(method, *args, &block)
|
48
85
|
end
|
49
86
|
end
|
50
87
|
|
data/lib/kosapi_client.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kosapi_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.14.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tibor Szolár
|
8
|
+
- Jakub Jirutka
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date:
|
12
|
+
date: 2022-09-14 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: bundler
|
@@ -28,58 +29,58 @@ dependencies:
|
|
28
29
|
name: rake
|
29
30
|
requirement: !ruby/object:Gem::Requirement
|
30
31
|
requirements:
|
31
|
-
- - "
|
32
|
+
- - "~>"
|
32
33
|
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
34
|
+
version: '13.0'
|
34
35
|
type: :development
|
35
36
|
prerelease: false
|
36
37
|
version_requirements: !ruby/object:Gem::Requirement
|
37
38
|
requirements:
|
38
|
-
- - "
|
39
|
+
- - "~>"
|
39
40
|
- !ruby/object:Gem::Version
|
40
|
-
version: '0'
|
41
|
+
version: '13.0'
|
41
42
|
- !ruby/object:Gem::Dependency
|
42
43
|
name: rspec
|
43
44
|
requirement: !ruby/object:Gem::Requirement
|
44
45
|
requirements:
|
45
|
-
- - "
|
46
|
+
- - "~>"
|
46
47
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
48
|
+
version: '3.9'
|
48
49
|
type: :development
|
49
50
|
prerelease: false
|
50
51
|
version_requirements: !ruby/object:Gem::Requirement
|
51
52
|
requirements:
|
52
|
-
- - "
|
53
|
+
- - "~>"
|
53
54
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
55
|
+
version: '3.9'
|
55
56
|
- !ruby/object:Gem::Dependency
|
56
57
|
name: rspec-given
|
57
58
|
requirement: !ruby/object:Gem::Requirement
|
58
59
|
requirements:
|
59
|
-
- - "
|
60
|
+
- - "~>"
|
60
61
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
62
|
+
version: '3.8'
|
62
63
|
type: :development
|
63
64
|
prerelease: false
|
64
65
|
version_requirements: !ruby/object:Gem::Requirement
|
65
66
|
requirements:
|
66
|
-
- - "
|
67
|
+
- - "~>"
|
67
68
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
69
|
+
version: '3.8'
|
69
70
|
- !ruby/object:Gem::Dependency
|
70
71
|
name: dotenv
|
71
72
|
requirement: !ruby/object:Gem::Requirement
|
72
73
|
requirements:
|
73
|
-
- - "
|
74
|
+
- - "~>"
|
74
75
|
- !ruby/object:Gem::Version
|
75
|
-
version: '
|
76
|
+
version: '2.7'
|
76
77
|
type: :development
|
77
78
|
prerelease: false
|
78
79
|
version_requirements: !ruby/object:Gem::Requirement
|
79
80
|
requirements:
|
80
|
-
- - "
|
81
|
+
- - "~>"
|
81
82
|
- !ruby/object:Gem::Version
|
82
|
-
version: '
|
83
|
+
version: '2.7'
|
83
84
|
- !ruby/object:Gem::Dependency
|
84
85
|
name: vcr
|
85
86
|
requirement: !ruby/object:Gem::Requirement
|
@@ -95,47 +96,19 @@ dependencies:
|
|
95
96
|
- !ruby/object:Gem::Version
|
96
97
|
version: '3.0'
|
97
98
|
- !ruby/object:Gem::Dependency
|
98
|
-
name:
|
99
|
+
name: guard-rspec
|
99
100
|
requirement: !ruby/object:Gem::Requirement
|
100
101
|
requirements:
|
101
102
|
- - "~>"
|
102
103
|
- !ruby/object:Gem::Version
|
103
|
-
version:
|
104
|
+
version: '4.7'
|
104
105
|
type: :development
|
105
106
|
prerelease: false
|
106
107
|
version_requirements: !ruby/object:Gem::Requirement
|
107
108
|
requirements:
|
108
109
|
- - "~>"
|
109
110
|
- !ruby/object:Gem::Version
|
110
|
-
version:
|
111
|
-
- !ruby/object:Gem::Dependency
|
112
|
-
name: guard-rspec
|
113
|
-
requirement: !ruby/object:Gem::Requirement
|
114
|
-
requirements:
|
115
|
-
- - ">="
|
116
|
-
- !ruby/object:Gem::Version
|
117
|
-
version: '0'
|
118
|
-
type: :development
|
119
|
-
prerelease: false
|
120
|
-
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
requirements:
|
122
|
-
- - ">="
|
123
|
-
- !ruby/object:Gem::Version
|
124
|
-
version: '0'
|
125
|
-
- !ruby/object:Gem::Dependency
|
126
|
-
name: coveralls
|
127
|
-
requirement: !ruby/object:Gem::Requirement
|
128
|
-
requirements:
|
129
|
-
- - ">="
|
130
|
-
- !ruby/object:Gem::Version
|
131
|
-
version: '0'
|
132
|
-
type: :development
|
133
|
-
prerelease: false
|
134
|
-
version_requirements: !ruby/object:Gem::Requirement
|
135
|
-
requirements:
|
136
|
-
- - ">="
|
137
|
-
- !ruby/object:Gem::Version
|
138
|
-
version: '0'
|
111
|
+
version: '4.7'
|
139
112
|
- !ruby/object:Gem::Dependency
|
140
113
|
name: fuubar
|
141
114
|
requirement: !ruby/object:Gem::Requirement
|
@@ -154,44 +127,50 @@ dependencies:
|
|
154
127
|
name: simplecov
|
155
128
|
requirement: !ruby/object:Gem::Requirement
|
156
129
|
requirements:
|
157
|
-
- - "
|
130
|
+
- - "~>"
|
158
131
|
- !ruby/object:Gem::Version
|
159
|
-
version: '0'
|
132
|
+
version: '0.12'
|
160
133
|
type: :development
|
161
134
|
prerelease: false
|
162
135
|
version_requirements: !ruby/object:Gem::Requirement
|
163
136
|
requirements:
|
164
|
-
- - "
|
137
|
+
- - "~>"
|
165
138
|
- !ruby/object:Gem::Version
|
166
|
-
version: '0'
|
139
|
+
version: '0.12'
|
167
140
|
- !ruby/object:Gem::Dependency
|
168
141
|
name: oauth2
|
169
142
|
requirement: !ruby/object:Gem::Requirement
|
170
143
|
requirements:
|
171
144
|
- - "~>"
|
172
145
|
- !ruby/object:Gem::Version
|
173
|
-
version: '
|
146
|
+
version: '2.0'
|
174
147
|
type: :runtime
|
175
148
|
prerelease: false
|
176
149
|
version_requirements: !ruby/object:Gem::Requirement
|
177
150
|
requirements:
|
178
151
|
- - "~>"
|
179
152
|
- !ruby/object:Gem::Version
|
180
|
-
version: '
|
153
|
+
version: '2.0'
|
181
154
|
- !ruby/object:Gem::Dependency
|
182
155
|
name: faraday
|
183
156
|
requirement: !ruby/object:Gem::Requirement
|
184
157
|
requirements:
|
185
|
-
- - "
|
158
|
+
- - ">="
|
186
159
|
- !ruby/object:Gem::Version
|
187
160
|
version: '0.9'
|
161
|
+
- - "<"
|
162
|
+
- !ruby/object:Gem::Version
|
163
|
+
version: '3.0'
|
188
164
|
type: :runtime
|
189
165
|
prerelease: false
|
190
166
|
version_requirements: !ruby/object:Gem::Requirement
|
191
167
|
requirements:
|
192
|
-
- - "
|
168
|
+
- - ">="
|
193
169
|
- !ruby/object:Gem::Version
|
194
170
|
version: '0.9'
|
171
|
+
- - "<"
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: '3.0'
|
195
174
|
- !ruby/object:Gem::Dependency
|
196
175
|
name: corefines
|
197
176
|
requirement: !ruby/object:Gem::Requirement
|
@@ -206,20 +185,6 @@ dependencies:
|
|
206
185
|
- - "~>"
|
207
186
|
- !ruby/object:Gem::Version
|
208
187
|
version: '1.6'
|
209
|
-
- !ruby/object:Gem::Dependency
|
210
|
-
name: escape_utils
|
211
|
-
requirement: !ruby/object:Gem::Requirement
|
212
|
-
requirements:
|
213
|
-
- - "~>"
|
214
|
-
- !ruby/object:Gem::Version
|
215
|
-
version: '1.0'
|
216
|
-
type: :runtime
|
217
|
-
prerelease: false
|
218
|
-
version_requirements: !ruby/object:Gem::Requirement
|
219
|
-
requirements:
|
220
|
-
- - "~>"
|
221
|
-
- !ruby/object:Gem::Version
|
222
|
-
version: '1.0'
|
223
188
|
- !ruby/object:Gem::Dependency
|
224
189
|
name: uri_template
|
225
190
|
requirement: !ruby/object:Gem::Requirement
|
@@ -324,8 +289,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
324
289
|
- !ruby/object:Gem::Version
|
325
290
|
version: '0'
|
326
291
|
requirements: []
|
327
|
-
|
328
|
-
rubygems_version: 2.7.6.2
|
292
|
+
rubygems_version: 3.1.6
|
329
293
|
signing_key:
|
330
294
|
specification_version: 4
|
331
295
|
summary: Simple Ruby client library for accessing KOSapi service resources
|