Class: EasyqaApi::TestObject

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

def attributes
  @attributes
end

#idObject

Returns the value of attribute id.



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

def id
  @id
end

#project_tokenObject

Returns the value of attribute project_token.



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

def project_token
  @project_token
end

Class Method Details

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



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

def self.all(project_token, user = @@default_user)
  send_request('test_objects', :get) do |req|
    req.params = {
      auth_token: user.auth_token,
      token: project_token
    }
  end
end

Instance Method Details

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



16
17
18
19
20
21
22
23
24
# File 'lib/easyqa_api/items/test_object.rb', line 16

def create(attrs, user = @@default_user)
  attrs = { project_token: @project_token }.merge(attrs)
  @attributes = send_request('test_objects', :post, :multipart) do |req|
    req.body = {
      token: attrs[:project_token],
      auth_token: user.auth_token
    }.merge(attrs.except(:project_token))
  end
end

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



35
36
37
38
39
40
41
42
# File 'lib/easyqa_api/items/test_object.rb', line 35

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

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



26
27
28
29
30
31
32
33
# File 'lib/easyqa_api/items/test_object.rb', line 26

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