delivery-sdk-ruby 0.16.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/delivery/builders/image_transformation_builder.rb +150 -24
- data/lib/delivery/builders/url_builder.rb +58 -18
- data/lib/delivery/client/delivery_client.rb +57 -0
- data/lib/delivery/client/delivery_query.rb +156 -34
- data/lib/delivery/models/content_item.rb +59 -6
- data/lib/delivery/models/content_type.rb +12 -1
- data/lib/delivery/models/pagination.rb +5 -1
- data/lib/delivery/models/taxonomy_group.rb +12 -1
- data/lib/delivery/query_parameters/filters.rb +67 -0
- data/lib/delivery/query_parameters/parameter_base.rb +14 -4
- data/lib/delivery/query_parameters/query_string.rb +28 -3
- data/lib/delivery/resolvers/content_link_resolver.rb +30 -6
- data/lib/delivery/resolvers/inline_content_item_resolver.rb +26 -5
- data/lib/delivery/resolvers/linked_item_resolver.rb +26 -21
- data/lib/delivery/responses/delivery_element_response.rb +7 -1
- data/lib/delivery/responses/delivery_item_listing_response.rb +12 -2
- data/lib/delivery/responses/delivery_item_response.rb +9 -3
- data/lib/delivery/responses/delivery_taxonomy_listing_response.rb +11 -1
- data/lib/delivery/responses/delivery_taxonomy_response.rb +7 -1
- data/lib/delivery/responses/delivery_type_listing_response.rb +11 -1
- data/lib/delivery/responses/delivery_type_response.rb +7 -1
- data/lib/delivery/responses/response_base.rb +13 -1
- data/lib/delivery/version.rb +1 -1
- metadata +2 -2
@@ -3,8 +3,14 @@ require 'delivery/responses/response_base'
|
|
3
3
|
module KenticoCloud
|
4
4
|
module Delivery
|
5
5
|
module Responses
|
6
|
-
#
|
6
|
+
# The response of a successful query of a content type's element
|
7
|
+
# See https://github.com/Kentico/delivery-sdk-ruby#retrieving-content-type-elements
|
7
8
|
class DeliveryElementResponse < ResponseBase
|
9
|
+
# An element's definition from a
|
10
|
+
# KenticoCloud::Delivery::DeliveryClient.element call
|
11
|
+
#
|
12
|
+
# * *Returns*:
|
13
|
+
# - +OpenStruct+ The element of a content item
|
8
14
|
def element
|
9
15
|
@element unless @element.nil?
|
10
16
|
@element = JSON.parse(
|
@@ -5,16 +5,26 @@ require 'delivery/responses/response_base'
|
|
5
5
|
module KenticoCloud
|
6
6
|
module Delivery
|
7
7
|
module Responses
|
8
|
-
#
|
8
|
+
# The response of a successful query for content items.
|
9
|
+
# See https://github.com/Kentico/delivery-sdk-ruby#listing-items
|
9
10
|
class DeliveryItemListingResponse < ResponseBase
|
11
|
+
# Parses the 'pagination' JSON node of the response.
|
12
|
+
#
|
13
|
+
# * *Returns*:
|
14
|
+
# - KenticoCloud::Delivery::Pagination
|
10
15
|
def pagination
|
11
16
|
@pagination unless @pagination.nil?
|
12
17
|
@pagination = Pagination.new @response['pagination']
|
13
18
|
end
|
14
19
|
|
20
|
+
# A collection of KenticoCloud::Delivery::ContentItem objects from
|
21
|
+
# a KenticoCloud::Delivery::DeliveryClient.items call.
|
22
|
+
#
|
23
|
+
# * *Returns*:
|
24
|
+
# - +Array+ One or more KenticoCloud::Delivery::ContentItem objects
|
15
25
|
def items
|
16
26
|
@items unless @items.nil?
|
17
|
-
linked_items_resolver = LinkedItemResolver.new @response['modular_content'], @content_link_url_resolver, @inline_content_item_resolver
|
27
|
+
linked_items_resolver = KenticoCloud::Delivery::Resolvers::LinkedItemResolver.new @response['modular_content'], @content_link_url_resolver, @inline_content_item_resolver
|
18
28
|
items = []
|
19
29
|
@response['items'].each do |n|
|
20
30
|
items << KenticoCloud::Delivery::ContentItem.new(
|
@@ -4,11 +4,17 @@ require 'delivery/responses/response_base'
|
|
4
4
|
module KenticoCloud
|
5
5
|
module Delivery
|
6
6
|
module Responses
|
7
|
-
#
|
7
|
+
# The response of a successful query for a content item.
|
8
|
+
# See https://github.com/Kentico/delivery-sdk-ruby#listing-items
|
8
9
|
class DeliveryItemResponse < ResponseBase
|
10
|
+
# A KenticoCloud::Delivery::ContentItem object from a
|
11
|
+
# KenticoCloud::Delivery::DeliveryClient.item call.
|
12
|
+
#
|
13
|
+
# * *Returns*:
|
14
|
+
# - KenticoCloud::Delivery::ContentItem
|
9
15
|
def item
|
10
16
|
@item unless @item.nil?
|
11
|
-
linked_items_resolver = LinkedItemResolver.new @response['modular_content'], @content_link_url_resolver, @inline_content_item_resolver
|
17
|
+
linked_items_resolver = KenticoCloud::Delivery::Resolvers::LinkedItemResolver.new @response['modular_content'], @content_link_url_resolver, @inline_content_item_resolver
|
12
18
|
@item = KenticoCloud::Delivery::ContentItem.new(
|
13
19
|
@response,
|
14
20
|
@content_link_url_resolver,
|
@@ -22,7 +28,7 @@ module KenticoCloud
|
|
22
28
|
@content_link_url_resolver = content_link_url_resolver
|
23
29
|
@inline_content_item_resolver = inline_content_item_resolver
|
24
30
|
super 200,
|
25
|
-
"Success, '#{item.system.
|
31
|
+
"Success, '#{item.system.codename}' returned",
|
26
32
|
JSON.generate(@response)
|
27
33
|
end
|
28
34
|
end
|
@@ -5,13 +5,23 @@ require 'delivery/responses/response_base'
|
|
5
5
|
module KenticoCloud
|
6
6
|
module Delivery
|
7
7
|
module Responses
|
8
|
-
#
|
8
|
+
# The response of a successful query for taxonomy groups.
|
9
|
+
# See https://github.com/Kentico/delivery-sdk-ruby#taxonomy
|
9
10
|
class DeliveryTaxonomyListingResponse < ResponseBase
|
11
|
+
# Parses the 'pagination' JSON node of the response.
|
12
|
+
#
|
13
|
+
# * *Returns*:
|
14
|
+
# - KenticoCloud::Delivery::Pagination
|
10
15
|
def pagination
|
11
16
|
@pagination unless @pagination.nil?
|
12
17
|
@pagination = Pagination.new @response['pagination']
|
13
18
|
end
|
14
19
|
|
20
|
+
# Parses the 'taxonomies' JSON node of the response from a
|
21
|
+
# KenticoCloud::Delivery::DeliveryClient.taxonomies call.
|
22
|
+
#
|
23
|
+
# * *Returns*:
|
24
|
+
# - +Array+ The taxonomy groups as KenticoCloud::Delivery::TaxonomyGroup objects
|
15
25
|
def taxonomies
|
16
26
|
@taxonomies unless @taxonomies.nil?
|
17
27
|
taxonomies = []
|
@@ -4,8 +4,14 @@ require 'delivery/responses/response_base'
|
|
4
4
|
module KenticoCloud
|
5
5
|
module Delivery
|
6
6
|
module Responses
|
7
|
-
#
|
7
|
+
# The response of a successful query for a taxonomy group.
|
8
|
+
# See https://github.com/Kentico/delivery-sdk-ruby#taxonomy
|
8
9
|
class DeliveryTaxonomyResponse < ResponseBase
|
10
|
+
# Parses the response from a
|
11
|
+
# KenticoCloud::Delivery::DeliveryClient.taxonomy call.
|
12
|
+
#
|
13
|
+
# * *Returns*:
|
14
|
+
# - KenticoCloud::Delivery::TaxonomyGroup
|
9
15
|
def taxonomy
|
10
16
|
@taxonomy unless @taxonomy.nil?
|
11
17
|
@taxonomy = KenticoCloud::Delivery::TaxonomyGroup.new(@response)
|
@@ -5,13 +5,23 @@ require 'delivery/responses/response_base'
|
|
5
5
|
module KenticoCloud
|
6
6
|
module Delivery
|
7
7
|
module Responses
|
8
|
-
#
|
8
|
+
# The response of a successful query for content types.
|
9
|
+
# See https://github.com/Kentico/delivery-sdk-ruby#retrieving-content-types
|
9
10
|
class DeliveryTypeListingResponse < ResponseBase
|
11
|
+
# Parses the 'pagination' JSON node of the response.
|
12
|
+
#
|
13
|
+
# * *Returns*:
|
14
|
+
# - KenticoCloud::Delivery::Pagination
|
10
15
|
def pagination
|
11
16
|
@pagination unless @pagination.nil?
|
12
17
|
@pagination = Pagination.new @response['pagination']
|
13
18
|
end
|
14
19
|
|
20
|
+
# Parses the 'types' JSON node of the response from a
|
21
|
+
# KenticoCloud::Delivery::DeliveryClient.types call.
|
22
|
+
#
|
23
|
+
# * *Returns*:
|
24
|
+
# - +Array+ The content types as KenticoCloud::Delivery::ContentType objects
|
15
25
|
def types
|
16
26
|
@types unless @types.nil?
|
17
27
|
types = []
|
@@ -4,8 +4,14 @@ require 'delivery/responses/response_base'
|
|
4
4
|
module KenticoCloud
|
5
5
|
module Delivery
|
6
6
|
module Responses
|
7
|
-
#
|
7
|
+
# The response of a successful query for a content type.
|
8
|
+
# See https://github.com/Kentico/delivery-sdk-ruby#retrieving-content-types
|
8
9
|
class DeliveryTypeResponse < ResponseBase
|
10
|
+
# A KenticoCloud::Delivery::ContentType object from a
|
11
|
+
# KenticoCloud::Delivery::DeliveryClient.type call.
|
12
|
+
#
|
13
|
+
# * *Returns*:
|
14
|
+
# - KenticoCloud::Delivery::ContentType
|
9
15
|
def type
|
10
16
|
@type unless @type.nil?
|
11
17
|
@type = KenticoCloud::Delivery::ContentType.new(@response)
|
@@ -1,18 +1,30 @@
|
|
1
1
|
module KenticoCloud
|
2
2
|
module Delivery
|
3
3
|
module Responses
|
4
|
-
# Base class for all responses from
|
4
|
+
# Base class for all responses from a
|
5
|
+
# KenticoCloud::Delivery::DeliveryQuery.execute call.
|
5
6
|
class ResponseBase
|
6
7
|
attr_accessor :http_code,
|
7
8
|
:message,
|
8
9
|
:json
|
9
10
|
|
11
|
+
# Constructor.
|
12
|
+
#
|
13
|
+
# * *Args*:
|
14
|
+
# - *http_code* (+integer+) The status code returned by the REST request
|
15
|
+
# - *message* (+string+) An informative message about the response, visible when calling +to_s+
|
16
|
+
# - *json* (+string+) _optional_ The complete, unmodified JSON response from the server
|
10
17
|
def initialize(http_code, message, json = '')
|
11
18
|
self.http_code = http_code
|
12
19
|
self.message = message
|
13
20
|
self.json = json
|
14
21
|
end
|
15
22
|
|
23
|
+
# Provides an informative message about the success of the request
|
24
|
+
# by combining the status code and message.
|
25
|
+
#
|
26
|
+
# * *Returns*:
|
27
|
+
# - +string+
|
16
28
|
def to_s
|
17
29
|
"Response is status code #{http_code} with message:\n#{message}"
|
18
30
|
end
|
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.
|
4
|
+
version: 1.0.0
|
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-03-
|
11
|
+
date: 2019-03-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|