Class: GdsApi::ContentStore

Inherits:
Base
  • Object
show all
Defined in:
lib/gds_api/content_store.rb

Defined Under Namespace

Classes: ItemNotFound, RedirectResolver, UnresolvedRedirect

Instance Attribute Summary

Attributes inherited from Base

#options

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#client, #create_client, #get_list, #initialize, #url_for_slug

Constructor Details

This class inherits a constructor from GdsApi::Base

Class Method Details

.redirect_for_path(content_item, request_path, request_query = "") ⇒ Object

Returns an array tuple of destination url with status code e.g

www.gov.uk/destination”, 301


21
22
23
# File 'lib/gds_api/content_store.rb', line 21

def self.redirect_for_path(content_item, request_path, request_query = "")
  RedirectResolver.call(content_item, request_path, request_query)
end

Instance Method Details

#content_item(base_path) ⇒ Object



13
14
15
16
17
# File 'lib/gds_api/content_store.rb', line 13

def content_item(base_path)
  get_json(content_item_url(base_path))
rescue GdsApi::HTTPNotFound => e
  raise ItemNotFound.build_from(e)
end