Class: Contentful::Management::Space
- Inherits:
-
Object
- Object
- Contentful::Management::Space
- Includes:
- Resource, Resource::Refresher, Resource::SystemProperties
- Defined in:
- lib/contentful/management/space.rb
Overview
Resource class for Space.
Instance Attribute Summary
Attributes included from Resource::SystemProperties
Attributes included from Resource
#client, #properties, #raw_object, #request
Class Method Summary collapse
-
.all(client, query = {}) ⇒ Contentful::Management::Array<Contentful::Management::Space>
Gets all Spaces.
-
.create(client, attributes) ⇒ Contentful::Management::Space
Create a space.
-
.find(client, space_id) ⇒ Contentful::Management::Space
Gets a specific space.
Instance Method Summary collapse
-
#api_keys ⇒ Contentful::Management::SpaceApiKeyMethodsFactory
Allows manipulation of api keys in context of the current space Allows listing all api keys of space, creating new and finding one by ID.
-
#destroy ⇒ true, Contentful::Management::Error
Destroys a space.
-
#environments ⇒ Contentful::Management::SpaceEnvironmentMethodsFactory
Allows manipulation of environments in context of the current space Allows listing all environments of space, creating new and finding one by ID.
-
#preview_api_keys ⇒ Contentful::Management::SpacePreviewApiKeyMethodsFactory
Allows manipulation of preview api keys in context of the current space Allows listing all api keys of space and finding one by ID.
-
#roles ⇒ Contentful::Management::SpaceRoleMethodsFactory
Allows manipulation of roles in context of the current space Allows listing all roles of space, creating new and finding one by ID.
-
#save ⇒ Contentful::Management::Space
If a space is new, an object gets created in the Contentful, otherwise the existing space gets updated.
-
#space_memberships ⇒ Contentful::Management::SpaceSpaceMembershipMethodsFactory
Allows manipulation of space memberships in context of the current space Allows listing all space memberships of space, creating new and finding one by ID.
-
#update(attributes) ⇒ Contentful::Management::Space
Updates a space.
-
#users ⇒ Contentful::Management::SpaceUserMethodsFactory
Allows viewing of users in context of the current space Allows listing all users of space, and finding one by ID.
-
#webhooks ⇒ Contentful::Management::SpaceWebhookMethodsFactory
Allows manipulation of webhooks in context of the current space Allows listing all webhooks for space and finding one by ID.
Methods included from Resource::Refresher
Methods included from Resource
#array?, #default_locale, #environment_id, #fields, #nested_locale_fields?, #resource?, #sys
Class Method Details
.all(client, query = {}) ⇒ Contentful::Management::Array<Contentful::Management::Space>
Gets all Spaces
42 43 44 |
# File 'lib/contentful/management/space.rb', line 42 def self.all(client, query = {}) ClientSpaceMethodsFactory.new(client).all(query) end |
.create(client, attributes) ⇒ Contentful::Management::Space
Create a space.
76 77 78 |
# File 'lib/contentful/management/space.rb', line 76 def self.create(client, attributes) ResourceRequester.new(client, self).create({}, attributes) end |
.find(client, space_id) ⇒ Contentful::Management::Space
Gets a specific space.
52 53 54 |
# File 'lib/contentful/management/space.rb', line 52 def self.find(client, space_id) ClientSpaceMethodsFactory.new(client).find(space_id) end |
Instance Method Details
#api_keys ⇒ Contentful::Management::SpaceApiKeyMethodsFactory
Allows manipulation of api keys in context of the current space Allows listing all api keys of space, creating new and finding one by ID.
131 132 133 |
# File 'lib/contentful/management/space.rb', line 131 def api_keys SpaceApiKeyMethodsFactory.new(self) end |
#destroy ⇒ true, Contentful::Management::Error
Destroys a space.
113 114 115 |
# File 'lib/contentful/management/space.rb', line 113 def destroy ResourceRequester.new(client, self.class).destroy(space_id: id) end |
#environments ⇒ Contentful::Management::SpaceEnvironmentMethodsFactory
Allows manipulation of environments in context of the current space Allows listing all environments of space, creating new and finding one by ID.
122 123 124 |
# File 'lib/contentful/management/space.rb', line 122 def environments SpaceEnvironmentMethodsFactory.new(self) end |
#preview_api_keys ⇒ Contentful::Management::SpacePreviewApiKeyMethodsFactory
Allows manipulation of preview api keys in context of the current space Allows listing all api keys of space and finding one by ID.
140 141 142 |
# File 'lib/contentful/management/space.rb', line 140 def preview_api_keys SpacePreviewApiKeyMethodsFactory.new(self) end |
#roles ⇒ Contentful::Management::SpaceRoleMethodsFactory
Allows manipulation of roles in context of the current space Allows listing all roles of space, creating new and finding one by ID.
158 159 160 |
# File 'lib/contentful/management/space.rb', line 158 def roles SpaceRoleMethodsFactory.new(self) end |
#save ⇒ Contentful::Management::Space
If a space is new, an object gets created in the Contentful, otherwise the existing space gets updated.
101 102 103 104 105 106 107 108 |
# File 'lib/contentful/management/space.rb', line 101 def save if id update(name: name, organization_id: organization) else new_instance = self.class.create(client, name: name, organization_id: organization) refresh_data(new_instance) end end |
#space_memberships ⇒ Contentful::Management::SpaceSpaceMembershipMethodsFactory
Allows manipulation of space memberships in context of the current space Allows listing all space memberships of space, creating new and finding one by ID.
149 150 151 |
# File 'lib/contentful/management/space.rb', line 149 def space_memberships SpaceSpaceMembershipMethodsFactory.new(self) end |
#update(attributes) ⇒ Contentful::Management::Space
Updates a space.
87 88 89 90 91 92 93 94 95 |
# File 'lib/contentful/management/space.rb', line 87 def update(attributes) ResourceRequester.new(client, self.class).update( self, { space_id: id }, { 'name' => attributes.fetch(:name) }, version: sys[:version], organization_id: attributes[:organization_id] ) end |
#users ⇒ Contentful::Management::SpaceUserMethodsFactory
Allows viewing of users in context of the current space Allows listing all users of space, and finding one by ID.
167 168 169 |
# File 'lib/contentful/management/space.rb', line 167 def users SpaceUserMethodsFactory.new(self) end |
#webhooks ⇒ Contentful::Management::SpaceWebhookMethodsFactory
Allows manipulation of webhooks in context of the current space Allows listing all webhooks for space and finding one by ID.
176 177 178 |
# File 'lib/contentful/management/space.rb', line 176 def webhooks SpaceWebhookMethodsFactory.new(self) end |