Class: EasyqaApi::Organization

Inherits:
Item
  • Object
show all
Defined in:
lib/easyqa_api/items/organization.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/organization.rb', line 3

def attributes
  @attributes
end

#descriptionObject

Returns the value of attribute description.



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

def description
  @description
end

#idObject

Returns the value of attribute id.



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

def id
  @id
end

#titleObject

Returns the value of attribute title.



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

def title
  @title
end

Class Method Details

.all(user = @@default_user) ⇒ Object



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

def self.all(user = @@default_user)
  send_request('organizations', :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
22
# File 'lib/easyqa_api/items/organization.rb', line 15

def create(attrs, user = @@default_user)
  @attributes = send_request('organizations', :post) do |req|
    req.body = {
      organization: attrs,
      auth_token: user.auth_token
    }
  end
end

#delete(id = @id, user = @@default_user) ⇒ Object



42
43
44
45
46
47
48
# File 'lib/easyqa_api/items/organization.rb', line 42

def delete(id = @id, user = @@default_user)
  @attributes = send_request("organizations/#{id}", :delete) do |req|
    req.params = {
      auth_token: user.auth_token
    }
  end
end

#show(id = @id, user = @@default_user) ⇒ Object



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

def show(id = @id, user = @@default_user)
  @attributes = send_request("organizations/#{id}", :get) do |req|
    req.params = {
      auth_token: user.auth_token
    }
  end
end

#update(attrs, user = @@default_user) ⇒ Object



32
33
34
35
36
37
38
39
40
# File 'lib/easyqa_api/items/organization.rb', line 32

def update(attrs, user = @@default_user)
  attrs = { id: @id }.merge(attrs)
  @attributes = send_request("organizations/#{attrs[:id]}", :put) do |req|
    req.body = {
      organization: attrs.except(:id),
      auth_token: user.auth_token
    }
  end
end