kontent-delivery-sdk-ruby 2.0.11 → 2.0.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +12 -0
- data/lib/delivery/client/delivery_query.rb +31 -5
- data/lib/delivery/version.rb +1 -1
- metadata +13 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 63493f8b5e33379100aa54f2f2b4ce45c6ef5ea07d16b837681522bbbcd8ba74
|
4
|
+
data.tar.gz: 552a3f50c6fcda4a363d5312c0c483956f56d35f11661831a8520f325c34b089
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 90500abcbe775f08759ae9439e7d388db95cf8072825c0010054a63ccb79334d8055629794ff22b472cb995439f8fa737d9a297f9afe8b87172557ed8c87ad1d
|
7
|
+
data.tar.gz: 3e80ccb8eb5df8d5a8f898c19e15203494e680b0700d8b751174590c3942eecf0d4dd99a4ec90b0976e131620a3c42f83bfd84bfdfeee883e4ece9e09112be1a
|
data/README.md
CHANGED
@@ -244,6 +244,18 @@ delivery_client.item('about_us')
|
|
244
244
|
.execute
|
245
245
|
```
|
246
246
|
|
247
|
+
### Providing custom headers
|
248
|
+
|
249
|
+
If you want to pass custom headers in the request, you can use `custom_headers`. This could be useful when you are developing your package on top of the SDK.
|
250
|
+
|
251
|
+
Note that you can not override internal headers such as `Authorization`. If headers with an existing key are passed into the method, they will be ignored.
|
252
|
+
|
253
|
+
```ruby
|
254
|
+
delivery_client.items
|
255
|
+
.custom_headers({ 'MY-HEADER' => 'HEADER VALUE' })
|
256
|
+
.execute
|
257
|
+
```
|
258
|
+
|
247
259
|
### Custom URLs
|
248
260
|
|
249
261
|
When you have a URL (i.e. `next_page` for paging, for testing purposes, or if you prefer to build it on your own) and still want to leverage SDK functionality such as rich text resolving, use the .url method:
|
@@ -62,11 +62,6 @@ module Kentico
|
|
62
62
|
# * *Returns*:
|
63
63
|
# - Kentico::Kontent::Delivery::Responses::ResponseBase or a class extending it
|
64
64
|
def execute
|
65
|
-
headers = @headers.clone
|
66
|
-
headers['X-KC-SDKID'] = provide_sdk_header
|
67
|
-
headers['Authorization'] = "Bearer #{preview_key}" if should_preview
|
68
|
-
headers['Authorization'] = "Bearer #{secure_key}" if !should_preview && secure_key
|
69
|
-
|
70
65
|
resp = Kentico::Kontent::Delivery::RequestManager.start self, headers
|
71
66
|
yield resp if block_given?
|
72
67
|
resp
|
@@ -230,8 +225,39 @@ module Kentico
|
|
230
225
|
@url
|
231
226
|
end
|
232
227
|
|
228
|
+
# Allows providing custom headers for client requests.
|
229
|
+
# See https://github.com/Kentico/kontent-delivery-sdk-ruby#providing-custom-headers
|
230
|
+
#
|
231
|
+
# * *Args*:
|
232
|
+
# - *headers* (+Hash+) A hash that corresponds to provided headers
|
233
|
+
#
|
234
|
+
# * *Returns*:
|
235
|
+
# - +self+
|
236
|
+
def custom_headers(headers)
|
237
|
+
@custom_headers = headers
|
238
|
+
self
|
239
|
+
end
|
240
|
+
|
233
241
|
private
|
234
242
|
|
243
|
+
# Returns request headers that are extended with custom headers.
|
244
|
+
# Custom headers do not override existing headers.
|
245
|
+
#
|
246
|
+
# * *Returns*
|
247
|
+
# - +Hash+
|
248
|
+
def headers
|
249
|
+
headers = @headers.clone
|
250
|
+
headers['X-KC-SDKID'] = provide_sdk_header
|
251
|
+
headers['Authorization'] = "Bearer #{preview_key}" if should_preview
|
252
|
+
headers['Authorization'] = "Bearer #{secure_key}" if !should_preview && secure_key
|
253
|
+
|
254
|
+
if @custom_headers
|
255
|
+
headers.merge!(@custom_headers) { |key, v1, v2| v1 }
|
256
|
+
end
|
257
|
+
|
258
|
+
headers
|
259
|
+
end
|
260
|
+
|
235
261
|
# Initializes the +query_string+ attribute with the passed array of
|
236
262
|
# Kentico::Kontent::Delivery::QueryParameters::Filter objects.
|
237
263
|
#
|
data/lib/delivery/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kontent-delivery-sdk-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eric Dugre
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-12-
|
11
|
+
date: 2019-12-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dotenv
|
@@ -28,40 +28,40 @@ dependencies:
|
|
28
28
|
name: nokogiri
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - ">="
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: 1.8.4
|
34
31
|
- - "~>"
|
35
32
|
- !ruby/object:Gem::Version
|
36
33
|
version: 1.10.0
|
34
|
+
- - ">="
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: 1.8.4
|
37
37
|
type: :runtime
|
38
38
|
prerelease: false
|
39
39
|
version_requirements: !ruby/object:Gem::Requirement
|
40
40
|
requirements:
|
41
|
-
- - ">="
|
42
|
-
- !ruby/object:Gem::Version
|
43
|
-
version: 1.8.4
|
44
41
|
- - "~>"
|
45
42
|
- !ruby/object:Gem::Version
|
46
43
|
version: 1.10.0
|
44
|
+
- - ">="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: 1.8.4
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: rest-client
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|
50
50
|
requirements:
|
51
|
-
- - "
|
51
|
+
- - "~>"
|
52
52
|
- !ruby/object:Gem::Version
|
53
53
|
version: 2.1.0.rc1
|
54
|
-
- - "
|
54
|
+
- - ">="
|
55
55
|
- !ruby/object:Gem::Version
|
56
56
|
version: 2.1.0.rc1
|
57
57
|
type: :runtime
|
58
58
|
prerelease: false
|
59
59
|
version_requirements: !ruby/object:Gem::Requirement
|
60
60
|
requirements:
|
61
|
-
- - "
|
61
|
+
- - "~>"
|
62
62
|
- !ruby/object:Gem::Version
|
63
63
|
version: 2.1.0.rc1
|
64
|
-
- - "
|
64
|
+
- - ">="
|
65
65
|
- !ruby/object:Gem::Version
|
66
66
|
version: 2.1.0.rc1
|
67
67
|
- !ruby/object:Gem::Dependency
|
@@ -194,7 +194,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
194
194
|
- !ruby/object:Gem::Version
|
195
195
|
version: '0'
|
196
196
|
requirements: []
|
197
|
-
rubygems_version: 3.
|
197
|
+
rubygems_version: 3.1.2
|
198
198
|
signing_key:
|
199
199
|
specification_version: 4
|
200
200
|
summary: Kentico Kontent Delivery SDK for Ruby
|