Class: Yao::Resources::RoleAssignment

Inherits:
Base
  • Object
show all
Defined in:
lib/yao/resources/role_assignment.rb

Instance Attribute Summary

Attributes included from RestfullyAccessible

#service

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#[], #[]=, add_instantiation_name_list, #destroy, friendly_attributes, #id, #initialize, instantiation?, map_attribute_to_attribute, map_attribute_to_resource, map_attribute_to_resources, map_attributes_to_time, #to_hash, #update

Methods included from RestfullyAccessible

#admin=, #api_version, #api_version=, #as_member, #client, #create, #destroy, extended, #find_by_name, #get, #get!, #list, #resources_path, #resources_path=, #return_single_on_querying, #return_single_on_querying=, #update

Constructor Details

This class inherits a constructor from Yao::Resources::Base

Class Method Details

.create_url(_subpath = '') ⇒ String

Parameters:

  • _subpath (String) (defaults to: '')

Returns:

  • (String)


22
23
24
# File 'lib/yao/resources/role_assignment.rb', line 22

def create_url(_subpath='')
  resources_name
end

.get(opt = {}) ⇒ Object

Parameters:

  • query (Hash)


27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/yao/resources/role_assignment.rb', line 27

def get(opt = {})
  query = {}

  if (user = opt[:user])
    query['user.id'] = resource_id_or_string(user)
  end

  if (project = opt[:project] || opt[:tenant])
    query['scope.project.id'] = resource_id_or_string(project)
  end

  list(query)
end

Instance Method Details

#projectYao::Resources::Project



15
16
17
# File 'lib/yao/resources/role_assignment.rb', line 15

def project
  @project ||= Yao::Project.get(scope["project"]["id"])
end