Class: EasyqaApi::Status

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

Overview

Status representation on 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



15
# File 'lib/easyqa_api/items/status.rb', line 15

attr_accessor :name, :id, :attributes, :project_token

#idFixnum

Returns The uniq identeficator item on EasyQA website.

Returns:

  • (Fixnum)

    The uniq identeficator item on EasyQA website



15
# File 'lib/easyqa_api/items/status.rb', line 15

attr_accessor :name, :id, :attributes, :project_token

#nameString

Returns Status name on EasyQA.

Returns:

  • (String)

    Status name on EasyQA



15
16
17
# File 'lib/easyqa_api/items/status.rb', line 15

def name
  @name
end

#project_tokenString

Returns your project token.

Returns:

  • (String)

    your project token



15
# File 'lib/easyqa_api/items/status.rb', line 15

attr_accessor :name, :id, :attributes, :project_token

Class Method Details

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

Retrieve all issues in project

Parameters:

  • project_token (String)

    token of project

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

    authenticated user in EasyQA

Returns:

  • (Array)

    list of statuses on EasyQA website

See Also:



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

def self.all(project_token, user = @@default_user)
  send_request('statuses', :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 status 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

  • :id (Fixnum) — default: @id

    uniq item identeficator

  • :name (String)

    status name

Returns:

  • (Hash)

    item attribtues on EasyQA website

See Also:



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

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

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

Delete status on EasyQA website Have a class method analog

Parameters:

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

    authenticated user in EasyQA

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

    status id on EasyQA website

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

    project token on EasyQA website

Returns:

  • (Hash)

    item attribtues on EasyQA website

See Also:



73
74
75
76
77
78
79
80
# File 'lib/easyqa_api/items/status.rb', line 73

def delete(project_token = @project_token, id = @id, user = @@default_user)
  @attributes = send_request("statuses/#{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 status from EasyQA website Have a class method analog

Parameters:

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

    authenticated user in EasyQA

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

    status id on EasyQA website

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

    project token on EasyQA website

Returns:

  • (Hash)

    item attribtues on EasyQA website

See Also:



48
49
50
51
52
53
54
55
# File 'lib/easyqa_api/items/status.rb', line 48

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

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

Update status 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

  • :id (Fixnum) — default: @id

    uniq item identeficator

  • :name (String)

    status name

  • :id (Fixnum) — default: @id

    status id on EasyQA website

Returns:

  • (Hash)

    item attribtues on EasyQA website

See Also:



60
61
62
63
64
65
66
67
68
69
# File 'lib/easyqa_api/items/status.rb', line 60

def update(attrs, user = @@default_user)
  attrs = { id: @id, project_token: @project_token }.merge(attrs)
  @attributes = send_request("statuses/#{attrs[:id]}", :put) do |req|
    req.body = {
      status_object: attrs.slice(:name),
      token: attrs[:project_token],
      auth_token: user.auth_token
    }
  end
end