Module: Contentstack
- Defined in:
- lib/contentstack.rb,
lib/contentstack/asset.rb,
lib/contentstack/entry.rb,
lib/contentstack/error.rb,
lib/contentstack/query.rb,
lib/contentstack/client.rb,
lib/contentstack/region.rb,
lib/contentstack/endpoint.rb,
lib/contentstack/sync_result.rb,
lib/contentstack/content_type.rb,
lib/contentstack/asset_collection.rb,
lib/contentstack/entry_collection.rb
Overview
Contentstack - Ruby SDK
Contentstack is a content management system that facilitates the process of publication by separating the content from site-related programming and design.
Installation
gem install contentstack
Initialize the Stack
@stack = Contentstack::Client.new("site_api_key", "delivery_token", "enviroment_name")
Initialize the Stack for EU region
@stack = Contentstack::Client.new("site_api_key", "delivery_token", "enviroment_name", {"region": Contentstack::Region::EU })
Initialize the Stack for custom host
@stack = Contentstack::Client.new("site_api_key", "delivery_token", "enviroment_name", {"host": "https://custom-cdn.contentstack.com" })
Initialize the Stack for EU region
@stack = Contentstack::Client.new("site_api_key", "delivery_token", "enviroment_name", {"branch":"branch_name" })
Usage
Get single entry
@stack.content_type('blog').entry('<entry_uid_here>').fetch
Query entries
@stack.content_type('blog').query.regex('title', '.*hello.*').fetch
Defined Under Namespace
Modules: ErrorMessages Classes: Asset, AssetCollection, Client, ContentType, Endpoint, Entry, EntryCollection, Error, Host, Query, Region, Service, SyncResult
Class Method Summary collapse
-
.get_contentstack_endpoint(region, service = Contentstack::Service::CDA) ⇒ Object
Backward-compatible proxy for endpoint resolution.
- .json_to_html(content, options) ⇒ Object
- .render_content(content, options) ⇒ Object
Class Method Details
.get_contentstack_endpoint(region, service = Contentstack::Service::CDA) ⇒ Object
Backward-compatible proxy for endpoint resolution. Delegates to ContentstackUtils.get_contentstack_endpoint when available, otherwise resolves via Contentstack::Endpoint.
Contentstack.get_contentstack_endpoint('eu')
# => "https://eu-cdn.contentstack.com"
Contentstack.get_contentstack_endpoint('us', 'cma')
# => "https://api.contentstack.io"
44 45 46 |
# File 'lib/contentstack.rb', line 44 def self.get_contentstack_endpoint(region, service = Contentstack::Service::CDA) Contentstack::Endpoint.get_contentstack_endpoint(region, service) end |
.json_to_html(content, options) ⇒ Object
31 32 33 |
# File 'lib/contentstack.rb', line 31 def self.json_to_html(content, ) ContentstackUtils.json_to_html(content, ) end |
.render_content(content, options) ⇒ Object
27 28 29 |
# File 'lib/contentstack.rb', line 27 def self.render_content(content, ) ContentstackUtils.render_content(content, ) end |