Class: EasyqaApi::TestObject

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

Overview

Test object representation from EasyQA website

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

#attributesHash

Returns item attributes from response body in your requests.

Returns:

  • (Hash)

    item attributes from response body in your requests



9
# File 'lib/easyqa_api/items/test_object.rb', line 9

attr_accessor :id, :attributes, :project_token

#idFixnum

Returns The uniq identeficator item on EasyQA website.

Returns:

  • (Fixnum)

    The uniq identeficator item on EasyQA website



9
10
11
# File 'lib/easyqa_api/items/test_object.rb', line 9

def id
  @id
end

#project_tokenString

Returns your project token.

Returns:

  • (String)

    your project token



9
# File 'lib/easyqa_api/items/test_object.rb', line 9

attr_accessor :id, :attributes, :project_token

Class Method Details

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

List of all test objects

Parameters:

  • user (Easyqapi::User) (defaults to: @@default_user)

    authenticated user in EasyQA

  • project_token (String)

    token of project

Returns:

  • (Array)

    list of test objects on EasyQA website

See Also:



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

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

Create test object on EasyQA website Have a class method analog

Parameters:

  • user (Easyqapi::User) (defaults to: @@default_user)

    authenticated user in EasyQA

  • attrs (Hash)

    attributes for action

Options Hash (attrs):

  • :project_token (String) — default: @project_token

    Project token on EasyQA

  • :link (String)

    link to your webiste for web object on EasyQA website

  • :file (Faraday::UploadIO)

    your apk or ipa file

Returns:

  • (Hash)

    item attribtues on EasyQA website

See Also:



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

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

Delete test object on EasyQA website Have a class method analog

Parameters:

  • user (Easyqapi::User) (defaults to: @@default_user)

    authenticated user in EasyQA

  • project_token (String) (defaults to: @project_token)

    token of project

  • id (String) (defaults to: @id)

    item id

Returns:

  • (Hash)

    item attribtues on EasyQA website

See Also:



54
55
56
57
58
59
60
61
# File 'lib/easyqa_api/items/test_object.rb', line 54

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

Show test object from EasyQA website Have a class method analog

Parameters:

  • user (Easyqapi::User) (defaults to: @@default_user)

    authenticated user in EasyQA

  • project_token (String) (defaults to: @project_token)

    token of project

  • id (String) (defaults to: @id)

    item id

Returns:

  • (Hash)

    item attribtues on EasyQA website

See Also:



43
44
45
46
47
48
49
50
# File 'lib/easyqa_api/items/test_object.rb', line 43

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