delivery-sdk-ruby 0.14.13 → 0.15.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE.md +21 -21
- data/README.md +461 -461
- data/bin/console +14 -14
- data/bin/setup +8 -8
- data/lib/delivery-sdk-ruby.rb +17 -17
- data/lib/delivery/builders/image_transformation_builder.rb +141 -141
- data/lib/delivery/builders/url_builder.rb +73 -73
- data/lib/delivery/client/delivery_client.rb +85 -85
- data/lib/delivery/client/delivery_query.rb +188 -183
- data/lib/delivery/models/content_item.rb +96 -96
- data/lib/delivery/models/content_type.rb +26 -26
- data/lib/delivery/models/pagination.rb +13 -13
- data/lib/delivery/models/taxonomy_group.rb +24 -24
- data/lib/delivery/query_parameters/filters.rb +87 -87
- data/lib/delivery/query_parameters/parameter_base.rb +30 -30
- data/lib/delivery/query_parameters/query_string.rb +49 -49
- data/lib/delivery/resolvers/content_link_resolver.rb +62 -62
- data/lib/delivery/resolvers/inline_content_item_resolver.rb +50 -50
- data/lib/delivery/resolvers/linked_item_resolver.rb +27 -27
- data/lib/delivery/responses/delivery_element_response.rb +23 -23
- data/lib/delivery/responses/delivery_item_listing_response.rb +39 -39
- data/lib/delivery/responses/delivery_item_response.rb +29 -29
- data/lib/delivery/responses/delivery_taxonomy_listing_response.rb +32 -32
- data/lib/delivery/responses/delivery_taxonomy_response.rb +22 -22
- data/lib/delivery/responses/delivery_type_listing_response.rb +31 -31
- data/lib/delivery/responses/delivery_type_response.rb +21 -21
- data/lib/delivery/responses/response_base.rb +20 -20
- data/lib/delivery/version.rb +3 -3
- metadata +13 -12
@@ -1,39 +1,39 @@
|
|
1
|
-
require 'delivery/models/content_item'
|
2
|
-
require 'delivery/models/pagination'
|
3
|
-
require 'delivery/responses/response_base'
|
4
|
-
|
5
|
-
module Delivery
|
6
|
-
module Responses
|
7
|
-
# Returned by DeliveryClient.items with an enumerable of ContentItems
|
8
|
-
class DeliveryItemListingResponse < ResponseBase
|
9
|
-
def pagination
|
10
|
-
@pagination unless @pagination.nil?
|
11
|
-
@pagination = Pagination.new @response['pagination']
|
12
|
-
end
|
13
|
-
|
14
|
-
def items
|
15
|
-
@items unless @items.nil?
|
16
|
-
linked_items_resolver = LinkedItemResolver.new @response['modular_content'], @content_link_url_resolver, @inline_content_item_resolver
|
17
|
-
items = []
|
18
|
-
@response['items'].each do |n|
|
19
|
-
items << Delivery::ContentItem.new(
|
20
|
-
n,
|
21
|
-
@content_link_url_resolver,
|
22
|
-
@inline_content_item_resolver,
|
23
|
-
linked_items_resolver
|
24
|
-
)
|
25
|
-
end
|
26
|
-
@items = items
|
27
|
-
end
|
28
|
-
|
29
|
-
def initialize(response, content_link_url_resolver, inline_content_item_resolver)
|
30
|
-
@response = response
|
31
|
-
@content_link_url_resolver = content_link_url_resolver
|
32
|
-
@inline_content_item_resolver = inline_content_item_resolver
|
33
|
-
super 200,
|
34
|
-
"Success, #{items.length} items returned",
|
35
|
-
JSON.generate(@response)
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
1
|
+
require 'delivery/models/content_item'
|
2
|
+
require 'delivery/models/pagination'
|
3
|
+
require 'delivery/responses/response_base'
|
4
|
+
|
5
|
+
module Delivery
|
6
|
+
module Responses
|
7
|
+
# Returned by DeliveryClient.items with an enumerable of ContentItems
|
8
|
+
class DeliveryItemListingResponse < ResponseBase
|
9
|
+
def pagination
|
10
|
+
@pagination unless @pagination.nil?
|
11
|
+
@pagination = Pagination.new @response['pagination']
|
12
|
+
end
|
13
|
+
|
14
|
+
def items
|
15
|
+
@items unless @items.nil?
|
16
|
+
linked_items_resolver = LinkedItemResolver.new @response['modular_content'], @content_link_url_resolver, @inline_content_item_resolver
|
17
|
+
items = []
|
18
|
+
@response['items'].each do |n|
|
19
|
+
items << Delivery::ContentItem.new(
|
20
|
+
n,
|
21
|
+
@content_link_url_resolver,
|
22
|
+
@inline_content_item_resolver,
|
23
|
+
linked_items_resolver
|
24
|
+
)
|
25
|
+
end
|
26
|
+
@items = items
|
27
|
+
end
|
28
|
+
|
29
|
+
def initialize(response, content_link_url_resolver, inline_content_item_resolver)
|
30
|
+
@response = response
|
31
|
+
@content_link_url_resolver = content_link_url_resolver
|
32
|
+
@inline_content_item_resolver = inline_content_item_resolver
|
33
|
+
super 200,
|
34
|
+
"Success, #{items.length} items returned",
|
35
|
+
JSON.generate(@response)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -1,29 +1,29 @@
|
|
1
|
-
require 'delivery/models/content_item'
|
2
|
-
require 'delivery/responses/response_base'
|
3
|
-
|
4
|
-
module Delivery
|
5
|
-
module Responses
|
6
|
-
# Returned by DeliveryClient.item containing a single ContentItem
|
7
|
-
class DeliveryItemResponse < ResponseBase
|
8
|
-
def item
|
9
|
-
@item unless @item.nil?
|
10
|
-
linked_items_resolver = LinkedItemResolver.new @response['modular_content'], @content_link_url_resolver, @inline_content_item_resolver
|
11
|
-
@item = Delivery::ContentItem.new(
|
12
|
-
@response,
|
13
|
-
@content_link_url_resolver,
|
14
|
-
@inline_content_item_resolver,
|
15
|
-
linked_items_resolver
|
16
|
-
)
|
17
|
-
end
|
18
|
-
|
19
|
-
def initialize(response, content_link_url_resolver, inline_content_item_resolver)
|
20
|
-
@response = response
|
21
|
-
@content_link_url_resolver = content_link_url_resolver
|
22
|
-
@inline_content_item_resolver = inline_content_item_resolver
|
23
|
-
super 200,
|
24
|
-
"Success, '#{item.system.code_name}' returned",
|
25
|
-
JSON.generate(@response)
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
1
|
+
require 'delivery/models/content_item'
|
2
|
+
require 'delivery/responses/response_base'
|
3
|
+
|
4
|
+
module Delivery
|
5
|
+
module Responses
|
6
|
+
# Returned by DeliveryClient.item containing a single ContentItem
|
7
|
+
class DeliveryItemResponse < ResponseBase
|
8
|
+
def item
|
9
|
+
@item unless @item.nil?
|
10
|
+
linked_items_resolver = LinkedItemResolver.new @response['modular_content'], @content_link_url_resolver, @inline_content_item_resolver
|
11
|
+
@item = Delivery::ContentItem.new(
|
12
|
+
@response,
|
13
|
+
@content_link_url_resolver,
|
14
|
+
@inline_content_item_resolver,
|
15
|
+
linked_items_resolver
|
16
|
+
)
|
17
|
+
end
|
18
|
+
|
19
|
+
def initialize(response, content_link_url_resolver, inline_content_item_resolver)
|
20
|
+
@response = response
|
21
|
+
@content_link_url_resolver = content_link_url_resolver
|
22
|
+
@inline_content_item_resolver = inline_content_item_resolver
|
23
|
+
super 200,
|
24
|
+
"Success, '#{item.system.code_name}' returned",
|
25
|
+
JSON.generate(@response)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -1,32 +1,32 @@
|
|
1
|
-
require 'delivery/models/taxonomy_group'
|
2
|
-
require 'delivery/models/pagination'
|
3
|
-
require 'delivery/responses/response_base'
|
4
|
-
|
5
|
-
module Delivery
|
6
|
-
module Responses
|
7
|
-
# Returned by DeliveryClient.taxonomies with an enumerable of TaxonomyGroups
|
8
|
-
class DeliveryTaxonomyListingResponse < ResponseBase
|
9
|
-
def pagination
|
10
|
-
@pagination unless @pagination.nil?
|
11
|
-
@pagination = Pagination.new @response['pagination']
|
12
|
-
end
|
13
|
-
|
14
|
-
def taxonomies
|
15
|
-
@taxonomies unless @taxonomies.nil?
|
16
|
-
taxonomies = []
|
17
|
-
@response['taxonomies'].each do |n|
|
18
|
-
taxonomies << Delivery::TaxonomyGroup.new(n)
|
19
|
-
end
|
20
|
-
@taxonomies = taxonomies
|
21
|
-
end
|
22
|
-
|
23
|
-
def initialize(response)
|
24
|
-
@response = response
|
25
|
-
|
26
|
-
super 200,
|
27
|
-
"Success, #{taxonomies.length} taxonomies returned",
|
28
|
-
JSON.generate(@response)
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
1
|
+
require 'delivery/models/taxonomy_group'
|
2
|
+
require 'delivery/models/pagination'
|
3
|
+
require 'delivery/responses/response_base'
|
4
|
+
|
5
|
+
module Delivery
|
6
|
+
module Responses
|
7
|
+
# Returned by DeliveryClient.taxonomies with an enumerable of TaxonomyGroups
|
8
|
+
class DeliveryTaxonomyListingResponse < ResponseBase
|
9
|
+
def pagination
|
10
|
+
@pagination unless @pagination.nil?
|
11
|
+
@pagination = Pagination.new @response['pagination']
|
12
|
+
end
|
13
|
+
|
14
|
+
def taxonomies
|
15
|
+
@taxonomies unless @taxonomies.nil?
|
16
|
+
taxonomies = []
|
17
|
+
@response['taxonomies'].each do |n|
|
18
|
+
taxonomies << Delivery::TaxonomyGroup.new(n)
|
19
|
+
end
|
20
|
+
@taxonomies = taxonomies
|
21
|
+
end
|
22
|
+
|
23
|
+
def initialize(response)
|
24
|
+
@response = response
|
25
|
+
|
26
|
+
super 200,
|
27
|
+
"Success, #{taxonomies.length} taxonomies returned",
|
28
|
+
JSON.generate(@response)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -1,22 +1,22 @@
|
|
1
|
-
require 'delivery/models/taxonomy_group'
|
2
|
-
require 'delivery/responses/response_base'
|
3
|
-
|
4
|
-
module Delivery
|
5
|
-
module Responses
|
6
|
-
# Returned by DeliveryClient.taxonomy containing a single TaxonomyGroup
|
7
|
-
class DeliveryTaxonomyResponse < ResponseBase
|
8
|
-
def taxonomy
|
9
|
-
@taxonomy unless @taxonomy.nil?
|
10
|
-
@taxonomy = Delivery::TaxonomyGroup.new(@response)
|
11
|
-
end
|
12
|
-
|
13
|
-
def initialize(response)
|
14
|
-
@response = response
|
15
|
-
|
16
|
-
super 200,
|
17
|
-
"Success, '#{taxonomy.system.codename}' returned",
|
18
|
-
JSON.generate(@response)
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
1
|
+
require 'delivery/models/taxonomy_group'
|
2
|
+
require 'delivery/responses/response_base'
|
3
|
+
|
4
|
+
module Delivery
|
5
|
+
module Responses
|
6
|
+
# Returned by DeliveryClient.taxonomy containing a single TaxonomyGroup
|
7
|
+
class DeliveryTaxonomyResponse < ResponseBase
|
8
|
+
def taxonomy
|
9
|
+
@taxonomy unless @taxonomy.nil?
|
10
|
+
@taxonomy = Delivery::TaxonomyGroup.new(@response)
|
11
|
+
end
|
12
|
+
|
13
|
+
def initialize(response)
|
14
|
+
@response = response
|
15
|
+
|
16
|
+
super 200,
|
17
|
+
"Success, '#{taxonomy.system.codename}' returned",
|
18
|
+
JSON.generate(@response)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -1,31 +1,31 @@
|
|
1
|
-
require 'delivery/models/content_type'
|
2
|
-
require 'delivery/models/pagination'
|
3
|
-
require 'delivery/responses/response_base'
|
4
|
-
|
5
|
-
module Delivery
|
6
|
-
module Responses
|
7
|
-
# Returned by DeliveryClient.types with an enumerable of ContentTypes
|
8
|
-
class DeliveryTypeListingResponse < ResponseBase
|
9
|
-
def pagination
|
10
|
-
@pagination unless @pagination.nil?
|
11
|
-
@pagination = Pagination.new @response['pagination']
|
12
|
-
end
|
13
|
-
|
14
|
-
def types
|
15
|
-
@types unless @types.nil?
|
16
|
-
types = []
|
17
|
-
@response['types'].each do |n|
|
18
|
-
types << Delivery::ContentType.new(n)
|
19
|
-
end
|
20
|
-
@types = types
|
21
|
-
end
|
22
|
-
|
23
|
-
def initialize(response)
|
24
|
-
@response = response
|
25
|
-
super 200,
|
26
|
-
"Success, #{types.length} types returned",
|
27
|
-
JSON.generate(@response)
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
1
|
+
require 'delivery/models/content_type'
|
2
|
+
require 'delivery/models/pagination'
|
3
|
+
require 'delivery/responses/response_base'
|
4
|
+
|
5
|
+
module Delivery
|
6
|
+
module Responses
|
7
|
+
# Returned by DeliveryClient.types with an enumerable of ContentTypes
|
8
|
+
class DeliveryTypeListingResponse < ResponseBase
|
9
|
+
def pagination
|
10
|
+
@pagination unless @pagination.nil?
|
11
|
+
@pagination = Pagination.new @response['pagination']
|
12
|
+
end
|
13
|
+
|
14
|
+
def types
|
15
|
+
@types unless @types.nil?
|
16
|
+
types = []
|
17
|
+
@response['types'].each do |n|
|
18
|
+
types << Delivery::ContentType.new(n)
|
19
|
+
end
|
20
|
+
@types = types
|
21
|
+
end
|
22
|
+
|
23
|
+
def initialize(response)
|
24
|
+
@response = response
|
25
|
+
super 200,
|
26
|
+
"Success, #{types.length} types returned",
|
27
|
+
JSON.generate(@response)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -1,21 +1,21 @@
|
|
1
|
-
require 'delivery/models/content_type'
|
2
|
-
require 'delivery/responses/response_base'
|
3
|
-
|
4
|
-
module Delivery
|
5
|
-
module Responses
|
6
|
-
# Returned by DeliveryClient.types with an enumerable of ContentTypes
|
7
|
-
class DeliveryTypeResponse < ResponseBase
|
8
|
-
def type
|
9
|
-
@type unless @type.nil?
|
10
|
-
@type = Delivery::ContentType.new(@response)
|
11
|
-
end
|
12
|
-
|
13
|
-
def initialize(response)
|
14
|
-
@response = response
|
15
|
-
super 200,
|
16
|
-
"Success, type '#{type.system.codename}' returned",
|
17
|
-
JSON.generate(@response)
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
1
|
+
require 'delivery/models/content_type'
|
2
|
+
require 'delivery/responses/response_base'
|
3
|
+
|
4
|
+
module Delivery
|
5
|
+
module Responses
|
6
|
+
# Returned by DeliveryClient.types with an enumerable of ContentTypes
|
7
|
+
class DeliveryTypeResponse < ResponseBase
|
8
|
+
def type
|
9
|
+
@type unless @type.nil?
|
10
|
+
@type = Delivery::ContentType.new(@response)
|
11
|
+
end
|
12
|
+
|
13
|
+
def initialize(response)
|
14
|
+
@response = response
|
15
|
+
super 200,
|
16
|
+
"Success, type '#{type.system.codename}' returned",
|
17
|
+
JSON.generate(@response)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -1,20 +1,20 @@
|
|
1
|
-
module Delivery
|
2
|
-
module Responses
|
3
|
-
# Base class for all responses from DeliveryQuery.execute
|
4
|
-
class ResponseBase
|
5
|
-
attr_accessor :http_code,
|
6
|
-
:message,
|
7
|
-
:json
|
8
|
-
|
9
|
-
def initialize(http_code, message, json = '')
|
10
|
-
self.http_code = http_code
|
11
|
-
self.message = message
|
12
|
-
self.json = json
|
13
|
-
end
|
14
|
-
|
15
|
-
def to_s
|
16
|
-
"Response is status code #{http_code} with message:\n#{message}"
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
1
|
+
module Delivery
|
2
|
+
module Responses
|
3
|
+
# Base class for all responses from DeliveryQuery.execute
|
4
|
+
class ResponseBase
|
5
|
+
attr_accessor :http_code,
|
6
|
+
:message,
|
7
|
+
:json
|
8
|
+
|
9
|
+
def initialize(http_code, message, json = '')
|
10
|
+
self.http_code = http_code
|
11
|
+
self.message = message
|
12
|
+
self.json = json
|
13
|
+
end
|
14
|
+
|
15
|
+
def to_s
|
16
|
+
"Response is status code #{http_code} with message:\n#{message}"
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
data/lib/delivery/version.rb
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
module Delivery
|
2
|
-
VERSION = '0.
|
3
|
-
end
|
1
|
+
module Delivery
|
2
|
+
VERSION = '0.15.0'.freeze
|
3
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: delivery-sdk-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.15.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eric Dugre
|
@@ -14,40 +14,40 @@ dependencies:
|
|
14
14
|
name: nokogiri
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ">="
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: 1.8.4
|
20
17
|
- - "~>"
|
21
18
|
- !ruby/object:Gem::Version
|
22
19
|
version: 1.10.0
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 1.8.4
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
requirements:
|
27
|
-
- - ">="
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
version: 1.8.4
|
30
27
|
- - "~>"
|
31
28
|
- !ruby/object:Gem::Version
|
32
29
|
version: 1.10.0
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 1.8.4
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: rest-client
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
36
36
|
requirements:
|
37
|
-
- - "
|
37
|
+
- - "~>"
|
38
38
|
- !ruby/object:Gem::Version
|
39
39
|
version: 2.1.0.rc1
|
40
|
-
- - "
|
40
|
+
- - ">="
|
41
41
|
- !ruby/object:Gem::Version
|
42
42
|
version: 2.1.0.rc1
|
43
43
|
type: :runtime
|
44
44
|
prerelease: false
|
45
45
|
version_requirements: !ruby/object:Gem::Requirement
|
46
46
|
requirements:
|
47
|
-
- - "
|
47
|
+
- - "~>"
|
48
48
|
- !ruby/object:Gem::Version
|
49
49
|
version: 2.1.0.rc1
|
50
|
-
- - "
|
50
|
+
- - ">="
|
51
51
|
- !ruby/object:Gem::Version
|
52
52
|
version: 2.1.0.rc1
|
53
53
|
- !ruby/object:Gem::Dependency
|
@@ -164,7 +164,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
164
164
|
- !ruby/object:Gem::Version
|
165
165
|
version: '0'
|
166
166
|
requirements: []
|
167
|
-
|
167
|
+
rubyforge_project:
|
168
|
+
rubygems_version: 2.7.6
|
168
169
|
signing_key:
|
169
170
|
specification_version: 4
|
170
171
|
summary: Kentico Cloud Delivery SDK for Ruby
|