Sha256: 1c4eb6d5a9f560829702aaaed06a4f2ef95d235a9c363228d97491a1248f9322

Contents?: true

Size: 1.96 KB

Versions: 24

Compression:

Stored size: 1.96 KB

Contents

require_relative 'events'

module Asana
  module Resources
    # 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.
    class Event < Resource
      attr_reader :type

      class << self
        # Returns the plural name of the resource.
        def plural_name
          'events'
        end

        # Public: Returns an infinite collection of events on a particular
        # resource.
        #
        # client - [Asana::Client] the client to perform the requests.
        # id     - [String] the id of the resource to get events from.
        # wait   - [Integer] the number of seconds to wait between each poll.
        def for(client, id, wait: 1)
          Events.new(resource: id, client: client, wait: wait)
        end
      end
    end
  end
end

Version data entries

24 entries across 24 versions & 2 rubygems

Version Path
asana-2.0.1 lib/asana/resource_includes/event.rb
asana-2.0.0 lib/asana/resource_includes/event.rb
asana-1.0.0 lib/asana/resource_includes/event.rb
asana-0.10.13 lib/asana/resource_includes/event.rb
asana-0.10.12 lib/asana/resource_includes/event.rb
asana-0.10.3 lib/asana/resource_includes/event.rb
asana-0.10.2 lib/asana/resource_includes/event.rb
asana-0.10.1 lib/asana/resource_includes/event.rb
asana-0.10.0 lib/asana/resource_includes/event.rb
asana-0.9.3 lib/asana/resource_includes/event.rb
asana-0.9.2 lib/asana/resource_includes/event.rb
asana-0.9.1 lib/asana/resource_includes/event.rb
asana-0.9.0 lib/asana/resource_includes/event.rb
asana-0.8.1 lib/asana/resource_includes/event.rb
asana-0.8.0 lib/asana/resource_includes/event.rb
asana-0.6.3 lib/asana/resource_includes/event.rb
asana-0.6.2 lib/asana/resource_includes/event.rb
asana-0.6.0 lib/asana/resource_includes/event.rb
asana-0.5.0 lib/asana/resource_includes/event.rb
asana-0.4.0 lib/asana/resource_includes/event.rb