bubbles-rest-client 0.3.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 9ad75198eea8a1ae90b920cdaf131f8835eec848
4
- data.tar.gz: 2213e42c80108c736a737edf350763b934013056
2
+ SHA256:
3
+ metadata.gz: d85396895955c45173bf56e4f7efb61a841bceb90c0d4f3348f99fcb0271e7a0
4
+ data.tar.gz: c7147c2c317a496d577a63f19f7fe4a398997b9bb6d8b3084585f7da6f93da3c
5
5
  SHA512:
6
- metadata.gz: 3c4cef54a47849f040fc3e1c73978f6408d50690e7ef78a7dc72ffb166fd539427535cd4c7c5456c3837188fa256e44b21b5e5128d449fbaab912341f0aac883
7
- data.tar.gz: 7d2a4630c75ba13393f49c262ecccab694ff0e46ba3f574503233057245bc5d91b8ea270bef50e235ec7b01da4bb04769d4459c0eb6f9d98a0d1976172f51127
6
+ metadata.gz: '076759218897e4bac3955b296fa5a0eabb58fb826c5e51c063da34f39d659f7fa2c61d85e8ae064fa5dd46c88a7d3b33baad513bff1951ea629fa30de2c9091e'
7
+ data.tar.gz: b84b861758a6bd7b44ae4f4153da1467fb6cd5e69b2846450088b7946af21539efe20d9fb3b80f136aa6f0f40cd6f58e5ca5fab3e2cd6fe2f7af8a75a38e8bb4
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bubbles-rest-client (0.2.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.20180417)
19
+ domain_name (0.5.20190701)
20
20
  unf (>= 0.0.5, < 1.0.0)
21
- hashdiff (0.3.4)
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.4)
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.1)
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.0)
82
+ webmock (~> 3.5)
83
83
 
84
84
  BUNDLED WITH
85
- 2.0.1
85
+ 2.0.2
@@ -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.0"
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"
@@ -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 |api_key, uri_params|
286
- additional_headers = {}
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 |api_key|
292
- additional_headers = {}
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
@@ -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 GET call.
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
  #
@@ -7,7 +7,7 @@ module Bubbles
7
7
  end
8
8
 
9
9
  def self.version_name
10
- '0.3.0'
10
+ '0.3.1'
11
11
  end
12
12
 
13
13
  def self.version_code
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.0
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-05-04 00:00:00.000000000 Z
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.0'
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.0'
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
- rubyforge_project:
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