Class: Contentful::Management::SpaceMembership

Inherits:
Object
  • Object
show all
Includes:
Resource, Resource::Refresher, Resource::SystemProperties
Defined in:
lib/contentful/management/space_membership.rb

Overview

Resource class for Space Membership.

Instance Attribute Summary

Attributes included from Resource::SystemProperties

#sys

Attributes included from Resource

#client, #properties, #raw_object, #request

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Resource::Refresher

#reload

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::SpaceMembership

Creates an Space Membership

Parameters:

Returns:

See Also:

  • README for full attribute list for each resource.


44
45
46
# File 'lib/contentful/management/space_membership.rb', line 44

def self.create(client, space_id, attributes = {})
  super(client, space_id, nil, attributes)
end

.find(client, space_id, space_membership_id) ⇒ Contentful::Management::SpaceMembership

Finds an Space Membership by ID.

Parameters:

Returns:



55
56
57
# File 'lib/contentful/management/space_membership.rb', line 55

def self.find(client, space_id, space_membership_id)
  super(client, space_id, nil, space_membership_id)
end

Instance Method Details

#rolesObject

Returns the list of roles for this membership.



18
19
20
# File 'lib/contentful/management/space_membership.rb', line 18

def roles
  (properties[:roles] || []).map { |r| r.is_a?(Link) ? r : Link.new(r, nil, client) }
end