Class: Asana::Resources::ProjectMembership
- Inherits:
-
ProjectMembershipsBase
- Object
- Resource
- ProjectMembershipsBase
- 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
- #gid ⇒ Object readonly
- #project ⇒ Object readonly
- #resource_type ⇒ Object readonly
- #user ⇒ Object readonly
- #write_access ⇒ Object readonly
Class Method Summary collapse
-
.find_by_id(client, id, options: {}) ⇒ Object
(also: get_single)
Returns the project membership record.
-
.find_by_project(client, project: required("project"), user: nil, per_page: 20, options: {}) ⇒ Object
(also: get_many)
Returns the compact project membership records for the project.
-
.plural_name ⇒ Object
Returns the plural name of the resource.
Methods inherited from ProjectMembershipsBase
get_project_membership, get_project_memberships_for_project, inherited
Methods inherited from Resource
#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
#gid ⇒ Object (readonly)
12 13 14 |
# File 'lib/asana/resources/project_membership.rb', line 12 def gid @gid end |
#project ⇒ Object (readonly)
18 19 20 |
# File 'lib/asana/resources/project_membership.rb', line 18 def project @project end |
#resource_type ⇒ Object (readonly)
14 15 16 |
# File 'lib/asana/resources/project_membership.rb', line 14 def resource_type @resource_type end |
#user ⇒ Object (readonly)
16 17 18 |
# File 'lib/asana/resources/project_membership.rb', line 16 def user @user end |
#write_access ⇒ Object (readonly)
20 21 22 |
# File 'lib/asana/resources/project_membership.rb', line 20 def write_access @write_access end |
Class Method Details
.find_by_id(client, id, options: {}) ⇒ Object Also known as: get_single
Returns the project membership record.
45 46 47 48 |
# File 'lib/asana/resources/project_membership.rb', line 45 def find_by_id(client, id, options: {}) self.new(parse(client.get("/project_memberships/#{id}", options: )).first, client: client) end |
.find_by_project(client, project: required("project"), user: nil, per_page: 20, options: {}) ⇒ Object Also known as: get_many
Returns the compact project membership records for the project.
34 35 36 37 |
# File 'lib/asana/resources/project_membership.rb', line 34 def find_by_project(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 |
.plural_name ⇒ Object
Returns the plural name of the resource.
24 25 26 |
# File 'lib/asana/resources/project_membership.rb', line 24 def plural_name 'project_memberships' end |