Class: Asana::Resources::ProjectMembership
- Defined in:
- lib/asana/resources/project_membership.rb
Overview
With the introduction of “comment-only” projects in Asana, a user’s membership in a project comes with associated permissions. These permissions (whether a user has full access to the project or comment-only access) are accessible through the project memberships endpoints described here.
Instance Attribute Summary collapse
- #id ⇒ Object readonly
- #project ⇒ Object readonly
- #user ⇒ Object readonly
- #write_access ⇒ Object readonly
Class Method Summary collapse
-
.get_many(client, project: required("project"), user: nil, per_page: 20, options: {}) ⇒ Object
Returns the compact project membership records for the project.
-
.get_single(client, project: required("project"), options: {}) ⇒ Object
Returns the project membership record.
-
.plural_name ⇒ Object
Returns the plural name of the resource.
Methods inherited from Resource
inherited, #initialize, #method_missing, #refresh, #respond_to_missing?, #to_h, #to_s
Methods included from ResponseHelper
Constructor Details
This class inherits a constructor from Asana::Resources::Resource
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Asana::Resources::Resource
Instance Attribute Details
#id ⇒ Object (readonly)
13 14 15 |
# File 'lib/asana/resources/project_membership.rb', line 13 def id @id end |
#project ⇒ Object (readonly)
17 18 19 |
# File 'lib/asana/resources/project_membership.rb', line 17 def project @project end |
#user ⇒ Object (readonly)
15 16 17 |
# File 'lib/asana/resources/project_membership.rb', line 15 def user @user end |
#write_access ⇒ Object (readonly)
19 20 21 |
# File 'lib/asana/resources/project_membership.rb', line 19 def write_access @write_access end |
Class Method Details
.get_many(client, project: required("project"), user: nil, per_page: 20, options: {}) ⇒ Object
Returns the compact project membership records for the project.
33 34 35 36 |
# File 'lib/asana/resources/project_membership.rb', line 33 def get_many(client, project: required("project"), user: nil, per_page: 20, options: {}) params = { user: user, limit: per_page }.reject { |_,v| v.nil? || Array(v).empty? } Collection.new(parse(client.get("/projects/#{project}/project_memberships", params: params, options: )), type: Resource, client: client) end |
.get_single(client, project: required("project"), options: {}) ⇒ Object
Returns the project membership record.
43 44 45 46 |
# File 'lib/asana/resources/project_membership.rb', line 43 def get_single(client, project: required("project"), options: {}) Resource.new(parse(client.get("/project_memberships/#{project}", options: )).first, client: client) end |
.plural_name ⇒ Object
Returns the plural name of the resource.
23 24 25 |
# File 'lib/asana/resources/project_membership.rb', line 23 def plural_name 'project_memberships' end |