Class: EasyqaApi::Role
Overview
Role representation from EasyQA website
Project role can be 'developer', 'tester', 'viewer' or 'project_manager'
Organization role can be 'user' or 'admin'
Constant Summary
Constants inherited from Item
Constants included from ClassMethodsSettable
Instance Attribute Summary collapse
-
#attributes ⇒ Hash
Item attributes from response body in your requests.
-
#id ⇒ Fixnum
The uniq identeficator item on EasyQA website.
-
#role ⇒ String
Role user in currentproject or organization.
Class Method Summary collapse
-
.all(organization_id, user = @@default_user) ⇒ Array
Retrieve all roles from organization.
Instance Method Summary collapse
-
#create(attrs, user = @@default_user) ⇒ Hash
Create role on EasyQA website.
-
#delete(id = @id, user = @@default_user) ⇒ Hash
Delete role on EasyQA website.
-
#show(id = @id, user = @@default_user) ⇒ Hash
Show role from EasyQA website.
-
#update(role, id = @id, user = @@default_user) ⇒ Hash
Update role on EasyQA website.
Methods inherited from Item
#initialize, #install_variables!, json_connection, multipart_connection, operation_status, send_request
Methods included from ClassMethodsSettable
Constructor Details
This class inherits a constructor from EasyqaApi::Item
Instance Attribute Details
#attributes ⇒ Hash
Returns item attributes from response body in your requests.
17 |
# File 'lib/easyqa_api/items/role.rb', line 17 attr_accessor :role, :id, :attributes |
#id ⇒ Fixnum
Returns The uniq identeficator item on EasyQA website.
17 |
# File 'lib/easyqa_api/items/role.rb', line 17 attr_accessor :role, :id, :attributes |
#role ⇒ String
Returns Role user in currentproject or organization.
17 18 19 |
# File 'lib/easyqa_api/items/role.rb', line 17 def role @role end |
Class Method Details
.all(organization_id, user = @@default_user) ⇒ Array
Retrieve all roles from organization
26 27 28 29 30 31 32 |
# File 'lib/easyqa_api/items/role.rb', line 26 def self.all(organization_id, user = @@default_user) send_request("organizations/#{organization_id}/roles", :get) do |req| req.params = { auth_token: user.auth_token } end end |
Instance Method Details
#create(attrs, user = @@default_user) ⇒ Hash
Create role on EasyQA website. Have a class method analog
39 40 41 42 43 44 45 |
# File 'lib/easyqa_api/items/role.rb', line 39 def create(attrs, user = @@default_user) @attributes = send_request("organizations/#{attrs[:organization_id]}/roles", :post) do |req| req.body = { auth_token: user.auth_token }.merge(attrs.except(:organization_id)) end end |
#delete(id = @id, user = @@default_user) ⇒ Hash
Delete role on EasyQA website. Have a class method analog
71 72 73 74 75 76 77 |
# File 'lib/easyqa_api/items/role.rb', line 71 def delete(id = @id, user = @@default_user) @attributes = send_request("roles/#{id}", :delete) do |req| req.params = { auth_token: user.auth_token } end end |
#show(id = @id, user = @@default_user) ⇒ Hash
Show role from EasyQA website. Have a class method analog
49 50 51 52 53 54 55 |
# File 'lib/easyqa_api/items/role.rb', line 49 def show(id = @id, user = @@default_user) @attributes = send_request("roles/#{id}", :get) do |req| req.params = { auth_token: user.auth_token } end end |
#update(role, id = @id, user = @@default_user) ⇒ Hash
Update role on EasyQA website. Have a class method analog
60 61 62 63 64 65 66 67 |
# File 'lib/easyqa_api/items/role.rb', line 60 def update(role, id = @id, user = @@default_user) @attributes = send_request("roles/#{id}", :put) do |req| req.body = { role: role, auth_token: user.auth_token } end end |