class Contentful::Management::Role
Public Class Methods
create(client, space_id, attributes = {})
click to toggle source
Creates a role.
@param [Contentful::Management::Client] client @param [String] space_id @param [Hash] attributes
@return [Contentful::Management::Role]
Calls superclass method
# File lib/contentful/management/role.rb, line 33 def self.create(client, space_id, attributes = {}) super(client, space_id, nil, attributes) end
create_attributes(_client, attributes)
click to toggle source
@private
# File lib/contentful/management/role.rb, line 17 def self.create_attributes(_client, attributes) { 'name' => attributes.fetch(:name), 'description' => attributes.fetch(:description), 'permissions' => attributes.fetch(:permissions), 'policies' => attributes.fetch(:policies) } end
find(client, space_id, role_id)
click to toggle source
Finds a role by ID.
@param [Contentful::Management::Client] client @param [String] space_id @param [String] role_id
@return [Contentful::Management::Role]
Calls superclass method
# File lib/contentful/management/role.rb, line 44 def self.find(client, space_id, role_id) super(client, space_id, nil, role_id) end
Protected Instance Methods
query_attributes(attributes)
click to toggle source
# File lib/contentful/management/role.rb, line 50 def query_attributes(attributes) { name: name, description: description, permissions: permissions, policies: policies }.merge( attributes.each_with_object({}) { |(k, v), result| result[k.to_sym] = v } ) end
refresh_find()
click to toggle source
@private
# File lib/contentful/management/role.rb, line 62 def refresh_find self.class.find(client, space.id, id) end