FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
contentstack-ruby/lib/contentstack.rb at master · contentstack/contentstack-ruby · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
contentstack
/
contentstack-ruby
Public
Notifications
You must be signed in to change notification settings
Fork
7
Star
5
Code
Issues
0
Pull requests
1
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
contentstack-ruby
/
lib
/
contentstack.rb
Copy path
More file actions
More file actions
Latest commit
History
History
History
47 lines (43 loc) · 2 KB
Breadcrumbs
contentstack-ruby
/
lib
/
contentstack.rb
Copy path
File metadata and controls
47 lines (43 loc) · 2 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
$LOAD_PATH
.
unshift
File
.
expand_path
(
"../../lib"
,
__FILE__
)
require
"contentstack/version"
require
"contentstack/client"
require
"contentstack/region"
require
"contentstack/endpoint"
require
"contentstack_utils"
# == 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
module
Contentstack
def
self
.
render_content
(
content
,
options
)
ContentstackUtils
.
render_content
(
content
,
options
)
end
def
self
.
json_to_html
(
content
,
options
)
ContentstackUtils
.
json_to_html
(
content
,
options
)
end
# 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"
def
self
.
get_contentstack_endpoint
(
region
,
service
=
Contentstack
::
Service
::
CDA
)
Contentstack
::
Endpoint
.
get_contentstack_endpoint
(
region
,
service
)
end
end
Back
|
FazBrowse Home
|
New Git URL