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.
36 37 38 |
# File 'lib/contentful/management/api_key.rb', line 36 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.
47 48 49 |
# File 'lib/contentful/management/api_key.rb', line 47 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
52 53 54 |
# File 'lib/contentful/management/api_key.rb', line 52 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
59 60 61 |
# File 'lib/contentful/management/api_key.rb', line 59 def preview_api_key client.preview_api_keys(space.id).find(properties[:preview_api_key].id) end |