bubbles-rest-client 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/Gemfile.lock +8 -8
- data/bubbles.gemspec +1 -1
- data/lib/bubbles/config.rb +4 -8
- data/lib/bubbles/endpoint.rb +4 -0
- data/lib/bubbles/rest_client_resources.rb +33 -1
- data/lib/bubbles/version.rb +1 -1
- metadata +5 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: d85396895955c45173bf56e4f7efb61a841bceb90c0d4f3348f99fcb0271e7a0
|
4
|
+
data.tar.gz: c7147c2c317a496d577a63f19f7fe4a398997b9bb6d8b3084585f7da6f93da3c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '076759218897e4bac3955b296fa5a0eabb58fb826c5e51c063da34f39d659f7fa2c61d85e8ae064fa5dd46c88a7d3b33baad513bff1951ea629fa30de2c9091e'
|
7
|
+
data.tar.gz: b84b861758a6bd7b44ae4f4153da1467fb6cd5e69b2846450088b7946af21539efe20d9fb3b80f136aa6f0f40cd6f58e5ca5fab3e2cd6fe2f7af8a75a38e8bb4
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
bubbles-rest-client (0.
|
4
|
+
bubbles-rest-client (0.3.1)
|
5
5
|
addressable (~> 2.5)
|
6
6
|
rest-client (~> 2.0)
|
7
7
|
|
@@ -16,9 +16,9 @@ GEM
|
|
16
16
|
safe_yaml (~> 1.0.0)
|
17
17
|
diff-lcs (1.3)
|
18
18
|
docile (1.3.1)
|
19
|
-
domain_name (0.5.
|
19
|
+
domain_name (0.5.20190701)
|
20
20
|
unf (>= 0.0.5, < 1.0.0)
|
21
|
-
hashdiff (0.
|
21
|
+
hashdiff (1.0.0)
|
22
22
|
http-cookie (1.0.3)
|
23
23
|
domain_name (~> 0.5)
|
24
24
|
json (2.0.2)
|
@@ -52,7 +52,7 @@ GEM
|
|
52
52
|
rspec-support (~> 3.8.0)
|
53
53
|
rspec-support (3.8.0)
|
54
54
|
ruby-progressbar (1.9.0)
|
55
|
-
safe_yaml (1.0.
|
55
|
+
safe_yaml (1.0.5)
|
56
56
|
simplecov (0.16.1)
|
57
57
|
docile (~> 1.1)
|
58
58
|
json (>= 1.8, < 3)
|
@@ -62,10 +62,10 @@ GEM
|
|
62
62
|
unf_ext
|
63
63
|
unf_ext (0.0.7.6)
|
64
64
|
vcr (3.0.3)
|
65
|
-
webmock (3.0
|
65
|
+
webmock (3.6.0)
|
66
66
|
addressable (>= 2.3.6)
|
67
67
|
crack (>= 0.3.2)
|
68
|
-
hashdiff
|
68
|
+
hashdiff (>= 0.4.0, < 2.0.0)
|
69
69
|
|
70
70
|
PLATFORMS
|
71
71
|
ruby
|
@@ -79,7 +79,7 @@ DEPENDENCIES
|
|
79
79
|
rspec (~> 3.8)
|
80
80
|
simplecov (~> 0.16)
|
81
81
|
vcr (~> 3.0)
|
82
|
-
webmock (~> 3.
|
82
|
+
webmock (~> 3.5)
|
83
83
|
|
84
84
|
BUNDLED WITH
|
85
|
-
2.0.
|
85
|
+
2.0.2
|
data/bubbles.gemspec
CHANGED
@@ -37,7 +37,7 @@ Gem::Specification.new do |spec|
|
|
37
37
|
spec.add_development_dependency "minitest", "~> 5.0"
|
38
38
|
spec.add_development_dependency "minitest-reporters", "~> 1.1"
|
39
39
|
spec.add_development_dependency "simplecov", "~> 0.16"
|
40
|
-
spec.add_development_dependency "webmock", "~> 3.
|
40
|
+
spec.add_development_dependency "webmock", "~> 3.5"
|
41
41
|
spec.add_development_dependency "vcr", "~> 3.0"
|
42
42
|
spec.add_development_dependency "rspec", "~> 3.8"
|
43
43
|
spec.add_dependency "addressable", "~> 2.5"
|
data/lib/bubbles/config.rb
CHANGED
@@ -282,16 +282,12 @@ module Bubbles
|
|
282
282
|
elsif endpoint.api_key_required?
|
283
283
|
Bubbles::RestEnvironment.class_exec do
|
284
284
|
if endpoint.has_uri_params?
|
285
|
-
define_method(endpoint_name_as_sym) do |
|
286
|
-
|
287
|
-
additional_headers['X-Api-Key'] = api_key
|
288
|
-
RestClientResources.execute_head_unauthenticated self, endpoint, uri_params, additional_headers
|
285
|
+
define_method(endpoint_name_as_sym) do |uri_params|
|
286
|
+
RestClientResources.execute_head_unauthenticated_with_uri_params self, endpoint, self.api_key, uri_params
|
289
287
|
end
|
290
288
|
else
|
291
|
-
define_method(endpoint_name_as_sym) do
|
292
|
-
|
293
|
-
additional_headers['X-Api-Key'] = api_key
|
294
|
-
RestClientResources.execute_head_unauthenticated self, endpoint, {}, additional_headers
|
289
|
+
define_method(endpoint_name_as_sym) do
|
290
|
+
RestClientResources.execute_head_unauthenticated self, endpoint, self.api_key, nil
|
295
291
|
end
|
296
292
|
end
|
297
293
|
end
|
data/lib/bubbles/endpoint.rb
CHANGED
@@ -148,6 +148,10 @@ module Bubbles
|
|
148
148
|
# @return [String] A +String+ containing the full URL to access this +Endpoint+ on the given {RestEnvironment}.
|
149
149
|
#
|
150
150
|
def get_expanded_url(env, uri_params = {})
|
151
|
+
unless uri_params
|
152
|
+
uri_params = {}
|
153
|
+
end
|
154
|
+
|
151
155
|
url = get_base_url env
|
152
156
|
|
153
157
|
if is_complex?
|
@@ -101,7 +101,7 @@ module Bubbles
|
|
101
101
|
# @param [String] auth_token The authorization token to use for authentication.
|
102
102
|
# @param [Hash] uri_params A +Hash+ of identifiers to values to replace in the URI string.
|
103
103
|
#
|
104
|
-
# @return [RestClient::Response] The +Response+ resulting from the execution of the
|
104
|
+
# @return [RestClient::Response] The +Response+ resulting from the execution of the HEAD call.
|
105
105
|
#
|
106
106
|
def self.execute_head_authenticated(env, endpoint, auth_token, uri_params)
|
107
107
|
execute_rest_call(env, endpoint, nil, auth_token, nil, uri_params) do |env, url, data, headers|
|
@@ -114,6 +114,38 @@ module Bubbles
|
|
114
114
|
end
|
115
115
|
end
|
116
116
|
|
117
|
+
##
|
118
|
+
# Execute a HEAD request without authentication but with some parameters encoded in the URI string.
|
119
|
+
#
|
120
|
+
# @param [RestEnvironment] env The +RestEnvironment+ to use to execute the request
|
121
|
+
# @param [Endpoint] endpoint The +Endpoint+ which should be requested
|
122
|
+
# @param [String] api_key The API key to use to validate the client.
|
123
|
+
# @param [Hash] uri_params A +Hash+ of identifiers to values to replace in the URI string.
|
124
|
+
# @param [Hash] headers An optional +Hash+ of additional headers to pass with the request.
|
125
|
+
#
|
126
|
+
# @return [RestClient::Response] The +Response+ resulting from the execution of the HEAD call.
|
127
|
+
#
|
128
|
+
def self.execute_head_unauthenticated_with_uri_params(env, endpoint, api_key, uri_params, headers=nil)
|
129
|
+
additional_headers = {
|
130
|
+
'X-Api-Key' => api_key
|
131
|
+
}
|
132
|
+
|
133
|
+
unless headers.nil?
|
134
|
+
headers.each { |nextHeader|
|
135
|
+
additional_headers[nextHeader[0]] = nextHeader[1]
|
136
|
+
}
|
137
|
+
end
|
138
|
+
|
139
|
+
execute_rest_call(env, endpoint, nil, nil, additional_headers, uri_params) do |env, url, data, headers|
|
140
|
+
if env.scheme == 'https'
|
141
|
+
next RestClient::Resource.new(url.to_s, :verify_ssl => OpenSSL::SSL::VERIFY_NONE)
|
142
|
+
.head(headers)
|
143
|
+
else
|
144
|
+
next RestClient.head(url.to_s, headers)
|
145
|
+
end
|
146
|
+
end
|
147
|
+
end
|
148
|
+
|
117
149
|
##
|
118
150
|
# Execute a POST request without authentication, but requiring an API key.
|
119
151
|
#
|
data/lib/bubbles/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bubbles-rest-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Scott Johnson
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-07-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -86,14 +86,14 @@ dependencies:
|
|
86
86
|
requirements:
|
87
87
|
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: '3.
|
89
|
+
version: '3.5'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: '3.
|
96
|
+
version: '3.5'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: vcr
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -191,8 +191,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
191
191
|
- !ruby/object:Gem::Version
|
192
192
|
version: '0'
|
193
193
|
requirements: []
|
194
|
-
|
195
|
-
rubygems_version: 2.6.11
|
194
|
+
rubygems_version: 3.0.4
|
196
195
|
signing_key:
|
197
196
|
specification_version: 4
|
198
197
|
summary: A gem for easily defining client REST interfaces in Ruby
|