delivery-sdk-ruby 0.16.0 → 1.0.0

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.
@@ -3,8 +3,14 @@ require 'delivery/responses/response_base'
3
3
  module KenticoCloud
4
4
  module Delivery
5
5
  module Responses
6
- # Returned by DeliveryClient.element containing a single element
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
- # Returned by DeliveryClient.items with an enumerable of ContentItems
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
- # Returned by DeliveryClient.item containing a single ContentItem
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.code_name}' returned",
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
- # Returned by DeliveryClient.taxonomies with an enumerable of TaxonomyGroups
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
- # Returned by DeliveryClient.taxonomy containing a single TaxonomyGroup
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
- # Returned by DeliveryClient.types with an enumerable of ContentTypes
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
- # Returned by DeliveryClient.types with an enumerable of ContentTypes
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 DeliveryQuery.execute
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
@@ -1,5 +1,5 @@
1
1
  module KenticoCloud
2
2
  module Delivery
3
- VERSION = '0.16.0'.freeze
3
+ VERSION = '1.0.0'.freeze
4
4
  end
5
5
  end
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.16.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-14 00:00:00.000000000 Z
11
+ date: 2019-03-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri