lib/gooddata/models/project_role.rb in gooddata-0.6.7 vs lib/gooddata/models/project_role.rb in gooddata-0.6.8
- old
+ new
@@ -1,47 +1,45 @@
# encoding: UTF-8
+require 'pmap'
+
require_relative 'profile'
-require_relative '../mixins/mixins'
+require_relative '../rest/rest'
+require_relative '../mixins/rest_resource'
+
module GoodData
- class ProjectRole
+ class ProjectRole < GoodData::Rest::Object
attr_accessor :json
- include GoodData::Mixin::RestGetters
+ include GoodData::Mixin::RestResource
- class << self
- include GoodData::Mixin::RestResource
- end
+ root_key :projectRole
- ProjectRole.root_key :projectRole
-
- include GoodData::Mixin::RootKeyGetter
include GoodData::Mixin::Author
include GoodData::Mixin::Contributor
include GoodData::Mixin::Timestamps
def initialize(json)
@json = json
end
- ProjectRole.data_property_reader :permissions
+ data_property_reader :permissions
- ProjectRole.metadata_property_reader :identifier, :title, :summary
+ metadata_property_reader :identifier, :title, :summary
# Gets Users with this Role
#
# @return [Array<GoodData::Profile>] List of users
def users
- res = []
url = data['links']['roleUsers']
- tmp = GoodData.get url
- tmp['associatedUsers']['users'].each do |user_url|
- user = GoodData.get user_url
- res << GoodData::Profile.new(user)
+ tmp = client.get url
+ tmp['associatedUsers']['users'].pmap do |user_url|
+ url = user_url
+ user = client.get url
+ client.create(GoodData::Profile, user)
end
- res
end
# Gets Raw object URI
#
# @return [string] URI of this project role