kontent-delivery-sdk-ruby 2.0.6 → 2.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE.md +21 -21
  3. data/README.md +511 -511
  4. data/bin/console +14 -14
  5. data/bin/setup +8 -8
  6. data/lib/delivery/builders/image_transformation_builder.rb +271 -271
  7. data/lib/delivery/builders/url_builder.rb +117 -117
  8. data/lib/delivery/client/delivery_client.rb +155 -155
  9. data/lib/delivery/client/delivery_query.rb +249 -249
  10. data/lib/delivery/client/request_manager.rb +107 -107
  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/pagination.rb +21 -21
  14. data/lib/delivery/models/taxonomy_group.rb +39 -39
  15. data/lib/delivery/query_parameters/filters.rb +158 -158
  16. data/lib/delivery/query_parameters/parameter_base.rb +44 -44
  17. data/lib/delivery/query_parameters/query_string.rb +78 -78
  18. data/lib/delivery/resolvers/content_link_resolver.rb +102 -102
  19. data/lib/delivery/resolvers/inline_content_item_resolver.rb +75 -75
  20. data/lib/delivery/resolvers/linked_item_resolver.rb +37 -37
  21. data/lib/delivery/responses/delivery_element_response.rb +33 -33
  22. data/lib/delivery/responses/delivery_item_listing_response.rb +53 -53
  23. data/lib/delivery/responses/delivery_item_response.rb +39 -39
  24. data/lib/delivery/responses/delivery_taxonomy_listing_response.rb +46 -46
  25. data/lib/delivery/responses/delivery_taxonomy_response.rb +32 -32
  26. data/lib/delivery/responses/delivery_type_listing_response.rb +45 -45
  27. data/lib/delivery/responses/delivery_type_response.rb +31 -31
  28. data/lib/delivery/responses/response_base.rb +36 -36
  29. data/lib/delivery/tests/401.json +5 -5
  30. data/lib/delivery/tests/fake_responder.rb +67 -67
  31. data/lib/delivery/tests/filtering/items_gt.json +565 -565
  32. data/lib/delivery/tests/filtering/multiple.json +282 -282
  33. data/lib/delivery/tests/filtering/pagination_about_us.json +646 -646
  34. data/lib/delivery/tests/generic/items/about_us.json +227 -227
  35. data/lib/delivery/tests/generic/items/aeropress_filters.json +138 -138
  36. data/lib/delivery/tests/generic/items/coffee_processing_techniques.json +168 -168
  37. data/lib/delivery/tests/generic/items/where_does_coffee_come_from_.json +620 -620
  38. data/lib/delivery/tests/generic/items.json +4984 -4984
  39. data/lib/delivery/tests/generic/taxonomies.json +126 -126
  40. data/lib/delivery/tests/generic/types/brewer/elements/product_status.json +5 -5
  41. data/lib/delivery/tests/generic/types.json +780 -780
  42. data/lib/delivery/version.rb +7 -7
  43. data/lib/kontent-delivery-sdk-ruby.rb +19 -19
  44. metadata +12 -13
@@ -1,108 +1,108 @@
1
- require 'rest-client'
2
- require 'dotenv/load'
3
-
4
- module Kentico
5
- module Kontent
6
- module Delivery
7
- class RequestManager
8
- class << self
9
- MAX_ATTEMPTS = 6
10
- INITIAL_DELAY = 0.2
11
- RETRY_WHEN_CODE = [408, 500, 502, 503, 504].freeze
12
-
13
- def start(query, headers)
14
- @query = query
15
- @headers = headers
16
- @times_run = 1
17
- @delay = INITIAL_DELAY
18
- @url = @query.provide_url
19
- continue
20
- end
21
-
22
- private
23
-
24
- def should_retry(potential_response)
25
- return potential_response if @times_run == MAX_ATTEMPTS ||
26
- !RETRY_WHEN_CODE.include?(potential_response.http_code) ||
27
- !@query.with_retry_policy
28
-
29
- @times_run += 1
30
- @delay *= 2
31
- sleep(@delay)
32
- continue
33
- end
34
-
35
- def continue
36
- if ENV['TEST'] == '1'
37
- resp = Kentico::Kontent::Delivery::Tests::FakeResponder.get_response @query, @url, @headers
38
- return resp if resp.is_a? Kentico::Kontent::Delivery::Responses::ResponseBase
39
-
40
- make_response resp # resp is pure JSON
41
- else
42
- begin
43
- resp = RestClient.get @url, @headers
44
- rescue RestClient::ExceptionWithResponse => err
45
- should_retry Kentico::Kontent::Delivery::Responses::ResponseBase.new err.http_code, err.response
46
- rescue RestClient::SSLCertificateNotVerified => err
47
- should_retry Kentico::Kontent::Delivery::Responses::ResponseBase.new 500, err
48
- rescue SocketError => err
49
- should_retry Kentico::Kontent::Delivery::Responses::ResponseBase.new 500, err.message
50
- else
51
- make_response resp
52
- end
53
- end
54
- end
55
-
56
- # Converts a standard REST response based on the type of query.
57
- #
58
- # * *Returns*:
59
- # - An object derived from the Kentico::Kontent::Delivery::Responses::ResponseBase class
60
- def make_response(response)
61
- case @query.query_type
62
- when Kentico::Kontent::Delivery::QUERY_TYPE_ITEMS
63
- respond_item response
64
- when Kentico::Kontent::Delivery::QUERY_TYPE_TYPES
65
- respond_type response
66
- when Kentico::Kontent::Delivery::QUERY_TYPE_TAXONOMIES
67
- respond_taxonomy response
68
- when Kentico::Kontent::Delivery::QUERY_TYPE_ELEMENT
69
- Kentico::Kontent::Delivery::Responses::DeliveryElementResponse.new JSON.parse(response)
70
- end
71
- end
72
-
73
- def respond_type(response)
74
- if @query.code_name.nil?
75
- Kentico::Kontent::Delivery::Responses::DeliveryTypeListingResponse.new JSON.parse(response)
76
- else
77
- Kentico::Kontent::Delivery::Responses::DeliveryTypeResponse.new JSON.parse(response)
78
- end
79
- end
80
-
81
- def respond_taxonomy(response)
82
- if @query.code_name.nil?
83
- Kentico::Kontent::Delivery::Responses::DeliveryTaxonomyListingResponse.new JSON.parse(response)
84
- else
85
- Kentico::Kontent::Delivery::Responses::DeliveryTaxonomyResponse.new JSON.parse(response)
86
- end
87
- end
88
-
89
- def respond_item(response)
90
- if @query.code_name.nil?
91
- Kentico::Kontent::Delivery::Responses::DeliveryItemListingResponse.new(
92
- JSON.parse(response),
93
- @query.content_link_url_resolver,
94
- @query.inline_content_item_resolver
95
- )
96
- else
97
- Kentico::Kontent::Delivery::Responses::DeliveryItemResponse.new(
98
- JSON.parse(response),
99
- @query.content_link_url_resolver,
100
- @query.inline_content_item_resolver
101
- )
102
- end
103
- end
104
- end
105
- end
106
- end
107
- end
1
+ require 'rest-client'
2
+ require 'dotenv/load'
3
+
4
+ module Kentico
5
+ module Kontent
6
+ module Delivery
7
+ class RequestManager
8
+ class << self
9
+ MAX_ATTEMPTS = 6
10
+ INITIAL_DELAY = 0.2
11
+ RETRY_WHEN_CODE = [408, 500, 502, 503, 504].freeze
12
+
13
+ def start(query, headers)
14
+ @query = query
15
+ @headers = headers
16
+ @times_run = 1
17
+ @delay = INITIAL_DELAY
18
+ @url = @query.provide_url
19
+ continue
20
+ end
21
+
22
+ private
23
+
24
+ def should_retry(potential_response)
25
+ return potential_response if @times_run == MAX_ATTEMPTS ||
26
+ !RETRY_WHEN_CODE.include?(potential_response.http_code) ||
27
+ !@query.with_retry_policy
28
+
29
+ @times_run += 1
30
+ @delay *= 2
31
+ sleep(@delay)
32
+ continue
33
+ end
34
+
35
+ def continue
36
+ if ENV['TEST'] == '1'
37
+ resp = Kentico::Kontent::Delivery::Tests::FakeResponder.get_response @query, @url, @headers
38
+ return resp if resp.is_a? Kentico::Kontent::Delivery::Responses::ResponseBase
39
+
40
+ make_response resp # resp is pure JSON
41
+ else
42
+ begin
43
+ resp = RestClient.get @url, @headers
44
+ rescue RestClient::ExceptionWithResponse => err
45
+ should_retry Kentico::Kontent::Delivery::Responses::ResponseBase.new err.http_code, err.response
46
+ rescue RestClient::SSLCertificateNotVerified => err
47
+ should_retry Kentico::Kontent::Delivery::Responses::ResponseBase.new 500, err
48
+ rescue SocketError => err
49
+ should_retry Kentico::Kontent::Delivery::Responses::ResponseBase.new 500, err.message
50
+ else
51
+ make_response resp
52
+ end
53
+ end
54
+ end
55
+
56
+ # Converts a standard REST response based on the type of query.
57
+ #
58
+ # * *Returns*:
59
+ # - An object derived from the Kentico::Kontent::Delivery::Responses::ResponseBase class
60
+ def make_response(response)
61
+ case @query.query_type
62
+ when Kentico::Kontent::Delivery::QUERY_TYPE_ITEMS
63
+ respond_item response
64
+ when Kentico::Kontent::Delivery::QUERY_TYPE_TYPES
65
+ respond_type response
66
+ when Kentico::Kontent::Delivery::QUERY_TYPE_TAXONOMIES
67
+ respond_taxonomy response
68
+ when Kentico::Kontent::Delivery::QUERY_TYPE_ELEMENT
69
+ Kentico::Kontent::Delivery::Responses::DeliveryElementResponse.new JSON.parse(response)
70
+ end
71
+ end
72
+
73
+ def respond_type(response)
74
+ if @query.code_name.nil?
75
+ Kentico::Kontent::Delivery::Responses::DeliveryTypeListingResponse.new JSON.parse(response)
76
+ else
77
+ Kentico::Kontent::Delivery::Responses::DeliveryTypeResponse.new JSON.parse(response)
78
+ end
79
+ end
80
+
81
+ def respond_taxonomy(response)
82
+ if @query.code_name.nil?
83
+ Kentico::Kontent::Delivery::Responses::DeliveryTaxonomyListingResponse.new JSON.parse(response)
84
+ else
85
+ Kentico::Kontent::Delivery::Responses::DeliveryTaxonomyResponse.new JSON.parse(response)
86
+ end
87
+ end
88
+
89
+ def respond_item(response)
90
+ if @query.code_name.nil?
91
+ Kentico::Kontent::Delivery::Responses::DeliveryItemListingResponse.new(
92
+ JSON.parse(response),
93
+ @query.content_link_url_resolver,
94
+ @query.inline_content_item_resolver
95
+ )
96
+ else
97
+ Kentico::Kontent::Delivery::Responses::DeliveryItemResponse.new(
98
+ JSON.parse(response),
99
+ @query.content_link_url_resolver,
100
+ @query.inline_content_item_resolver
101
+ )
102
+ end
103
+ end
104
+ end
105
+ end
106
+ end
107
+ end
108
108
  end
@@ -1,153 +1,153 @@
1
- require 'ostruct'
2
- require 'nokogiri'
3
-
4
- module Kentico
5
- module Kontent
6
- module Delivery
7
- class ContentItem
8
- attr_accessor :content_link_url_resolver,
9
- :inline_content_item_resolver
10
-
11
- # Parses the 'elements' JSON object as a dynamic OpenStruct object.
12
- #
13
- # * *Returns*:
14
- # - +OpenStruct+ The elements of the content item
15
- def elements
16
- @elements unless @elements.nil?
17
- @elements = JSON.parse(
18
- JSON.generate(@source['elements']),
19
- object_class: OpenStruct
20
- )
21
- end
22
-
23
- # Parses the 'system' JSON object as a dynamic OpenStruct object.
24
- #
25
- # * *Returns*:
26
- # - +OpenStruct+ The system properties of the content item
27
- def system
28
- @system unless @system.nil?
29
- @system = JSON.parse(
30
- JSON.generate(@source['system']),
31
- object_class: OpenStruct
32
- )
33
- end
34
-
35
- # Constructor.
36
- #
37
- # * *Args*:
38
- # - *source* (+JSON+) The response from a REST request for content items. The item may be on the root or under the 'item' node
39
- # - *content_link_url_resolver* ( Kentico::Kontent::Delivery::Resolvers::ContentLinkResolver )
40
- # - *inline_content_item_resolver* ( Kentico::Kontent::Delivery::Resolvers::InlineContentItemResolver )
41
- # - *linked_items_resolver* ( Kentico::Kontent::Delivery::Resolvers::LinkedItemResolver )
42
- def initialize(source, content_link_url_resolver, inline_content_item_resolver, linked_items_resolver)
43
- @source =
44
- if source['item'].nil?
45
- source
46
- else
47
- source['item']
48
- end
49
- @linked_items_resolver = linked_items_resolver
50
- self.content_link_url_resolver = content_link_url_resolver
51
- self.inline_content_item_resolver = inline_content_item_resolver
52
- end
53
-
54
- # Gets a string representation of the data stored in the element. Using this
55
- # method instead of directly accessing the +elements+ collection causes
56
- # the content to be resolved using the resolvers passed during instantiation.
57
- # See https://github.com/Kentico/kontent-delivery-sdk-ruby#resolving-links
58
- #
59
- # * *Args*:
60
- # - *code_name* (+string+) The code name of the desired element
61
- #
62
- # * *Returns*:
63
- # - +string+ The data converted to a string, resolved if the element is a 'rich_text' element
64
- def get_string(code_name)
65
- element = get_element code_name
66
- content = element['value']
67
-
68
- if element['type'] == 'rich_text'
69
- content = content_link_url_resolver.resolve content, element['links'] if should_resolve_links element
70
- inline_items = get_inline_items code_name
71
- content = inline_content_item_resolver.resolve content, inline_items if should_resolve_inline_content element
72
- end
73
- content.to_s
74
- end
75
-
76
- # Returns an array of assets inserted into the specified element of the
77
- # 'asset' type.
78
- #
79
- # * *Args*:
80
- # - *code_name* (+string+) The code name of the desired element
81
- #
82
- # * *Returns*:
83
- # - +Array+ The element's assets parsed as +OpenStruct+ objects
84
- def get_assets(code_name)
85
- element = get_element code_name
86
- element['value'].map { |n| OpenStruct.new(n) }
87
- end
88
-
89
- # Returns an array of ContentItems that are linked in a 'modular_content'
90
- # element.
91
- #
92
- # * *Args*:
93
- # - *code_name* (+string+) The code name of the desired element
94
- #
95
- # * *Returns*:
96
- # - +Array+ The element's linked items parsed as +ContentItem+ objects
97
- def get_links(code_name)
98
- element = get_element code_name
99
- get_linked_items element['value']
100
- end
101
-
102
- # Returns an array of ContentItems that are inserted as inline content
103
- # items or componenets of a 'rich_text' element.
104
- #
105
- # * *Args*:
106
- # - *code_name* (+string+) The code name of the desired element
107
- #
108
- # * *Returns*:
109
- # - +Array+ The element's inline content items parsed as +ContentItem+ objects
110
- def get_inline_items(code_name)
111
- element = get_element code_name
112
- get_linked_items element['modular_content']
113
- end
114
-
115
- private
116
-
117
- def should_resolve_links(element)
118
- !element['links'].nil? && !content_link_url_resolver.nil?
119
- end
120
-
121
- def should_resolve_inline_content(element)
122
- !element['modular_content'].nil? && !inline_content_item_resolver.nil?
123
- end
124
-
125
- # Gets the JSON object from the 'elements' collection with the specified key
126
- #
127
- # * *Args*:
128
- # - *code_name* (+string+, +symbol+) The code name or symbol of the desired element
129
- #
130
- # * *Returns*:
131
- # - +JSON+ The element as a JSON object
132
- #
133
- # * *Raises*:
134
- # - +ArgumentError+ if +code_name+ is +nil+
135
- def get_element(code_name)
136
- raise ArgumentError, "Argument 'code_name' cannot be null" if code_name.nil?
137
-
138
- code_name = code_name.to_s if code_name.is_a? Symbol
139
- @source['elements'][code_name]
140
- end
141
-
142
- def get_linked_items(codenames)
143
- return [] unless codenames.class == Array
144
-
145
- codenames.each_with_object([]) do |codename, items|
146
- item = @linked_items_resolver.resolve codename
147
- items << item if item
148
- end
149
- end
150
- end
151
- end
152
- end
153
- end
1
+ require 'ostruct'
2
+ require 'nokogiri'
3
+
4
+ module Kentico
5
+ module Kontent
6
+ module Delivery
7
+ class ContentItem
8
+ attr_accessor :content_link_url_resolver,
9
+ :inline_content_item_resolver
10
+
11
+ # Parses the 'elements' JSON object as a dynamic OpenStruct object.
12
+ #
13
+ # * *Returns*:
14
+ # - +OpenStruct+ The elements of the content item
15
+ def elements
16
+ @elements unless @elements.nil?
17
+ @elements = JSON.parse(
18
+ JSON.generate(@source['elements']),
19
+ object_class: OpenStruct
20
+ )
21
+ end
22
+
23
+ # Parses the 'system' JSON object as a dynamic OpenStruct object.
24
+ #
25
+ # * *Returns*:
26
+ # - +OpenStruct+ The system properties of the content item
27
+ def system
28
+ @system unless @system.nil?
29
+ @system = JSON.parse(
30
+ JSON.generate(@source['system']),
31
+ object_class: OpenStruct
32
+ )
33
+ end
34
+
35
+ # Constructor.
36
+ #
37
+ # * *Args*:
38
+ # - *source* (+JSON+) The response from a REST request for content items. The item may be on the root or under the 'item' node
39
+ # - *content_link_url_resolver* ( Kentico::Kontent::Delivery::Resolvers::ContentLinkResolver )
40
+ # - *inline_content_item_resolver* ( Kentico::Kontent::Delivery::Resolvers::InlineContentItemResolver )
41
+ # - *linked_items_resolver* ( Kentico::Kontent::Delivery::Resolvers::LinkedItemResolver )
42
+ def initialize(source, content_link_url_resolver, inline_content_item_resolver, linked_items_resolver)
43
+ @source =
44
+ if source['item'].nil?
45
+ source
46
+ else
47
+ source['item']
48
+ end
49
+ @linked_items_resolver = linked_items_resolver
50
+ self.content_link_url_resolver = content_link_url_resolver
51
+ self.inline_content_item_resolver = inline_content_item_resolver
52
+ end
53
+
54
+ # Gets a string representation of the data stored in the element. Using this
55
+ # method instead of directly accessing the +elements+ collection causes
56
+ # the content to be resolved using the resolvers passed during instantiation.
57
+ # See https://github.com/Kentico/kontent-delivery-sdk-ruby#resolving-links
58
+ #
59
+ # * *Args*:
60
+ # - *code_name* (+string+) The code name of the desired element
61
+ #
62
+ # * *Returns*:
63
+ # - +string+ The data converted to a string, resolved if the element is a 'rich_text' element
64
+ def get_string(code_name)
65
+ element = get_element code_name
66
+ content = element['value']
67
+
68
+ if element['type'] == 'rich_text'
69
+ content = content_link_url_resolver.resolve content, element['links'] if should_resolve_links element
70
+ inline_items = get_inline_items code_name
71
+ content = inline_content_item_resolver.resolve content, inline_items if should_resolve_inline_content element
72
+ end
73
+ content.to_s
74
+ end
75
+
76
+ # Returns an array of assets inserted into the specified element of the
77
+ # 'asset' type.
78
+ #
79
+ # * *Args*:
80
+ # - *code_name* (+string+) The code name of the desired element
81
+ #
82
+ # * *Returns*:
83
+ # - +Array+ The element's assets parsed as +OpenStruct+ objects
84
+ def get_assets(code_name)
85
+ element = get_element code_name
86
+ element['value'].map { |n| OpenStruct.new(n) }
87
+ end
88
+
89
+ # Returns an array of ContentItems that are linked in a 'modular_content'
90
+ # element.
91
+ #
92
+ # * *Args*:
93
+ # - *code_name* (+string+) The code name of the desired element
94
+ #
95
+ # * *Returns*:
96
+ # - +Array+ The element's linked items parsed as +ContentItem+ objects
97
+ def get_links(code_name)
98
+ element = get_element code_name
99
+ get_linked_items element['value']
100
+ end
101
+
102
+ # Returns an array of ContentItems that are inserted as inline content
103
+ # items or componenets of a 'rich_text' element.
104
+ #
105
+ # * *Args*:
106
+ # - *code_name* (+string+) The code name of the desired element
107
+ #
108
+ # * *Returns*:
109
+ # - +Array+ The element's inline content items parsed as +ContentItem+ objects
110
+ def get_inline_items(code_name)
111
+ element = get_element code_name
112
+ get_linked_items element['modular_content']
113
+ end
114
+
115
+ private
116
+
117
+ def should_resolve_links(element)
118
+ !element['links'].nil? && !content_link_url_resolver.nil?
119
+ end
120
+
121
+ def should_resolve_inline_content(element)
122
+ !element['modular_content'].nil? && !inline_content_item_resolver.nil?
123
+ end
124
+
125
+ # Gets the JSON object from the 'elements' collection with the specified key
126
+ #
127
+ # * *Args*:
128
+ # - *code_name* (+string+, +symbol+) The code name or symbol of the desired element
129
+ #
130
+ # * *Returns*:
131
+ # - +JSON+ The element as a JSON object
132
+ #
133
+ # * *Raises*:
134
+ # - +ArgumentError+ if +code_name+ is +nil+
135
+ def get_element(code_name)
136
+ raise ArgumentError, "Argument 'code_name' cannot be null" if code_name.nil?
137
+
138
+ code_name = code_name.to_s if code_name.is_a? Symbol
139
+ @source['elements'][code_name]
140
+ end
141
+
142
+ def get_linked_items(codenames)
143
+ return [] unless codenames.class == Array
144
+
145
+ codenames.each_with_object([]) do |codename, items|
146
+ item = @linked_items_resolver.resolve codename
147
+ items << item if item
148
+ end
149
+ end
150
+ end
151
+ end
152
+ end
153
+ end
@@ -1,41 +1,41 @@
1
- require 'ostruct'
2
-
3
- module Kentico
4
- module Kontent
5
- module Delivery
6
- class ContentType
7
- # Parses the 'elements' JSON object as a dynamic OpenStruct object.
8
- #
9
- # * *Returns*:
10
- # - +OpenStruct+ The elements of the content type
11
- def elements
12
- @elements unless @elements.nil?
13
- @elements = JSON.parse(
14
- JSON.generate(@source['elements']),
15
- object_class: OpenStruct
16
- )
17
- end
18
-
19
- # Parses the 'system' JSON object as a dynamic OpenStruct object.
20
- #
21
- # * *Returns*:
22
- # - +OpenStruct+ The system properties of the content type
23
- def system
24
- @system unless @system.nil?
25
- @system = JSON.parse(
26
- JSON.generate(@source['system']),
27
- object_class: OpenStruct
28
- )
29
- end
30
-
31
- # Constructor.
32
- #
33
- # * *Args*:
34
- # - *source* (+JSON+) The response from a REST request for content types
35
- def initialize(source)
36
- @source = source
37
- end
38
- end
39
- end
40
- end
41
- end
1
+ require 'ostruct'
2
+
3
+ module Kentico
4
+ module Kontent
5
+ module Delivery
6
+ class ContentType
7
+ # Parses the 'elements' JSON object as a dynamic OpenStruct object.
8
+ #
9
+ # * *Returns*:
10
+ # - +OpenStruct+ The elements of the content type
11
+ def elements
12
+ @elements unless @elements.nil?
13
+ @elements = JSON.parse(
14
+ JSON.generate(@source['elements']),
15
+ object_class: OpenStruct
16
+ )
17
+ end
18
+
19
+ # Parses the 'system' JSON object as a dynamic OpenStruct object.
20
+ #
21
+ # * *Returns*:
22
+ # - +OpenStruct+ The system properties of the content type
23
+ def system
24
+ @system unless @system.nil?
25
+ @system = JSON.parse(
26
+ JSON.generate(@source['system']),
27
+ object_class: OpenStruct
28
+ )
29
+ end
30
+
31
+ # Constructor.
32
+ #
33
+ # * *Args*:
34
+ # - *source* (+JSON+) The response from a REST request for content types
35
+ def initialize(source)
36
+ @source = source
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
@@ -1,21 +1,21 @@
1
- module Kentico
2
- module Kontent
3
- module Delivery
4
- # Holds pagination data from listing responses
5
- class Pagination
6
- attr_accessor :skip, :limit, :count, :next_page
7
-
8
- # Constructor.
9
- #
10
- # * *Args*:
11
- # - *json* (+JSON+) The 'pagination' node of a listing reponse's JSON object
12
- def initialize(json)
13
- self.skip = json['skip']
14
- self.limit = json['limit']
15
- self.count = json['count']
16
- self.next_page = json['next_page']
17
- end
18
- end
19
- end
20
- end
21
- end
1
+ module Kentico
2
+ module Kontent
3
+ module Delivery
4
+ # Holds pagination data from listing responses
5
+ class Pagination
6
+ attr_accessor :skip, :limit, :count, :next_page
7
+
8
+ # Constructor.
9
+ #
10
+ # * *Args*:
11
+ # - *json* (+JSON+) The 'pagination' node of a listing reponse's JSON object
12
+ def initialize(json)
13
+ self.skip = json['skip']
14
+ self.limit = json['limit']
15
+ self.count = json['count']
16
+ self.next_page = json['next_page']
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end