kontent-delivery-sdk-ruby 2.0.24 → 2.0.25

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE.md +21 -21
  3. data/README.md +603 -603
  4. data/bin/console +14 -14
  5. data/bin/setup +8 -8
  6. data/lib/delivery/builders/image_transformation_builder.rb +272 -272
  7. data/lib/delivery/builders/url_builder.rb +123 -123
  8. data/lib/delivery/client/delivery_client.rb +184 -184
  9. data/lib/delivery/client/delivery_query.rb +302 -302
  10. data/lib/delivery/client/request_manager.rb +126 -126
  11. data/lib/delivery/models/content_item.rb +153 -153
  12. data/lib/delivery/models/content_type.rb +41 -41
  13. data/lib/delivery/models/language.rb +29 -29
  14. data/lib/delivery/models/pagination.rb +22 -22
  15. data/lib/delivery/models/taxonomy_group.rb +39 -39
  16. data/lib/delivery/query_parameters/filters.rb +201 -201
  17. data/lib/delivery/query_parameters/parameter_base.rb +56 -56
  18. data/lib/delivery/query_parameters/query_string.rb +78 -78
  19. data/lib/delivery/resolvers/content_link_resolver.rb +102 -102
  20. data/lib/delivery/resolvers/inline_content_item_resolver.rb +75 -75
  21. data/lib/delivery/resolvers/linked_item_resolver.rb +43 -43
  22. data/lib/delivery/responses/delivery_element_response.rb +34 -34
  23. data/lib/delivery/responses/delivery_item_listing_response.rb +54 -54
  24. data/lib/delivery/responses/delivery_item_response.rb +40 -40
  25. data/lib/delivery/responses/delivery_items_feed_response.rb +58 -58
  26. data/lib/delivery/responses/delivery_language_listing_response.rb +44 -44
  27. data/lib/delivery/responses/delivery_taxonomy_listing_response.rb +47 -47
  28. data/lib/delivery/responses/delivery_taxonomy_response.rb +33 -33
  29. data/lib/delivery/responses/delivery_type_listing_response.rb +46 -46
  30. data/lib/delivery/responses/delivery_type_response.rb +32 -32
  31. data/lib/delivery/responses/response_base.rb +39 -39
  32. data/lib/delivery/tests/401.json +5 -5
  33. data/lib/delivery/tests/429.json +4 -4
  34. data/lib/delivery/tests/fake_responder.rb +99 -99
  35. data/lib/delivery/tests/filtering/items_with_count.json +5384 -5384
  36. data/lib/delivery/tests/filtering/pagination.json +761 -761
  37. data/lib/delivery/tests/generic/items.json +5383 -5383
  38. data/lib/delivery/tests/generic/items/about_us.json +276 -276
  39. data/lib/delivery/tests/generic/items/aeropress_filters.json +155 -155
  40. data/lib/delivery/tests/generic/items/coffee_processing_techniques.json +565 -565
  41. data/lib/delivery/tests/generic/items/where_does_coffee_come_from_.json +598 -598
  42. data/lib/delivery/tests/generic/languages.json +23 -23
  43. data/lib/delivery/tests/generic/taxonomies.json +203 -203
  44. data/lib/delivery/tests/generic/taxonomies/manufacturer.json +29 -29
  45. data/lib/delivery/tests/generic/types.json +835 -835
  46. data/lib/delivery/tests/generic/types/brewer.json +88 -88
  47. data/lib/delivery/tests/generic/types/brewer/elements/product_status.json +5 -5
  48. data/lib/delivery/tests/items_feed/articles_feed_1.json +39 -39
  49. data/lib/delivery/tests/items_feed/articles_feed_2.json +78 -78
  50. data/lib/delivery/tests/items_feed/articles_feed_3.json +104 -104
  51. data/lib/kontent-delivery-sdk-ruby.rb +22 -22
  52. metadata +12 -13
@@ -1,123 +1,123 @@
1
- module Kentico
2
- module Kontent
3
- module Delivery
4
- module Builders
5
- # Internal class which generates the URL required for Delivery REST API
6
- class UrlBuilder
7
- URL_TEMPLATE_BASE = 'https://deliver.kontent.ai/%s'.freeze
8
- URL_TEMPLATE_PREVIEW = 'https://preview-deliver.kontent.ai/%s'.freeze
9
- URL_TEMPLATE_ITEM = '/items/%s'.freeze
10
- URL_TEMPLATE_ITEMS = '/items'.freeze
11
- URL_TEMPLATE_TYPE = '/types/%s'.freeze
12
- URL_TEMPLATE_TYPES = '/types'.freeze
13
- URL_TEMPLATE_ELEMENTS = '/types/%s/elements/%s'.freeze
14
- URL_TEMPLATE_TAXONOMY = '/taxonomies/%s'.freeze
15
- URL_TEMPLATE_TAXONOMIES = '/taxonomies'.freeze
16
- URL_TEMPLATE_ITEMS_FEED = '/items-feed'.freeze
17
- URL_TEMPLATE_LANGUAGES = '/languages'.freeze
18
-
19
- URL_MAX_LENGTH = 65_519
20
- MSG_LONG_QUERY = 'The request url is too long. Split your query into multiple calls.'.freeze
21
-
22
- class << self
23
- # Returns the proper domain for the request along with the
24
- # query string parameters configured by the +DeliveryQuery+.
25
- #
26
- # * *Args*:
27
- # - *query* ( Kentico::Kontent::Delivery::DeliveryQuery )
28
- #
29
- # * *Returns*:
30
- # - +string+ The full URL for a Delivery request
31
- def provide_url(query)
32
- url = provide_base_url(query)
33
- url += provide_path_part(query)
34
-
35
- if query.query_string.empty?
36
- url
37
- else
38
- url + query.query_string.to_s
39
- end
40
- end
41
-
42
- # Checks whether the provided URL is too long and raises an error if so.
43
- #
44
- # * *Args*:
45
- # - *url* (+string+) A full Delivery URL
46
- #
47
- # * *Raises*:
48
- # - +UriFormatException+ if the URL is 65,519 characters or more
49
- def validate_url(url)
50
- raise UriFormatException, MSG_LONG_QUERY if url.length > URL_MAX_LENGTH
51
- end
52
-
53
- private
54
-
55
- # Returns relative path part of URL depending on query type.
56
- #
57
- # * *Args*:
58
- # - *query* ( Kentico::Kontent::Delivery::DeliveryQuery )
59
- #
60
- # * *Returns*:
61
- # - +string+ The URL path part (without protocol or domain)
62
- def provide_path_part(query)
63
- case query.query_type
64
- when Kentico::Kontent::Delivery::QUERY_TYPE_ITEMS
65
- provide_item query
66
- when Kentico::Kontent::Delivery::QUERY_TYPE_TYPES
67
- provide_type query
68
- when Kentico::Kontent::Delivery::QUERY_TYPE_TAXONOMIES
69
- provide_taxonomy query
70
- when Kentico::Kontent::Delivery::QUERY_TYPE_LANGUAGES
71
- URL_TEMPLATE_LANGUAGES
72
- when Kentico::Kontent::Delivery::QUERY_TYPE_ELEMENT
73
- format(URL_TEMPLATE_ELEMENTS, query.content_type, query.code_name)
74
- when Kentico::Kontent::Delivery::QUERY_TYPE_ITEMS_FEED
75
- URL_TEMPLATE_ITEMS_FEED
76
- end
77
- end
78
-
79
- def provide_item(query)
80
- if query.code_name.nil?
81
- URL_TEMPLATE_ITEMS
82
- else
83
- format(URL_TEMPLATE_ITEM, query.code_name)
84
- end
85
- end
86
-
87
- def provide_taxonomy(query)
88
- if query.code_name.nil?
89
- URL_TEMPLATE_TAXONOMIES
90
- else
91
- format(URL_TEMPLATE_TAXONOMY, query.code_name)
92
- end
93
- end
94
-
95
- def provide_type(query)
96
- if query.code_name.nil?
97
- URL_TEMPLATE_TYPES
98
- else
99
- format(URL_TEMPLATE_TYPE, query.code_name)
100
- end
101
- end
102
-
103
- # Returns the protocol and domain with project ID. Domain changes
104
- # according to the query's +use_preview+ attribute.
105
- #
106
- # * *Args*:
107
- # - *query* ( Kentico::Kontent::Delivery::DeliveryQuery )
108
- #
109
- # * *Returns*:
110
- # - +string+ The URL with the project ID
111
- def provide_base_url(query)
112
- if query.use_preview
113
- format(URL_TEMPLATE_PREVIEW, query.project_id)
114
- else
115
- format(URL_TEMPLATE_BASE, query.project_id)
116
- end
117
- end
118
- end
119
- end
120
- end
121
- end
122
- end
123
- end
1
+ module Kentico
2
+ module Kontent
3
+ module Delivery
4
+ module Builders
5
+ # Internal class which generates the URL required for Delivery REST API
6
+ class UrlBuilder
7
+ URL_TEMPLATE_BASE = 'https://deliver.kontent.ai/%s'.freeze
8
+ URL_TEMPLATE_PREVIEW = 'https://preview-deliver.kontent.ai/%s'.freeze
9
+ URL_TEMPLATE_ITEM = '/items/%s'.freeze
10
+ URL_TEMPLATE_ITEMS = '/items'.freeze
11
+ URL_TEMPLATE_TYPE = '/types/%s'.freeze
12
+ URL_TEMPLATE_TYPES = '/types'.freeze
13
+ URL_TEMPLATE_ELEMENTS = '/types/%s/elements/%s'.freeze
14
+ URL_TEMPLATE_TAXONOMY = '/taxonomies/%s'.freeze
15
+ URL_TEMPLATE_TAXONOMIES = '/taxonomies'.freeze
16
+ URL_TEMPLATE_ITEMS_FEED = '/items-feed'.freeze
17
+ URL_TEMPLATE_LANGUAGES = '/languages'.freeze
18
+
19
+ URL_MAX_LENGTH = 65_519
20
+ MSG_LONG_QUERY = 'The request url is too long. Split your query into multiple calls.'.freeze
21
+
22
+ class << self
23
+ # Returns the proper domain for the request along with the
24
+ # query string parameters configured by the +DeliveryQuery+.
25
+ #
26
+ # * *Args*:
27
+ # - *query* ( Kentico::Kontent::Delivery::DeliveryQuery )
28
+ #
29
+ # * *Returns*:
30
+ # - +string+ The full URL for a Delivery request
31
+ def provide_url(query)
32
+ url = provide_base_url(query)
33
+ url += provide_path_part(query)
34
+
35
+ if query.query_string.empty?
36
+ url
37
+ else
38
+ url + query.query_string.to_s
39
+ end
40
+ end
41
+
42
+ # Checks whether the provided URL is too long and raises an error if so.
43
+ #
44
+ # * *Args*:
45
+ # - *url* (+string+) A full Delivery URL
46
+ #
47
+ # * *Raises*:
48
+ # - +UriFormatException+ if the URL is 65,519 characters or more
49
+ def validate_url(url)
50
+ raise UriFormatException, MSG_LONG_QUERY if url.length > URL_MAX_LENGTH
51
+ end
52
+
53
+ private
54
+
55
+ # Returns relative path part of URL depending on query type.
56
+ #
57
+ # * *Args*:
58
+ # - *query* ( Kentico::Kontent::Delivery::DeliveryQuery )
59
+ #
60
+ # * *Returns*:
61
+ # - +string+ The URL path part (without protocol or domain)
62
+ def provide_path_part(query)
63
+ case query.query_type
64
+ when Kentico::Kontent::Delivery::QUERY_TYPE_ITEMS
65
+ provide_item query
66
+ when Kentico::Kontent::Delivery::QUERY_TYPE_TYPES
67
+ provide_type query
68
+ when Kentico::Kontent::Delivery::QUERY_TYPE_TAXONOMIES
69
+ provide_taxonomy query
70
+ when Kentico::Kontent::Delivery::QUERY_TYPE_LANGUAGES
71
+ URL_TEMPLATE_LANGUAGES
72
+ when Kentico::Kontent::Delivery::QUERY_TYPE_ELEMENT
73
+ format(URL_TEMPLATE_ELEMENTS, query.content_type, query.code_name)
74
+ when Kentico::Kontent::Delivery::QUERY_TYPE_ITEMS_FEED
75
+ URL_TEMPLATE_ITEMS_FEED
76
+ end
77
+ end
78
+
79
+ def provide_item(query)
80
+ if query.code_name.nil?
81
+ URL_TEMPLATE_ITEMS
82
+ else
83
+ format(URL_TEMPLATE_ITEM, query.code_name)
84
+ end
85
+ end
86
+
87
+ def provide_taxonomy(query)
88
+ if query.code_name.nil?
89
+ URL_TEMPLATE_TAXONOMIES
90
+ else
91
+ format(URL_TEMPLATE_TAXONOMY, query.code_name)
92
+ end
93
+ end
94
+
95
+ def provide_type(query)
96
+ if query.code_name.nil?
97
+ URL_TEMPLATE_TYPES
98
+ else
99
+ format(URL_TEMPLATE_TYPE, query.code_name)
100
+ end
101
+ end
102
+
103
+ # Returns the protocol and domain with project ID. Domain changes
104
+ # according to the query's +use_preview+ attribute.
105
+ #
106
+ # * *Args*:
107
+ # - *query* ( Kentico::Kontent::Delivery::DeliveryQuery )
108
+ #
109
+ # * *Returns*:
110
+ # - +string+ The URL with the project ID
111
+ def provide_base_url(query)
112
+ if query.use_preview
113
+ format(URL_TEMPLATE_PREVIEW, query.project_id)
114
+ else
115
+ format(URL_TEMPLATE_BASE, query.project_id)
116
+ end
117
+ end
118
+ end
119
+ end
120
+ end
121
+ end
122
+ end
123
+ end
@@ -1,184 +1,184 @@
1
- require 'delivery/client/delivery_query'
2
- require 'delivery/responses/delivery_item_listing_response'
3
- require 'delivery/responses/delivery_item_response'
4
- require 'json'
5
-
6
- module Kentico
7
- module Kontent
8
- module Delivery
9
- QUERY_TYPE_TYPES = 'QUERY_TYPE_TYPES'.freeze
10
- QUERY_TYPE_ITEMS = 'QUERY_TYPE_ITEMS'.freeze
11
- QUERY_TYPE_TAXONOMIES = 'QUERY_TYPE_TAXONOMIES'.freeze
12
- QUERY_TYPE_ELEMENT = 'QUERY_TYPE_ELEMENT'.freeze
13
- QUERY_TYPE_ITEMS_FEED = 'QUERY_TYPE_ITEMS_FEED'.freeze
14
- QUERY_TYPE_LANGUAGES = 'QUERY_TYPE_LANGUAGES'.freeze
15
-
16
- # Executes requests against the Kentico Kontent Delivery API.
17
- class DeliveryClient
18
- attr_accessor :use_preview
19
-
20
- # Constructor. Accepts a hash with the options for client.
21
- #
22
- # * *Args*:
23
- # - *config* (+Hash+) May contain the following keys:
24
- # - project_id (+string+) _required_
25
- # - preview_key (+string+)
26
- # - secure_key (+string+)
27
- # - content_link_url_resolver ( Kentico::Kontent::Delivery::Resolvers::ContentLinkResolver )
28
- # - inline_content_item_resolver ( Kentico::Kontent::Delivery::Resolvers::InlineContentItemResolver )
29
- # - with_retry_policy (+bool+)
30
- def initialize(config)
31
- @project_id = config.fetch(:project_id)
32
- @preview_key = config.fetch(:preview_key, nil)
33
- @secure_key = config.fetch(:secure_key, nil)
34
- @content_link_url_resolver = config.fetch(:content_link_url_resolver, nil)
35
- @inline_content_item_resolver = config.fetch(:inline_content_item_resolver, nil)
36
- @with_retry_policy = config.fetch(:with_retry_policy, true)
37
- self.use_preview = !@preview_key.nil?
38
- end
39
-
40
- # Return all content types of the project
41
- #
42
- # * *Returns*:
43
- # - Kentico::Kontent::Delivery::DeliveryQuery
44
- def types
45
- DeliveryQuery.new project_id: @project_id,
46
- secure_key: @secure_key,
47
- query_type: QUERY_TYPE_TYPES,
48
- with_retry_policy: @with_retry_policy
49
- end
50
-
51
- # Return a single content type of the project
52
- #
53
- # * *Args*:
54
- # - *code_name* (+string+) Code name of the desired content type
55
- #
56
- # * *Returns*:
57
- # - Kentico::Kontent::Delivery::DeliveryQuery
58
- def type(code_name)
59
- DeliveryQuery.new project_id: @project_id,
60
- secure_key: @secure_key,
61
- code_name: code_name,
62
- query_type: QUERY_TYPE_TYPES,
63
- with_retry_policy: @with_retry_policy
64
- end
65
-
66
- # Return a paginated feed of all content items of the project
67
- #
68
- # * *Args*:
69
- # - *query_parameters* (+Array+) _optional_ One or more Kentico::Kontent::Delivery::QueryParameters::Filter objects. A single object will automatically be converted into an Array.
70
- #
71
- # * *Returns*:
72
- # - Kentico::Kontent::Delivery::DeliveryQuery
73
- def items_feed(query_parameters = [])
74
- q = DeliveryQuery.new project_id: @project_id,
75
- secure_key: @secure_key,
76
- qp: query_parameters,
77
- content_link_url_resolver: @content_link_url_resolver,
78
- inline_content_item_resolver: @inline_content_item_resolver,
79
- query_type: QUERY_TYPE_ITEMS_FEED,
80
- with_retry_policy: @with_retry_policy
81
- q.use_preview = use_preview
82
- q.preview_key = @preview_key
83
- q
84
- end
85
-
86
- # Return all content items of the project
87
- #
88
- # * *Args*:
89
- # - *query_parameters* (+Array+) _optional_ One or more Kentico::Kontent::Delivery::QueryParameters::Filter objects. A single object will automatically be converted into an Array.
90
- #
91
- # * *Returns*:
92
- # - Kentico::Kontent::Delivery::DeliveryQuery
93
- def items(query_parameters = [])
94
- q = DeliveryQuery.new project_id: @project_id,
95
- secure_key: @secure_key,
96
- qp: query_parameters,
97
- content_link_url_resolver: @content_link_url_resolver,
98
- inline_content_item_resolver: @inline_content_item_resolver,
99
- query_type: QUERY_TYPE_ITEMS,
100
- with_retry_policy: @with_retry_policy
101
- q.use_preview = use_preview
102
- q.preview_key = @preview_key
103
- q
104
- end
105
-
106
- # Return a single content item of the project
107
- #
108
- # * *Args*:
109
- # - *code_name* (+string+) The code name of the desired content item
110
- # - *query_parameters* (+Array+) _optional_ One or more Kentico::Kontent::Delivery::QueryParameters::Filter objects. A single object will automatically be converted into an Array.
111
- #
112
- # * *Returns*:
113
- # - Kentico::Kontent::Delivery::DeliveryQuery
114
- def item(code_name, query_parameters = [])
115
- q = DeliveryQuery.new project_id: @project_id,
116
- secure_key: @secure_key,
117
- code_name: code_name,
118
- qp: query_parameters,
119
- content_link_url_resolver: @content_link_url_resolver,
120
- inline_content_item_resolver: @inline_content_item_resolver,
121
- query_type: QUERY_TYPE_ITEMS,
122
- with_retry_policy: @with_retry_policy
123
- q.use_preview = use_preview
124
- q.preview_key = @preview_key
125
- q
126
- end
127
-
128
- # Return all taxonomy groups of the project
129
- #
130
- # * *Args*:
131
- # - *query_parameters* (+Array+) _optional_ One or more Kentico::Kontent::Delivery::QueryParameters::Filter objects. A single object will automatically be converted into an Array.
132
- #
133
- # * *Returns*:
134
- # - Kentico::Kontent::Delivery::DeliveryQuery
135
- def taxonomies(query_parameters = [])
136
- DeliveryQuery.new project_id: @project_id,
137
- secure_key: @secure_key,
138
- qp: query_parameters,
139
- query_type: QUERY_TYPE_TAXONOMIES,
140
- with_retry_policy: @with_retry_policy
141
- end
142
-
143
- # Return a single taxonomy group of the project
144
- #
145
- # * *Args*:
146
- # - *code_name* (+string+) The code name of the desired taxonomy group
147
- #
148
- # * *Returns*:
149
- # - Kentico::Kontent::Delivery::DeliveryQuery
150
- def taxonomy(code_name)
151
- DeliveryQuery.new project_id: @project_id,
152
- secure_key: @secure_key,
153
- code_name: code_name,
154
- query_type: QUERY_TYPE_TAXONOMIES,
155
- with_retry_policy: @with_retry_policy
156
- end
157
-
158
- # Return a single element of a content type
159
- #
160
- # * *Args*:
161
- # - *content_type* (+string+) The code name of the content type containing the element
162
- # - *element* (+string+) The code name of the desired element
163
- #
164
- # * *Returns*:
165
- # - Kentico::Kontent::Delivery::DeliveryQuery
166
- def element(content_type, element)
167
- DeliveryQuery.new project_id: @project_id,
168
- secure_key: @secure_key,
169
- code_name: element,
170
- content_type: content_type,
171
- query_type: QUERY_TYPE_ELEMENT,
172
- with_retry_policy: @with_retry_policy
173
- end
174
-
175
- def languages
176
- DeliveryQuery.new project_id: @project_id,
177
- secure_key: @secure_key,
178
- query_type: QUERY_TYPE_LANGUAGES,
179
- with_retry_policy: @with_retry_policy
180
- end
181
- end
182
- end
183
- end
184
- end
1
+ require 'delivery/client/delivery_query'
2
+ require 'delivery/responses/delivery_item_listing_response'
3
+ require 'delivery/responses/delivery_item_response'
4
+ require 'json'
5
+
6
+ module Kentico
7
+ module Kontent
8
+ module Delivery
9
+ QUERY_TYPE_TYPES = 'QUERY_TYPE_TYPES'.freeze
10
+ QUERY_TYPE_ITEMS = 'QUERY_TYPE_ITEMS'.freeze
11
+ QUERY_TYPE_TAXONOMIES = 'QUERY_TYPE_TAXONOMIES'.freeze
12
+ QUERY_TYPE_ELEMENT = 'QUERY_TYPE_ELEMENT'.freeze
13
+ QUERY_TYPE_ITEMS_FEED = 'QUERY_TYPE_ITEMS_FEED'.freeze
14
+ QUERY_TYPE_LANGUAGES = 'QUERY_TYPE_LANGUAGES'.freeze
15
+
16
+ # Executes requests against the Kentico Kontent Delivery API.
17
+ class DeliveryClient
18
+ attr_accessor :use_preview
19
+
20
+ # Constructor. Accepts a hash with the options for client.
21
+ #
22
+ # * *Args*:
23
+ # - *config* (+Hash+) May contain the following keys:
24
+ # - project_id (+string+) _required_
25
+ # - preview_key (+string+)
26
+ # - secure_key (+string+)
27
+ # - content_link_url_resolver ( Kentico::Kontent::Delivery::Resolvers::ContentLinkResolver )
28
+ # - inline_content_item_resolver ( Kentico::Kontent::Delivery::Resolvers::InlineContentItemResolver )
29
+ # - with_retry_policy (+bool+)
30
+ def initialize(config)
31
+ @project_id = config.fetch(:project_id)
32
+ @preview_key = config.fetch(:preview_key, nil)
33
+ @secure_key = config.fetch(:secure_key, nil)
34
+ @content_link_url_resolver = config.fetch(:content_link_url_resolver, nil)
35
+ @inline_content_item_resolver = config.fetch(:inline_content_item_resolver, nil)
36
+ @with_retry_policy = config.fetch(:with_retry_policy, true)
37
+ self.use_preview = !@preview_key.nil?
38
+ end
39
+
40
+ # Return all content types of the project
41
+ #
42
+ # * *Returns*:
43
+ # - Kentico::Kontent::Delivery::DeliveryQuery
44
+ def types
45
+ DeliveryQuery.new project_id: @project_id,
46
+ secure_key: @secure_key,
47
+ query_type: QUERY_TYPE_TYPES,
48
+ with_retry_policy: @with_retry_policy
49
+ end
50
+
51
+ # Return a single content type of the project
52
+ #
53
+ # * *Args*:
54
+ # - *code_name* (+string+) Code name of the desired content type
55
+ #
56
+ # * *Returns*:
57
+ # - Kentico::Kontent::Delivery::DeliveryQuery
58
+ def type(code_name)
59
+ DeliveryQuery.new project_id: @project_id,
60
+ secure_key: @secure_key,
61
+ code_name: code_name,
62
+ query_type: QUERY_TYPE_TYPES,
63
+ with_retry_policy: @with_retry_policy
64
+ end
65
+
66
+ # Return a paginated feed of all content items of the project
67
+ #
68
+ # * *Args*:
69
+ # - *query_parameters* (+Array+) _optional_ One or more Kentico::Kontent::Delivery::QueryParameters::Filter objects. A single object will automatically be converted into an Array.
70
+ #
71
+ # * *Returns*:
72
+ # - Kentico::Kontent::Delivery::DeliveryQuery
73
+ def items_feed(query_parameters = [])
74
+ q = DeliveryQuery.new project_id: @project_id,
75
+ secure_key: @secure_key,
76
+ qp: query_parameters,
77
+ content_link_url_resolver: @content_link_url_resolver,
78
+ inline_content_item_resolver: @inline_content_item_resolver,
79
+ query_type: QUERY_TYPE_ITEMS_FEED,
80
+ with_retry_policy: @with_retry_policy
81
+ q.use_preview = use_preview
82
+ q.preview_key = @preview_key
83
+ q
84
+ end
85
+
86
+ # Return all content items of the project
87
+ #
88
+ # * *Args*:
89
+ # - *query_parameters* (+Array+) _optional_ One or more Kentico::Kontent::Delivery::QueryParameters::Filter objects. A single object will automatically be converted into an Array.
90
+ #
91
+ # * *Returns*:
92
+ # - Kentico::Kontent::Delivery::DeliveryQuery
93
+ def items(query_parameters = [])
94
+ q = DeliveryQuery.new project_id: @project_id,
95
+ secure_key: @secure_key,
96
+ qp: query_parameters,
97
+ content_link_url_resolver: @content_link_url_resolver,
98
+ inline_content_item_resolver: @inline_content_item_resolver,
99
+ query_type: QUERY_TYPE_ITEMS,
100
+ with_retry_policy: @with_retry_policy
101
+ q.use_preview = use_preview
102
+ q.preview_key = @preview_key
103
+ q
104
+ end
105
+
106
+ # Return a single content item of the project
107
+ #
108
+ # * *Args*:
109
+ # - *code_name* (+string+) The code name of the desired content item
110
+ # - *query_parameters* (+Array+) _optional_ One or more Kentico::Kontent::Delivery::QueryParameters::Filter objects. A single object will automatically be converted into an Array.
111
+ #
112
+ # * *Returns*:
113
+ # - Kentico::Kontent::Delivery::DeliveryQuery
114
+ def item(code_name, query_parameters = [])
115
+ q = DeliveryQuery.new project_id: @project_id,
116
+ secure_key: @secure_key,
117
+ code_name: code_name,
118
+ qp: query_parameters,
119
+ content_link_url_resolver: @content_link_url_resolver,
120
+ inline_content_item_resolver: @inline_content_item_resolver,
121
+ query_type: QUERY_TYPE_ITEMS,
122
+ with_retry_policy: @with_retry_policy
123
+ q.use_preview = use_preview
124
+ q.preview_key = @preview_key
125
+ q
126
+ end
127
+
128
+ # Return all taxonomy groups of the project
129
+ #
130
+ # * *Args*:
131
+ # - *query_parameters* (+Array+) _optional_ One or more Kentico::Kontent::Delivery::QueryParameters::Filter objects. A single object will automatically be converted into an Array.
132
+ #
133
+ # * *Returns*:
134
+ # - Kentico::Kontent::Delivery::DeliveryQuery
135
+ def taxonomies(query_parameters = [])
136
+ DeliveryQuery.new project_id: @project_id,
137
+ secure_key: @secure_key,
138
+ qp: query_parameters,
139
+ query_type: QUERY_TYPE_TAXONOMIES,
140
+ with_retry_policy: @with_retry_policy
141
+ end
142
+
143
+ # Return a single taxonomy group of the project
144
+ #
145
+ # * *Args*:
146
+ # - *code_name* (+string+) The code name of the desired taxonomy group
147
+ #
148
+ # * *Returns*:
149
+ # - Kentico::Kontent::Delivery::DeliveryQuery
150
+ def taxonomy(code_name)
151
+ DeliveryQuery.new project_id: @project_id,
152
+ secure_key: @secure_key,
153
+ code_name: code_name,
154
+ query_type: QUERY_TYPE_TAXONOMIES,
155
+ with_retry_policy: @with_retry_policy
156
+ end
157
+
158
+ # Return a single element of a content type
159
+ #
160
+ # * *Args*:
161
+ # - *content_type* (+string+) The code name of the content type containing the element
162
+ # - *element* (+string+) The code name of the desired element
163
+ #
164
+ # * *Returns*:
165
+ # - Kentico::Kontent::Delivery::DeliveryQuery
166
+ def element(content_type, element)
167
+ DeliveryQuery.new project_id: @project_id,
168
+ secure_key: @secure_key,
169
+ code_name: element,
170
+ content_type: content_type,
171
+ query_type: QUERY_TYPE_ELEMENT,
172
+ with_retry_policy: @with_retry_policy
173
+ end
174
+
175
+ def languages
176
+ DeliveryQuery.new project_id: @project_id,
177
+ secure_key: @secure_key,
178
+ query_type: QUERY_TYPE_LANGUAGES,
179
+ with_retry_policy: @with_retry_policy
180
+ end
181
+ end
182
+ end
183
+ end
184
+ end