Class: GovukTaxonomyHelpers::PublishingApiResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/govuk_taxonomy_helpers/publishing_api_response.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(content_item:, expanded_links:, publishing_api:) ⇒ PublishingApiResponse

Returns a new instance of PublishingApiResponse.

Parameters:

  • content_item (Hash)

    Publishing API get_content response hash

  • expanded_links (Hash)

    Publishing API get_expanded_links response hash

  • publishing_api (PublishingApiV2)

    Publishing API service



23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/govuk_taxonomy_helpers/publishing_api_response.rb', line 23

def initialize(content_item:, expanded_links:, publishing_api:)
  details = content_item["details"] || {}

  @linked_content_item = LinkedContentItem.new(
    title: content_item["title"],
    internal_name: details["internal_name"],
    content_id: content_item["content_id"],
    base_path: content_item["base_path"]
  )

  add_expanded_links(expanded_links, publishing_api)
end

Instance Attribute Details

#linked_content_itemObject

Returns the value of attribute linked_content_item.



18
19
20
# File 'lib/govuk_taxonomy_helpers/publishing_api_response.rb', line 18

def linked_content_item
  @linked_content_item
end