my_api_client 0.26.0 → 0.27.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +5 -5
- data/.rubocop.yml +1 -1
- data/.rubocop_todo.yml +15 -4
- data/CHANGELOG.md +40 -0
- data/Gemfile.lock +38 -26
- data/README.jp.md +7 -7
- data/README.md +5 -5
- data/lib/my_api_client/request/basic.rb +10 -2
- data/lib/my_api_client/service_abstract.rb +2 -2
- data/lib/my_api_client/version.rb +1 -1
- data/my_api/.ruby-version +1 -1
- data/my_api/Gemfile +2 -2
- data/my_api/Gemfile.lock +70 -69
- data/my_api/public/index.html +2 -2
- data/my_api_client.gemspec +2 -2
- metadata +6 -38
- data/gemfiles/rails_6.0.gemfile +0 -16
- data/rails_app/rails_6.0/.rspec +0 -3
- data/rails_app/rails_6.0/Gemfile +0 -18
- data/rails_app/rails_6.0/Gemfile.lock +0 -188
- data/rails_app/rails_6.0/README.md +0 -24
- data/rails_app/rails_6.0/Rakefile +0 -8
- data/rails_app/rails_6.0/app/controllers/application_controller.rb +0 -4
- data/rails_app/rails_6.0/app/jobs/application_job.rb +0 -9
- data/rails_app/rails_6.0/bin/rails +0 -6
- data/rails_app/rails_6.0/bin/rake +0 -6
- data/rails_app/rails_6.0/bin/setup +0 -27
- data/rails_app/rails_6.0/config/application.rb +0 -39
- data/rails_app/rails_6.0/config/boot.rb +0 -6
- data/rails_app/rails_6.0/config/credentials.yml.enc +0 -1
- data/rails_app/rails_6.0/config/environment.rb +0 -7
- data/rails_app/rails_6.0/config/environments/development.rb +0 -39
- data/rails_app/rails_6.0/config/environments/production.rb +0 -90
- data/rails_app/rails_6.0/config/environments/test.rb +0 -41
- data/rails_app/rails_6.0/config/initializers/application_controller_renderer.rb +0 -9
- data/rails_app/rails_6.0/config/initializers/backtrace_silencers.rb +0 -8
- data/rails_app/rails_6.0/config/initializers/cors.rb +0 -17
- data/rails_app/rails_6.0/config/initializers/filter_parameter_logging.rb +0 -6
- data/rails_app/rails_6.0/config/initializers/inflections.rb +0 -17
- data/rails_app/rails_6.0/config/initializers/mime_types.rb +0 -5
- data/rails_app/rails_6.0/config/initializers/wrap_parameters.rb +0 -11
- data/rails_app/rails_6.0/config/locales/en.yml +0 -33
- data/rails_app/rails_6.0/config/routes.rb +0 -5
- data/rails_app/rails_6.0/config/spring.rb +0 -8
- data/rails_app/rails_6.0/config.ru +0 -7
- data/rails_app/rails_6.0/public/robots.txt +0 -1
- data/rails_app/rails_6.0/spec/rails_helper.rb +0 -14
- data/rails_app/rails_6.0/spec/spec_helper.rb +0 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a6c7a66724037e300c85085d014dbbe0c71771339c8de4d6c48743ae31dcd534
|
4
|
+
data.tar.gz: eecb78a1be508ec4a84719686f1ae5895d6e86794d32ab9dd8753fbb2d7f6135
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7f7dad661776f4147d0bfd860b0a353c97c14549329cc5e7cb1afd336acf8ebdee79467e7f66be264b016eebd3282ff0bd9283ffde8354c4309e47540cfcfa80
|
7
|
+
data.tar.gz: bd1ca19ec238f00cc5ff2b1c3aafeb184f3126388c4de0485baf5c8e720cad48542db2bff100e345f09adf05e79a4f08eba197d907d12c85d327d61f40105b1b
|
data/.circleci/config.yml
CHANGED
@@ -12,12 +12,12 @@ references:
|
|
12
12
|
- &ruby_version
|
13
13
|
ruby_version:
|
14
14
|
type: enum
|
15
|
-
enum: &ruby_version_enum ["
|
15
|
+
enum: &ruby_version_enum ["3.0", "3.1", "3.2"]
|
16
16
|
default: "3.2"
|
17
17
|
- &rails_version
|
18
18
|
rails_version:
|
19
19
|
type: enum
|
20
|
-
enum: &rails_version_enum ["6.
|
20
|
+
enum: &rails_version_enum ["6.1", "7.0"]
|
21
21
|
default: "7.0"
|
22
22
|
- &bundler_options
|
23
23
|
bundler_options:
|
@@ -153,7 +153,7 @@ commands:
|
|
153
153
|
name: Install Bundler 2.x
|
154
154
|
command: gem install bundler -v '~> 2.0'
|
155
155
|
- ruby-orbs/bundle-install:
|
156
|
-
cache_key_prefix:
|
156
|
+
cache_key_prefix: v3-dependencies-<< parameters.ruby_version >>
|
157
157
|
bundle_extra_args: << parameters.bundler_options >>
|
158
158
|
restore_bundled_with: false
|
159
159
|
test_and_deploy_for_api:
|
@@ -252,7 +252,7 @@ jobs:
|
|
252
252
|
- code-climate/install
|
253
253
|
- code-climate/sum-coverage:
|
254
254
|
input: codeclimate.*.json
|
255
|
-
parts:
|
255
|
+
parts: 12
|
256
256
|
- code-climate/upload-coverage
|
257
257
|
rubocop:
|
258
258
|
executor: gem_executor
|
@@ -294,7 +294,7 @@ workflows:
|
|
294
294
|
ruby_version: *ruby_version_enum
|
295
295
|
rails_version: *rails_version_enum
|
296
296
|
- test_api:
|
297
|
-
ruby_version: "2
|
297
|
+
ruby_version: "3.2"
|
298
298
|
- rubocop
|
299
299
|
- yardoc
|
300
300
|
- upload-coverage:
|
data/.rubocop.yml
CHANGED
data/.rubocop_todo.yml
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# This configuration was generated by
|
2
2
|
# `rubocop --auto-gen-config`
|
3
|
-
# on 2023-
|
3
|
+
# on 2023-11-13 01:22:13 UTC using RuboCop version 1.57.2.
|
4
4
|
# The point is for the user to remove these configuration records
|
5
5
|
# one by one as the offenses are removed from the code base.
|
6
6
|
# Note that changes in the inspected code, or installation of new
|
@@ -14,7 +14,8 @@ Lint/EmptyBlock:
|
|
14
14
|
- 'spec/support/complete_about.rb'
|
15
15
|
- 'spec/support/complete_within.rb'
|
16
16
|
|
17
|
-
# Offense count:
|
17
|
+
# Offense count: 6
|
18
|
+
# Configuration parameters: AllowedParentClasses.
|
18
19
|
Lint/MissingSuper:
|
19
20
|
Exclude:
|
20
21
|
- 'lib/my_api_client/error_handling/generator.rb'
|
@@ -27,17 +28,27 @@ Lint/MissingSuper:
|
|
27
28
|
# Offense count: 6
|
28
29
|
# Configuration parameters: EnforcedStyle, CheckMethodNames, CheckSymbols, AllowedIdentifiers, AllowedPatterns.
|
29
30
|
# SupportedStyles: snake_case, normalcase, non_integer
|
30
|
-
# AllowedIdentifiers: capture3, iso8601, rfc1123_date, rfc822, rfc2822, rfc3339
|
31
|
+
# AllowedIdentifiers: capture3, iso8601, rfc1123_date, rfc822, rfc2822, rfc3339, x86_64
|
31
32
|
Naming/VariableNumber:
|
32
33
|
Exclude:
|
33
34
|
- 'spec/lib/my_api_client/error_handling_spec.rb'
|
34
35
|
- 'spec/lib/my_api_client/request/executor_spec.rb'
|
35
36
|
|
36
|
-
# Offense count:
|
37
|
+
# Offense count: 103
|
37
38
|
# Configuration parameters: AllowSubject.
|
38
39
|
RSpec/MultipleMemoizedHelpers:
|
39
40
|
Max: 15
|
40
41
|
|
42
|
+
# Offense count: 3
|
43
|
+
# Configuration parameters: Include, CustomTransform, IgnoreMethods, IgnoreMetadata.
|
44
|
+
# Include: **/*_spec.rb
|
45
|
+
RSpec/SpecFilePathFormat:
|
46
|
+
Exclude:
|
47
|
+
- '**/spec/routing/**/*'
|
48
|
+
- 'spec/lib/my_api_client/errors/error_spec.rb'
|
49
|
+
- 'spec/lib/my_api_client/errors/network_error_spec.rb'
|
50
|
+
- 'spec/lib/my_api_client/rspec/stub_spec.rb'
|
51
|
+
|
41
52
|
# Offense count: 3
|
42
53
|
Style/DocumentDynamicEvalDefinition:
|
43
54
|
Exclude:
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,45 @@
|
|
1
1
|
# Change log
|
2
2
|
|
3
|
+
## v0.27.0 (Nov 13, 2023)
|
4
|
+
|
5
|
+
### Feature
|
6
|
+
|
7
|
+
- [#944](https://github.com/ryz310/my_api_client/pull/944) Add block to retrieve sawyer response ([@okumud](https://github.com/okumud))
|
8
|
+
|
9
|
+
```rb
|
10
|
+
api_clinet = ExampleApiClient.new(access_token: 'access_token')
|
11
|
+
|
12
|
+
# You can retrieve sawyer response with return value
|
13
|
+
api_clinet.get_users #=> #<Sawyer::Resource>
|
14
|
+
|
15
|
+
# You can retrieve sawyer response with block
|
16
|
+
api_clinet.get_users do |response|
|
17
|
+
response #=> #<Sawyer::Response>
|
18
|
+
response.headers #=> #<Hash>
|
19
|
+
response.data #=> #<Sawyer::Resource>
|
20
|
+
end
|
21
|
+
```
|
22
|
+
|
23
|
+
### Breaking Change
|
24
|
+
|
25
|
+
- [#931](https://github.com/ryz310/my_api_client/pull/931) End of support for ruby 2.7 and rails 6.0 ([@ryz310](https://github.com/ryz310))
|
26
|
+
|
27
|
+
### Rubocop Challenge
|
28
|
+
|
29
|
+
### Dependabot
|
30
|
+
|
31
|
+
- [#919](https://github.com/ryz310/my_api_client/pull/919) Bump bugsnag from 6.25.2 to 6.26.0 ([@ryz310](https://github.com/ryz310))
|
32
|
+
- [#929](https://github.com/ryz310/my_api_client/pull/929) Bump webmock from 3.19.0 to 3.19.1 ([@ryz310](https://github.com/ryz310))
|
33
|
+
- [#934](https://github.com/ryz310/my_api_client/pull/934) Bump rubocop-performance from 1.19.0 to 1.19.1 ([@ryz310](https://github.com/ryz310))
|
34
|
+
- [#933](https://github.com/ryz310/my_api_client/pull/933) Bump faraday from 2.7.10 to 2.7.11 ([@ryz310](https://github.com/ryz310))
|
35
|
+
- [#939](https://github.com/ryz310/my_api_client/pull/939) Bump jsonpath from 1.1.4 to 1.1.5 ([@ryz310](https://github.com/ryz310))
|
36
|
+
- [#942](https://github.com/ryz310/my_api_client/pull/942) Bump rake from 13.0.6 to 13.1.0 ([@ryz310](https://github.com/ryz310))
|
37
|
+
- [#945](https://github.com/ryz310/my_api_client/pull/945) Bump activesupport from 7.1.1 to 7.1.2 ([@ryz310](https://github.com/ryz310))
|
38
|
+
|
39
|
+
### Misc
|
40
|
+
|
41
|
+
- [#946](https://github.com/ryz310/my_api_client/pull/946) Fix a broken spec ([@ryz310](https://github.com/ryz310))
|
42
|
+
|
3
43
|
## v0.26.0 (Jul 04, 2023)
|
4
44
|
|
5
45
|
### Bugfix
|
data/Gemfile.lock
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
my_api_client (0.
|
5
|
-
activesupport (>= 6.
|
4
|
+
my_api_client (0.27.0)
|
5
|
+
activesupport (>= 6.1.0)
|
6
6
|
faraday (>= 0.17.1)
|
7
7
|
jsonpath
|
8
8
|
sawyer (>= 0.8.2)
|
@@ -10,24 +10,35 @@ PATH
|
|
10
10
|
GEM
|
11
11
|
remote: https://rubygems.org/
|
12
12
|
specs:
|
13
|
-
activesupport (7.
|
13
|
+
activesupport (7.1.2)
|
14
|
+
base64
|
15
|
+
bigdecimal
|
14
16
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
17
|
+
connection_pool (>= 2.2.5)
|
18
|
+
drb
|
15
19
|
i18n (>= 1.6, < 2)
|
16
20
|
minitest (>= 5.1)
|
21
|
+
mutex_m
|
17
22
|
tzinfo (~> 2.0)
|
18
|
-
addressable (2.8.
|
23
|
+
addressable (2.8.5)
|
19
24
|
public_suffix (>= 2.0.2, < 6.0)
|
20
25
|
ast (2.4.2)
|
21
|
-
|
26
|
+
base64 (0.2.0)
|
27
|
+
bigdecimal (3.1.4)
|
28
|
+
bugsnag (6.26.0)
|
22
29
|
concurrent-ruby (~> 1.0)
|
23
30
|
byebug (11.1.3)
|
24
31
|
coderay (1.1.3)
|
25
32
|
concurrent-ruby (1.2.2)
|
33
|
+
connection_pool (2.4.1)
|
26
34
|
crack (0.4.5)
|
27
35
|
rexml
|
28
36
|
diff-lcs (1.5.0)
|
29
37
|
docile (1.4.0)
|
30
|
-
|
38
|
+
drb (2.2.0)
|
39
|
+
ruby2_keywords
|
40
|
+
faraday (2.7.11)
|
41
|
+
base64
|
31
42
|
faraday-net_http (>= 2.0, < 3.1)
|
32
43
|
ruby2_keywords (>= 0.0.4)
|
33
44
|
faraday-net_http (3.0.2)
|
@@ -35,14 +46,15 @@ GEM
|
|
35
46
|
i18n (1.14.1)
|
36
47
|
concurrent-ruby (~> 1.0)
|
37
48
|
json (2.6.3)
|
38
|
-
jsonpath (1.1.
|
49
|
+
jsonpath (1.1.5)
|
39
50
|
multi_json
|
40
51
|
language_server-protocol (3.17.0.3)
|
41
52
|
method_source (1.0.0)
|
42
|
-
minitest (5.
|
53
|
+
minitest (5.20.0)
|
43
54
|
multi_json (1.15.0)
|
55
|
+
mutex_m (0.2.0)
|
44
56
|
parallel (1.23.0)
|
45
|
-
parser (3.2.2.
|
57
|
+
parser (3.2.2.4)
|
46
58
|
ast (~> 2.4.1)
|
47
59
|
racc
|
48
60
|
pry (0.14.2)
|
@@ -51,12 +63,12 @@ GEM
|
|
51
63
|
pry-byebug (3.10.1)
|
52
64
|
byebug (~> 11.0)
|
53
65
|
pry (>= 0.13, < 0.15)
|
54
|
-
public_suffix (5.0.
|
55
|
-
racc (1.7.
|
66
|
+
public_suffix (5.0.3)
|
67
|
+
racc (1.7.3)
|
56
68
|
rainbow (3.1.1)
|
57
|
-
rake (13.0
|
58
|
-
regexp_parser (2.8.
|
59
|
-
rexml (3.2.
|
69
|
+
rake (13.1.0)
|
70
|
+
regexp_parser (2.8.2)
|
71
|
+
rexml (3.2.6)
|
60
72
|
rspec (3.12.0)
|
61
73
|
rspec-core (~> 3.12.0)
|
62
74
|
rspec-expectations (~> 3.12.0)
|
@@ -66,36 +78,36 @@ GEM
|
|
66
78
|
rspec-expectations (3.12.3)
|
67
79
|
diff-lcs (>= 1.2.0, < 2.0)
|
68
80
|
rspec-support (~> 3.12.0)
|
69
|
-
rspec-mocks (3.12.
|
81
|
+
rspec-mocks (3.12.6)
|
70
82
|
diff-lcs (>= 1.2.0, < 2.0)
|
71
83
|
rspec-support (~> 3.12.0)
|
72
84
|
rspec-support (3.12.1)
|
73
85
|
rspec_junit_formatter (0.6.0)
|
74
86
|
rspec-core (>= 2, < 4, != 2.12.0)
|
75
|
-
rubocop (1.
|
87
|
+
rubocop (1.57.2)
|
76
88
|
json (~> 2.3)
|
77
89
|
language_server-protocol (>= 3.17.0)
|
78
90
|
parallel (~> 1.10)
|
79
|
-
parser (>= 3.2.2.
|
91
|
+
parser (>= 3.2.2.4)
|
80
92
|
rainbow (>= 2.2.2, < 4.0)
|
81
93
|
regexp_parser (>= 1.8, < 3.0)
|
82
94
|
rexml (>= 3.2.5, < 4.0)
|
83
|
-
rubocop-ast (>= 1.28.
|
95
|
+
rubocop-ast (>= 1.28.1, < 2.0)
|
84
96
|
ruby-progressbar (~> 1.7)
|
85
97
|
unicode-display_width (>= 2.4.0, < 3.0)
|
86
|
-
rubocop-ast (1.
|
98
|
+
rubocop-ast (1.30.0)
|
87
99
|
parser (>= 3.2.1.0)
|
88
|
-
rubocop-capybara (2.
|
100
|
+
rubocop-capybara (2.19.0)
|
89
101
|
rubocop (~> 1.41)
|
90
|
-
rubocop-factory_bot (2.
|
102
|
+
rubocop-factory_bot (2.24.0)
|
91
103
|
rubocop (~> 1.33)
|
92
|
-
rubocop-performance (1.
|
104
|
+
rubocop-performance (1.19.1)
|
93
105
|
rubocop (>= 1.7.0, < 2.0)
|
94
106
|
rubocop-ast (>= 0.4.0)
|
95
107
|
rubocop-rake (0.6.0)
|
96
108
|
rubocop (~> 1.0)
|
97
|
-
rubocop-rspec (2.
|
98
|
-
rubocop (~> 1.
|
109
|
+
rubocop-rspec (2.25.0)
|
110
|
+
rubocop (~> 1.40)
|
99
111
|
rubocop-capybara (~> 2.17)
|
100
112
|
rubocop-factory_bot (~> 2.22)
|
101
113
|
ruby-progressbar (1.13.0)
|
@@ -111,8 +123,8 @@ GEM
|
|
111
123
|
simplecov_json_formatter (0.1.4)
|
112
124
|
tzinfo (2.0.6)
|
113
125
|
concurrent-ruby (~> 1.0)
|
114
|
-
unicode-display_width (2.
|
115
|
-
webmock (3.
|
126
|
+
unicode-display_width (2.5.0)
|
127
|
+
webmock (3.19.1)
|
116
128
|
addressable (>= 2.8.0)
|
117
129
|
crack (>= 0.3.2)
|
118
130
|
hashdiff (>= 0.4.0, < 2.0.0)
|
data/README.jp.md
CHANGED
@@ -12,8 +12,8 @@ MyApiClient は API リクエストクラスを作成するための汎用的な
|
|
12
12
|
|
13
13
|
## Supported Versions
|
14
14
|
|
15
|
-
- Ruby
|
16
|
-
- Rails 6.
|
15
|
+
- Ruby 3.0, 3.1, 3.2
|
16
|
+
- Rails 6.1, 7.0
|
17
17
|
|
18
18
|
## Installation
|
19
19
|
|
@@ -52,7 +52,7 @@ class ExampleApiClient < MyApiClient::Base
|
|
52
52
|
|
53
53
|
# GET https://example.com/v1/users
|
54
54
|
#
|
55
|
-
# @return [Sawyer::
|
55
|
+
# @return [Sawyer::Resource] HTTP resource parameter
|
56
56
|
def get_users
|
57
57
|
get 'users', headers: headers, query: { key: 'value' }
|
58
58
|
end
|
@@ -60,7 +60,7 @@ class ExampleApiClient < MyApiClient::Base
|
|
60
60
|
# POST https://example.com/v1/users
|
61
61
|
#
|
62
62
|
# @param name [String] Username which want to create
|
63
|
-
# @return [Sawyer::
|
63
|
+
# @return [Sawyer::Resource] HTTP resource parameter
|
64
64
|
def post_user(name:)
|
65
65
|
post 'users', headers: headers, body: { name: name }
|
66
66
|
end
|
@@ -76,7 +76,7 @@ class ExampleApiClient < MyApiClient::Base
|
|
76
76
|
end
|
77
77
|
|
78
78
|
api_clinet = ExampleApiClient.new(access_token: 'access_token')
|
79
|
-
api_clinet.get_users #=> #<Sawyer::
|
79
|
+
api_clinet.get_users #=> #<Sawyer::Resource>
|
80
80
|
```
|
81
81
|
|
82
82
|
クラス定義の最初に記述される `endpoint` にはリクエスト URL の共通部分を定義します。後述の各メソッドで後続の path を定義しますが、上記の例だと `get 'users'` と定義すると、 `GET https://example.com/v1/users` というリクエストが実行されます。
|
@@ -416,7 +416,7 @@ class GetUsersApiClient < ExampleApiClient
|
|
416
416
|
|
417
417
|
# GET https://example.com/users
|
418
418
|
#
|
419
|
-
# @return [Sawyer::
|
419
|
+
# @return [Sawyer::Resource] HTTP resource parameter
|
420
420
|
def request
|
421
421
|
get 'users', query: { key: 'value' }, headers: headers
|
422
422
|
end
|
@@ -428,7 +428,7 @@ class PostUserApiClient < ExampleApiClient
|
|
428
428
|
# POST https://example.com/users
|
429
429
|
#
|
430
430
|
# @param name [String] Username which want to create
|
431
|
-
# @return [Sawyer::
|
431
|
+
# @return [Sawyer::Resource] HTTP resource parameter
|
432
432
|
def request(name:)
|
433
433
|
post 'users', headers: headers, body: { name: name }
|
434
434
|
end
|
data/README.md
CHANGED
@@ -16,8 +16,8 @@ It is supposed to be used in Ruby on Rails, but it is made to work in other envi
|
|
16
16
|
|
17
17
|
## Supported Versions
|
18
18
|
|
19
|
-
- Ruby
|
20
|
-
- Rails 6.
|
19
|
+
- Ruby 3.0, 3.1, 3.2
|
20
|
+
- Rails 6.1, 7.0
|
21
21
|
|
22
22
|
## Installation
|
23
23
|
|
@@ -56,7 +56,7 @@ class ExampleApiClient < MyApiClient::Base
|
|
56
56
|
|
57
57
|
# GET https://example.com/v1/users
|
58
58
|
#
|
59
|
-
# @return [Sawyer::
|
59
|
+
# @return [Sawyer::Resource] HTTP resource parameter
|
60
60
|
def get_users
|
61
61
|
get 'users', headers: headers, query: { key: 'value' }
|
62
62
|
end
|
@@ -64,7 +64,7 @@ class ExampleApiClient < MyApiClient::Base
|
|
64
64
|
# POST https://example.com/v1/users
|
65
65
|
#
|
66
66
|
# @param name [String] Username which want to create
|
67
|
-
# @return [Sawyer::
|
67
|
+
# @return [Sawyer::Resource] HTTP resource parameter
|
68
68
|
def post_user(name:)
|
69
69
|
post 'users', headers: headers, body: { name: name }
|
70
70
|
end
|
@@ -80,7 +80,7 @@ class ExampleApiClient < MyApiClient::Base
|
|
80
80
|
end
|
81
81
|
|
82
82
|
api_clinet = ExampleApiClient.new(access_token: 'access_token')
|
83
|
-
api_clinet.get_users #=> #<Sawyer::
|
83
|
+
api_clinet.get_users #=> #<Sawyer::Resource>
|
84
84
|
```
|
85
85
|
|
86
86
|
The `endpoint` defines the intersection of the request URL. Each method described below defines a subsequent path. In the above example, `get 'users'` will request to `GET https://example.com/v1/users`.
|
@@ -20,10 +20,18 @@ module MyApiClient
|
|
20
20
|
# @param body [Hash, nil]
|
21
21
|
# Request body. You should not specify it when use GET method.
|
22
22
|
# @return [Sawyer::Resource]
|
23
|
-
# Response body instance.
|
23
|
+
# Response body instance if the block is not given.
|
24
|
+
# @yield
|
25
|
+
# Process the response body with the given block.
|
26
|
+
# @yieldparam response [Sawyer::Response]
|
27
|
+
# Response instance.
|
28
|
+
# @yieldreturn [Object]
|
29
|
+
# The block result.
|
30
|
+
# @return [Object]
|
31
|
+
# Whatever the block returns if the block is given.
|
24
32
|
def #{http_method}(pathname, headers: nil, query: nil, body: nil)
|
25
33
|
response = call(:_request_with_relative_uri, :#{http_method}, pathname, headers, query, body)
|
26
|
-
response.data
|
34
|
+
block_given? ? yield(response) : response.data
|
27
35
|
end
|
28
36
|
METHOD
|
29
37
|
end
|
data/my_api/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
3.0.6
|
data/my_api/Gemfile
CHANGED
@@ -2,12 +2,12 @@
|
|
2
2
|
|
3
3
|
source 'https://rubygems.org'
|
4
4
|
|
5
|
-
gem 'jets', '~> 4.0.
|
5
|
+
gem 'jets', '~> 4.0.7'
|
6
6
|
|
7
7
|
gem 'dynomite'
|
8
8
|
|
9
9
|
# See: https://github.com/boltops-tools/jets/issues/523
|
10
|
-
gem 'nokogiri', '~> 1.15.
|
10
|
+
gem 'nokogiri', '~> 1.15.4'
|
11
11
|
|
12
12
|
# development and test groups are not bundled as part of the deployment
|
13
13
|
group :development, :test do
|