Class: EasyqaApi::Organization
- Defined in:
- lib/easyqa_api/items/organization.rb
Overview
Organization representation from EasyQA
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.
-
#title ⇒ String
Title of organization on EasyQA.
Class Method Summary collapse
-
.all(user = @@default_user) ⇒ Array
Retrieve all organizations from user.
Instance Method Summary collapse
-
#create(attrs, user = @@default_user) ⇒ Hash
Create organization on EasyQA website Have a class method analog.
-
#delete(id = @id, user = @@default_user) ⇒ Hash
Delete organization on EasyQA website Have a class method analog.
-
#show(id = @id, user = @@default_user) ⇒ Hash
Show a organization on EasyQA website Have a class method analog.
-
#update(attrs, user = @@default_user) ⇒ Hash
Update organization on EasyQA website Have a class method analog.
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.
16 |
# File 'lib/easyqa_api/items/organization.rb', line 16 attr_accessor :title, :id, :attributes |
#id ⇒ Fixnum
Returns The uniq identeficator item on EasyQA website.
16 |
# File 'lib/easyqa_api/items/organization.rb', line 16 attr_accessor :title, :id, :attributes |
#title ⇒ String
Returns Title of organization on EasyQA.
16 17 18 |
# File 'lib/easyqa_api/items/organization.rb', line 16 def title @title end |
Class Method Details
.all(user = @@default_user) ⇒ Array
Retrieve all organizations from user
24 25 26 27 28 29 30 |
# File 'lib/easyqa_api/items/organization.rb', line 24 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) ⇒ Hash
Create organization on EasyQA website Have a class method analog
34 35 36 37 38 39 40 41 |
# File 'lib/easyqa_api/items/organization.rb', line 34 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) ⇒ Hash
Delete organization on EasyQA website Have a class method analog
68 69 70 71 72 73 74 |
# File 'lib/easyqa_api/items/organization.rb', line 68 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) ⇒ Hash
Show a organization on EasyQA website Have a class method analog
45 46 47 48 49 50 51 |
# File 'lib/easyqa_api/items/organization.rb', line 45 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) ⇒ Hash
Update organization on EasyQA website Have a class method analog
56 57 58 59 60 61 62 63 64 |
# File 'lib/easyqa_api/items/organization.rb', line 56 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 |