Class: Contentful::Management::ApiKey
- Inherits:
-
Object
- Object
- Contentful::Management::ApiKey
- Includes:
- Resource, Resource::Refresher, Resource::SystemProperties
- Defined in:
- lib/contentful/management/api_key.rb
Overview
Resource class for ApiKey.
Instance Attribute Summary
Attributes included from Resource::SystemProperties
Attributes included from Resource
#client, #properties, #raw_object, #request
Class Method Summary collapse
-
.create(client, space_id, attributes = {}) ⇒ Contentful::Management::ApiKey
Creates an API Key.
-
.find(client, space_id, api_key_id) ⇒ Contentful::Management::ApiKey
Finds an API Key by ID.
Instance Method Summary collapse
-
#environments ⇒ Object
Returns the environment links associated to this Api Key.
-
#preview_api_key ⇒ Contentful::Management::PreviewApiKey
Finds the Preview API Key associated to this API Key.
Methods included from Resource::Refresher
Methods included from Resource
#array?, #default_locale, #destroy, #environment_id, #fields, #nested_locale_fields?, #resource?, #save, #sys, #update
Class Method Details
.create(client, space_id, attributes = {}) ⇒ Contentful::Management::ApiKey
Creates an API Key.
38 39 40 |
# File 'lib/contentful/management/api_key.rb', line 38 def self.create(client, space_id, attributes = {}) super(client, space_id, nil, attributes) end |
.find(client, space_id, api_key_id) ⇒ Contentful::Management::ApiKey
Finds an API Key by ID.
49 50 51 |
# File 'lib/contentful/management/api_key.rb', line 49 def self.find(client, space_id, api_key_id) super(client, space_id, nil, api_key_id) end |
Instance Method Details
#environments ⇒ Object
Returns the environment links associated to this Api Key
54 55 56 |
# File 'lib/contentful/management/api_key.rb', line 54 def environments properties[:environments].map { |environment| Link.new(environment, nil, client) } end |
#preview_api_key ⇒ Contentful::Management::PreviewApiKey
Finds the Preview API Key associated to this API Key
61 62 63 |
# File 'lib/contentful/management/api_key.rb', line 61 def preview_api_key client.preview_api_keys(space.id).find(properties[:preview_api_key].id) end |