Class: Asana::Resources::Event

Inherits:
Resource
  • Object
show all
Defined in:
lib/asana/resource_includes/event.rb

Overview

An event is an object representing a change to a resource that was observed by an event subscription.

In general, requesting events on a resource is faster and subject to higher rate limits than requesting the resource itself. Additionally, change events bubble up - listening to events on a project would include when stories are added to tasks in the project, even on subtasks.

Establish an initial sync token by making a request with no sync token. The response will be a `412` error - the same as if the sync token had expired.

Subsequent requests should always provide the sync token from the immediately preceding call.

Sync tokens may not be valid if you attempt to go 'backward' in the history by requesting previous tokens, though re-requesting the current sync token is generally safe, and will always return the same results.

When you receive a `412 Precondition Failed` error, it means that the sync token is either invalid or expired. If you are attempting to keep a set of data in sync, this signals you may need to re-crawl the data.

Sync tokens always expire after 24 hours, but may expire sooner, depending on load on the service.

Instance Attribute Summary collapse

Class Method Summary collapse

Methods inherited from Resource

#initialize, #method_missing, #refresh, #respond_to_missing?, #to_h, #to_s

Methods included from ResponseHelper

#parse

Constructor Details

This class inherits a constructor from Asana::Resources::Resource

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Asana::Resources::Resource

Instance Attribute Details

#typeObject (readonly)


31
32
33
# File 'lib/asana/resource_includes/event.rb', line 31

def type
  @type
end

Class Method Details

.for(client, id, wait: 1) ⇒ Object

Returns an infinite collection of events on a particular resource.

Parameters:

  • client (Asana::Client)

    the client to perform the requests.

  • id (String)

    the id of the resource to get events from.

  • wait (Integer) (defaults to: 1)

    the number of seconds to wait between each poll.


45
46
47
# File 'lib/asana/resource_includes/event.rb', line 45

def for(client, id, wait: 1)
  Events.new(resource: id, client: client, wait: wait)
end

.plural_nameObject

Returns the plural name of the resource.


35
36
37
# File 'lib/asana/resource_includes/event.rb', line 35

def plural_name
  'events'
end