delivery-sdk-ruby 0.11.1 → 0.11.2
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 -0
- data/lib/delivery/models/content_item.rb +9 -2
- data/lib/delivery/responses/delivery_item_listing_response.rb +6 -2
- data/lib/delivery/responses/delivery_item_response.rb +9 -2
- data/lib/delivery/responses/response_base.rb +4 -2
- data/lib/delivery/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d82deddb6aa006c988be4506bc17f86c7048525315cf6b76171c27e7f41439c3
|
4
|
+
data.tar.gz: 4141518bc2e19f310a0c7f6ef3f4c6c761c38602352926e030c3ba7091a7a1bd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 11eadae9a4d4602975d861d5fe8e3dd0b7313e44de307fbbe53c45aba75ccafd6fb350769f1962e9db0e2a735bcd6decf177e0b2b165f1e34ee5901d6c5d2b44
|
7
|
+
data.tar.gz: 1a0919f05191b5b46b12dd7908e19306a61cb210db6e85280618c8ad01afa34469881396f9b18a055c4b73db0d366d800e5a58a05130a06dfb67cc63221e5142
|
data/README.md
CHANGED
@@ -162,6 +162,8 @@ delivery_client.items.execute do |response|
|
|
162
162
|
end
|
163
163
|
```
|
164
164
|
|
165
|
+
You can also view the raw JSON response of the the query using the `.json` attribute.
|
166
|
+
|
165
167
|
For successful content item queries, you will get either `DeliveryItemResponse` for single item queries, or `DeliveryItemListingResponse` for multiple item queries. You can access the returned content item(s) at `.item` or `.items` respectively.
|
166
168
|
|
167
169
|
The `ContentItem` object gives you access to all system elements and content type elements at the `.system` and `.elements` properies. These are dynamic objects, so you can simply type the name of the element you need:
|
@@ -23,14 +23,21 @@ module Delivery
|
|
23
23
|
)
|
24
24
|
end
|
25
25
|
|
26
|
-
def initialize(source, content_link_url_resolver, inline_content_item_resolver)
|
26
|
+
def initialize(source, content_link_url_resolver, inline_content_item_resolver, modular_content = nil)
|
27
27
|
@source =
|
28
28
|
if source['item'].nil?
|
29
29
|
source
|
30
30
|
else
|
31
31
|
source['item']
|
32
32
|
end
|
33
|
-
|
33
|
+
# Multiple item responses have modular_content on the root, single item
|
34
|
+
# responses have modular content in the item
|
35
|
+
@modular_content =
|
36
|
+
if modular_content.nil?
|
37
|
+
source['modular_content']
|
38
|
+
else
|
39
|
+
modular_content
|
40
|
+
end
|
34
41
|
self.content_link_url_resolver = content_link_url_resolver
|
35
42
|
self.inline_content_item_resolver = inline_content_item_resolver
|
36
43
|
end
|
@@ -18,7 +18,8 @@ module Delivery
|
|
18
18
|
items << Delivery::ContentItem.new(
|
19
19
|
n,
|
20
20
|
@content_link_url_resolver,
|
21
|
-
@inline_content_item_resolver
|
21
|
+
@inline_content_item_resolver,
|
22
|
+
@response['modular_content']
|
22
23
|
)
|
23
24
|
end
|
24
25
|
@items = items
|
@@ -28,7 +29,10 @@ module Delivery
|
|
28
29
|
@response = response
|
29
30
|
@content_link_url_resolver = content_link_url_resolver
|
30
31
|
@inline_content_item_resolver = inline_content_item_resolver
|
31
|
-
super 200,
|
32
|
+
super 200,
|
33
|
+
"Success,
|
34
|
+
#{items.length} items returned",
|
35
|
+
JSON.generate(@response)
|
32
36
|
end
|
33
37
|
end
|
34
38
|
end
|
@@ -7,14 +7,21 @@ module Delivery
|
|
7
7
|
class DeliveryItemResponse < ResponseBase
|
8
8
|
def item
|
9
9
|
@item unless @item.nil?
|
10
|
-
@item = Delivery::ContentItem.new(
|
10
|
+
@item = Delivery::ContentItem.new(
|
11
|
+
@response,
|
12
|
+
@content_link_url_resolver,
|
13
|
+
@inline_content_item_resolver
|
14
|
+
)
|
11
15
|
end
|
12
16
|
|
13
17
|
def initialize(response, content_link_url_resolver, inline_content_item_resolver)
|
14
18
|
@response = response
|
15
19
|
@content_link_url_resolver = content_link_url_resolver
|
16
20
|
@inline_content_item_resolver = inline_content_item_resolver
|
17
|
-
super 200,
|
21
|
+
super 200,
|
22
|
+
"Success,
|
23
|
+
'#{item.system.code_name}' returned",
|
24
|
+
JSON.generate(@response)
|
18
25
|
end
|
19
26
|
end
|
20
27
|
end
|
@@ -3,11 +3,13 @@ module Delivery
|
|
3
3
|
# Base class for all responses from DeliveryQuery.execute
|
4
4
|
class ResponseBase
|
5
5
|
attr_accessor :http_code,
|
6
|
-
:message
|
6
|
+
:message,
|
7
|
+
:json
|
7
8
|
|
8
|
-
def initialize(http_code, message)
|
9
|
+
def initialize(http_code, message, json = '')
|
9
10
|
self.http_code = http_code
|
10
11
|
self.message = message
|
12
|
+
self.json = json
|
11
13
|
end
|
12
14
|
|
13
15
|
def to_s
|
data/lib/delivery/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: delivery-sdk-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.11.
|
4
|
+
version: 0.11.2
|
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-02-
|
11
|
+
date: 2019-02-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|