Class: EasyqaApi::Role

Inherits:
Item
  • Object
show all
Defined in:
lib/easyqa_api/items/role.rb

Constant Summary

Constants inherited from Item

Item::CONNECTION

Constants included from ClassMethodsSettable

ClassMethodsSettable::METHODS

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Item

#initialize, #install_variables!, json_connection, multipart_connection, operation_status, send_request

Methods included from ClassMethodsSettable

#install_class_methods!

Constructor Details

This class inherits a constructor from EasyqaApi::Item

Instance Attribute Details

#attributesObject

Returns the value of attribute attributes.



3
4
5
# File 'lib/easyqa_api/items/role.rb', line 3

def attributes
  @attributes
end

#idObject

Returns the value of attribute id.



3
4
5
# File 'lib/easyqa_api/items/role.rb', line 3

def id
  @id
end

#roleObject

Returns the value of attribute role.



3
4
5
# File 'lib/easyqa_api/items/role.rb', line 3

def role
  @role
end

Class Method Details

.all(organization_id, user = @@default_user) ⇒ Object



7
8
9
10
11
12
13
# File 'lib/easyqa_api/items/role.rb', line 7

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) ⇒ Object



15
16
17
18
19
20
21
# File 'lib/easyqa_api/items/role.rb', line 15

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) ⇒ Object



40
41
42
43
44
45
46
# File 'lib/easyqa_api/items/role.rb', line 40

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) ⇒ Object



23
24
25
26
27
28
29
# File 'lib/easyqa_api/items/role.rb', line 23

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) ⇒ Object



31
32
33
34
35
36
37
38
# File 'lib/easyqa_api/items/role.rb', line 31

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