Class: Contentstack::Client
- Inherits:
-
Object
- Object
- Contentstack::Client
- Defined in:
- lib/contentstack/client.rb
Instance Attribute Summary collapse
-
#host ⇒ Object
readonly
Returns the value of attribute host.
-
#region ⇒ Object
readonly
Returns the value of attribute region.
Instance Method Summary collapse
- #asset(uid) ⇒ Object
- #assets ⇒ Object
- #content_type(uid) ⇒ Object
- #content_types ⇒ Object
-
#initialize(api_key, delivery_token, environment, options = {}) ⇒ Client
constructor
Initialize “Contentstack” Client instance.
Constructor Details
#initialize(api_key, delivery_token, environment, options = {}) ⇒ Client
Initialize “Contentstack” Client instance
9 10 11 12 13 |
# File 'lib/contentstack/client.rb', line 9 def initialize(api_key, delivery_token, environment, ={}) @region = [:region].nil? ? Contentstack::Region::US : [:region] @host = [:host].nil? ? get_default_region_hosts(@region) : [:host] API.init_api(api_key, delivery_token, environment, @host) end |
Instance Attribute Details
#host ⇒ Object (readonly)
Returns the value of attribute host.
7 8 9 |
# File 'lib/contentstack/client.rb', line 7 def host @host end |
#region ⇒ Object (readonly)
Returns the value of attribute region.
7 8 9 |
# File 'lib/contentstack/client.rb', line 7 def region @region end |
Instance Method Details
#asset(uid) ⇒ Object
28 29 30 |
# File 'lib/contentstack/client.rb', line 28 def asset(uid) Asset.new(uid) end |
#assets ⇒ Object
24 25 26 |
# File 'lib/contentstack/client.rb', line 24 def assets AssetCollection.new end |
#content_type(uid) ⇒ Object
20 21 22 |
# File 'lib/contentstack/client.rb', line 20 def content_type(uid) ContentType.new({uid: uid}) end |
#content_types ⇒ Object
16 17 18 |
# File 'lib/contentstack/client.rb', line 16 def content_types ContentType.all end |