Class: Setka::Workflow::Ticket

Inherits:
Resource
  • Object
show all
Defined in:
lib/setka/workflow/ticket.rb

Class Method Summary collapse

Methods inherited from Resource

actual_client, collection, member

Class Method Details

.publish(id, options = {}) ⇒ Hash

Publishes a ticket.

Parameters:

  • id (Integer)

    Ticket’s id.

  • options (Hash) (defaults to: {})

    Additional options (explicit HTTP headers, specific Client object).

Returns:

  • (Hash)

    Hash of ticket’s attibutes.

Raises:

  • (Workflow::Ticket)

    if a ticket with the given ID could not be found, if the ticket is already published.



17
18
19
# File 'lib/setka/workflow/ticket.rb', line 17

def publish(id, options = {})
  member(:patch, id, :publish, nil, options)
end

.sync_analytics(body, options = {}) ⇒ Array

Sync ticket’s analytics.

Parameters:

  • body (Hash)

    Hash with ticket’s attributes to update.

  • options (Hash) (defaults to: {})

    Additional options (explicit HTTP headers, specific Client object).

Returns:

  • (Array)

    Array of hashes with ticket’s views and comment counts and the result of syncing.



62
63
64
# File 'lib/setka/workflow/ticket.rb', line 62

def sync_analytics(body, options = {})
  collection(:patch, :sync_analytics, body, options)
end

.unpublish(id, options = {}) ⇒ Hash

Unpublishes a ticket.

Parameters:

  • id (Integer)

    Ticket’s id.

  • options (Hash) (defaults to: {})

    Additional options (explicit HTTP headers, specific Client object).

Returns:

  • (Hash)

    Hash of ticket’s attibutes.

Raises:

  • (Workflow::Ticket)

    if a ticket with the given ID could not be found, if the ticket is already unpublished.



32
33
34
# File 'lib/setka/workflow/ticket.rb', line 32

def unpublish(id, options = {})
  member(:patch, id, :unpublish, nil, options)
end

.update(id, body, options = {}) ⇒ Hash

Updates a ticket.

Parameters:

  • id (Integer)

    Ticket’s id.

  • body (Hash)

    Hash with ticket’s attributes to update.

  • options (Hash) (defaults to: {})

    Additional options (explicit HTTP headers, specific Client object).

Returns:

  • (Hash)

    Hash of ticket’s attibutes.

Raises:

  • (Workflow::Ticket)

    if a ticket with the given ID could not be found, if format of some attribute(s) is wrong (e.g. date and published_at should be passed as unix timestamps).



49
50
51
# File 'lib/setka/workflow/ticket.rb', line 49

def update(id, body, options = {})
  member(:patch, id, nil, body, options)
end