Class: Contentful::Management::Client
- Inherits:
-
Object
- Object
- Contentful::Management::Client
- Extended by:
- HTTPClient
- Defined in:
- lib/contentful/management/client.rb
Overview
Client for interacting with the Contentful Management API
Constant Summary collapse
- DEFAULT_CONFIGURATION =
Default configuration for Contentful::Management::Client
{ api_url: 'api.contentful.com', api_version: '1', secure: true, default_locale: 'en-US', gzip_encoded: false, logger: false, log_level: Logger::INFO, raise_errors: false, dynamic_entries: [], proxy_host: nil, proxy_port: nil, proxy_username: nil, proxy_password: nil, max_rate_limit_retries: 1, max_rate_limit_wait: 60 }
- RATE_LIMIT_RESET_HEADER_KEY =
Rate Limit Reset Header Key
'x-contentful-ratelimit-reset'
Instance Attribute Summary collapse
-
#access_token ⇒ Object
readonly
Returns the value of attribute access_token.
-
#configuration ⇒ Object
readonly
Returns the value of attribute configuration.
-
#content_type_id ⇒ Object
Returns the value of attribute content_type_id.
-
#dynamic_entry_cache ⇒ Object
Returns the value of attribute dynamic_entry_cache.
-
#logger ⇒ Object
readonly
Returns the value of attribute logger.
-
#organization_id ⇒ Object
Returns the value of attribute organization_id.
-
#version ⇒ Object
Returns the value of attribute version.
-
#zero_length ⇒ Object
Returns the value of attribute zero_length.
Instance Method Summary collapse
-
#api_keys ⇒ Contentful::Management::ClientApiKeyMethodsFactory
Allows manipulation of api keys in context of the current client Allows listing all api keys for client, creating new and finding one by id.
-
#assets ⇒ Contentful::Management::ClientAssetMethodsFactory
Allows manipulation of assets in context of the current client Allows listing all assets for client, creating new and finding one by id.
-
#content_types ⇒ Contentful::Management::ClientContentTypeMethodsFactory
Allows manipulation of content types in context of the current client Allows listing all content types for client, creating new and finding one by id.
-
#editor_interfaces ⇒ Contentful::Management::ClientEditorInterfaceMethodsFactory
Allows manipulation of editor interfaces in context of the current client Allows listing all editor interfaces for client, creating new and finding one by id.
-
#entries ⇒ Contentful::Management::ClientEntryMethodsFactory
Allows manipulation of entries in context of the current client Allows listing all entries for client, creating new and finding one by id.
-
#initialize(access_token = nil, configuration = {}) ⇒ Client
constructor
A new instance of Client.
-
#locales ⇒ Contentful::Management::ClientLocaleMethodsFactory
Allows manipulation of locales in context of the current client Allows listing all locales for client, creating new and finding one by id.
-
#roles ⇒ Contentful::Management::ClientRoleMethodsFactory
Allows manipulation of roles in context of the current client Allows listing all roles for client, creating new and finding one by id.
-
#spaces ⇒ Contentful::Management::ClientSpaceMethodsFactory
Allows manipulation of spaces in context of the current client Allows listing all spaces for client and finding one by id.
-
#webhooks ⇒ Contentful::Management::ClientWebhookMethodsFactory
Allows manipulation of webhooks in context of the current client Allows listing all webhooks for client, creating new and finding one by id.
Methods included from HTTPClient
delete_http, get_http, http_send, post_http, proxy_send, put_http
Constructor Details
#initialize(access_token = nil, configuration = {}) ⇒ Client
Returns a new instance of Client.
68 69 70 71 72 73 74 75 |
# File 'lib/contentful/management/client.rb', line 68 def initialize(access_token = nil, configuration = {}) @configuration = default_configuration.merge(configuration) setup_logger @access_token = access_token @dynamic_entry_cache = {} Thread.current[:client] = self update_all_dynamic_entry_cache! end |
Instance Attribute Details
#access_token ⇒ Object (readonly)
Returns the value of attribute access_token.
30 31 32 |
# File 'lib/contentful/management/client.rb', line 30 def access_token @access_token end |
#configuration ⇒ Object (readonly)
Returns the value of attribute configuration.
30 31 32 |
# File 'lib/contentful/management/client.rb', line 30 def configuration @configuration end |
#content_type_id ⇒ Object
Returns the value of attribute content_type_id.
31 32 33 |
# File 'lib/contentful/management/client.rb', line 31 def content_type_id @content_type_id end |
#dynamic_entry_cache ⇒ Object
Returns the value of attribute dynamic_entry_cache.
31 32 33 |
# File 'lib/contentful/management/client.rb', line 31 def dynamic_entry_cache @dynamic_entry_cache end |
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
30 31 32 |
# File 'lib/contentful/management/client.rb', line 30 def logger @logger end |
#organization_id ⇒ Object
Returns the value of attribute organization_id.
31 32 33 |
# File 'lib/contentful/management/client.rb', line 31 def organization_id @organization_id end |
#version ⇒ Object
Returns the value of attribute version.
31 32 33 |
# File 'lib/contentful/management/client.rb', line 31 def version @version end |
#zero_length ⇒ Object
Returns the value of attribute zero_length.
31 32 33 |
# File 'lib/contentful/management/client.rb', line 31 def zero_length @zero_length end |
Instance Method Details
#api_keys ⇒ Contentful::Management::ClientApiKeyMethodsFactory
Allows manipulation of api keys in context of the current client Allows listing all api keys for client, creating new and finding one by id.
91 92 93 |
# File 'lib/contentful/management/client.rb', line 91 def api_keys ClientApiKeyMethodsFactory.new(self) end |
#assets ⇒ Contentful::Management::ClientAssetMethodsFactory
Allows manipulation of assets in context of the current client Allows listing all assets for client, creating new and finding one by id.
100 101 102 |
# File 'lib/contentful/management/client.rb', line 100 def assets ClientAssetMethodsFactory.new(self) end |
#content_types ⇒ Contentful::Management::ClientContentTypeMethodsFactory
Allows manipulation of content types in context of the current client Allows listing all content types for client, creating new and finding one by id.
109 110 111 |
# File 'lib/contentful/management/client.rb', line 109 def content_types ClientContentTypeMethodsFactory.new(self) end |
#editor_interfaces ⇒ Contentful::Management::ClientEditorInterfaceMethodsFactory
Allows manipulation of editor interfaces in context of the current client Allows listing all editor interfaces for client, creating new and finding one by id.
145 146 147 |
# File 'lib/contentful/management/client.rb', line 145 def editor_interfaces ClientEditorInterfaceMethodsFactory.new(self) end |
#entries ⇒ Contentful::Management::ClientEntryMethodsFactory
Allows manipulation of entries in context of the current client Allows listing all entries for client, creating new and finding one by id.
118 119 120 |
# File 'lib/contentful/management/client.rb', line 118 def entries ClientEntryMethodsFactory.new(self) end |
#locales ⇒ Contentful::Management::ClientLocaleMethodsFactory
Allows manipulation of locales in context of the current client Allows listing all locales for client, creating new and finding one by id.
127 128 129 |
# File 'lib/contentful/management/client.rb', line 127 def locales ClientLocaleMethodsFactory.new(self) end |
#roles ⇒ Contentful::Management::ClientRoleMethodsFactory
Allows manipulation of roles in context of the current client Allows listing all roles for client, creating new and finding one by id.
136 137 138 |
# File 'lib/contentful/management/client.rb', line 136 def roles ClientRoleMethodsFactory.new(self) end |
#spaces ⇒ Contentful::Management::ClientSpaceMethodsFactory
Allows manipulation of spaces in context of the current client Allows listing all spaces for client and finding one by id.
82 83 84 |
# File 'lib/contentful/management/client.rb', line 82 def spaces ClientSpaceMethodsFactory.new(self) end |
#webhooks ⇒ Contentful::Management::ClientWebhookMethodsFactory
Allows manipulation of webhooks in context of the current client Allows listing all webhooks for client, creating new and finding one by id.
154 155 156 |
# File 'lib/contentful/management/client.rb', line 154 def webhooks ClientWebhookMethodsFactory.new(self) end |