Class: Checkoff::Events
- Inherits:
-
Object
- Object
- Checkoff::Events
- Extended by:
- CacheMethod::ClassMethods
- Includes:
- Logging
- Defined in:
- lib/checkoff/events.rb,
sig/checkoff.rbs
Overview
Methods related to the Asana events / webhooks APIs
Constant Summary collapse
- MINUTE =
60- HOUR =
MINUTE * 60
- DAY =
24 * HOUR
- REALLY_LONG_CACHE_TIME =
HOUR * 1
- LONG_CACHE_TIME =
MINUTE * 15
- SHORT_CACHE_TIME =
MINUTE
Instance Attribute Summary collapse
- #asana_event_enrichment ⇒ Checkoff::Internal::AsanaEventEnrichment readonly
-
#client ⇒ Asana::Client
readonly
sord warn - Asana::Client wasn't able to be resolved to a constant in this project.
- #projects ⇒ Checkoff::Projects readonly
- #sections ⇒ Checkoff::Sections readonly
- #tasks ⇒ Checkoff::Tasks readonly
- #workspaces ⇒ Checkoff::Workspaces readonly
Class Method Summary collapse
Instance Method Summary collapse
-
#debug ⇒ void
@param
message. -
#enrich_event(asana_event) ⇒ ::Hash[untyped, untyped]
Add useful info (like resource task names) into an event for human consumption.
-
#enrich_filter(filter) ⇒ ::Hash[String, (String | ::Array[String])]
@param
filter. -
#enrich_webhook_subscription!(webhook_subscription) ⇒ void
@param
webhook_subscription— Hash of the request made to webhook POST endpoint - https://app.asana.com/api/1.0/webhooks https://developers.asana.com/reference/createwebhook. -
#error ⇒ void
@param
message. -
#filter_asana_events(filters, asana_events) ⇒ ::Array[::Hash[untyped, untyped]]
@param
filters— The filters to match against. -
#finer ⇒ void
@param
message. -
#info ⇒ void
@param
message. -
#initialize(config: Checkoff::Internal::ConfigLoader.load(:asana), workspaces: Checkoff::Workspaces.new(config:), tasks: Checkoff::Tasks.new(config:), sections: Checkoff::Sections.new(config:), projects: Checkoff::Projects.new(config:), clients: Checkoff::Clients.new(config:), client: clients.client, asana_event_filter_class: Checkoff::Internal::AsanaEventFilter, asana_event_enrichment: Checkoff::Internal::AsanaEventEnrichment.new) ⇒ Object
constructor
sord warn - Asana::Client wasn't able to be resolved to a constant in this project @param
config. -
#log_level ⇒ Symbol
@sg-ignore.
- #logger ⇒ ::Logger
-
#warn ⇒ void
@param
message.
Constructor Details
#initialize(config: Checkoff::Internal::ConfigLoader.load(:asana), workspaces: Checkoff::Workspaces.new(config:), tasks: Checkoff::Tasks.new(config:), sections: Checkoff::Sections.new(config:), projects: Checkoff::Projects.new(config:), clients: Checkoff::Clients.new(config:), client: clients.client, asana_event_filter_class: Checkoff::Internal::AsanaEventFilter, asana_event_enrichment: Checkoff::Internal::AsanaEventEnrichment.new) ⇒ Object
sord warn - Asana::Client wasn't able to be resolved to a constant in this project
@param config
@param workspaces
@param tasks
@param sections
@param projects
@param clients
@param client
@param asana_event_filter_class
@param asana_event_enrichment
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/checkoff/events.rb', line 45 def initialize(config: Checkoff::Internal::ConfigLoader.load(:asana), workspaces: Checkoff::Workspaces.new(config:), tasks: Checkoff::Tasks.new(config:), sections: Checkoff::Sections.new(config:), projects: Checkoff::Projects.new(config:), clients: Checkoff::Clients.new(config:), client: clients.client, asana_event_filter_class: Checkoff::Internal::AsanaEventFilter, asana_event_enrichment: Checkoff::Internal::AsanaEventEnrichment.new) @workspaces = workspaces @tasks = tasks @sections = sections @projects = projects @client = client @asana_event_filter_class = asana_event_filter_class @asana_event_enrichment = asana_event_enrichment end |
Instance Attribute Details
#asana_event_enrichment ⇒ Checkoff::Internal::AsanaEventEnrichment (readonly)
118 119 120 |
# File 'lib/checkoff/events.rb', line 118 def asana_event_enrichment @asana_event_enrichment end |
#client ⇒ Asana::Client (readonly)
sord warn - Asana::Client wasn't able to be resolved to a constant in this project
115 116 117 |
# File 'lib/checkoff/events.rb', line 115 def client @client end |
#projects ⇒ Checkoff::Projects (readonly)
103 104 105 |
# File 'lib/checkoff/events.rb', line 103 def projects @projects end |
#sections ⇒ Checkoff::Sections (readonly)
106 107 108 |
# File 'lib/checkoff/events.rb', line 106 def sections @sections end |
#tasks ⇒ Checkoff::Tasks (readonly)
109 110 111 |
# File 'lib/checkoff/events.rb', line 109 def tasks @tasks end |
#workspaces ⇒ Checkoff::Workspaces (readonly)
112 113 114 |
# File 'lib/checkoff/events.rb', line 112 def workspaces @workspaces end |
Class Method Details
.run ⇒ void
This method returns an undefined value.
124 125 126 127 128 129 130 131 132 |
# File 'lib/checkoff/events.rb', line 124 def run # @type [String] # workspace_name = ARGV[0] || raise('Please pass workspace name as first argument') # @type [String] # event_name = ARGV[1] || raise('Please pass event name as second argument') # events = Checkoff::Events.new # event = events.event_or_raise(workspace_name, event_name) # puts "Results: #{event}" end |
Instance Method Details
#debug ⇒ void
This method returns an undefined value.
@param message
652 |
# File 'sig/checkoff.rbs', line 652
def debug: (?Object? message) -> void
|
#enrich_event(asana_event) ⇒ ::Hash[untyped, untyped]
Add useful info (like resource task names) into an event for human consumption
@param asana_event
78 79 80 |
# File 'lib/checkoff/events.rb', line 78 def enrich_event(asana_event) asana_event_enrichment.enrich_event(asana_event) end |
#enrich_filter(filter) ⇒ ::Hash[String, (String | ::Array[String])]
@param filter
85 86 87 |
# File 'lib/checkoff/events.rb', line 85 def enrich_filter(filter) asana_event_enrichment.enrich_filter(filter) end |
#enrich_webhook_subscription!(webhook_subscription) ⇒ void
This method returns an undefined value.
@param webhook_subscription — Hash of the request made to webhook POST endpoint - https://app.asana.com/api/1.0/webhooks https://developers.asana.com/reference/createwebhook
94 95 96 |
# File 'lib/checkoff/events.rb', line 94 def enrich_webhook_subscription!(webhook_subscription) asana_event_enrichment.enrich_webhook_subscription!(webhook_subscription) end |
#error ⇒ void
This method returns an undefined value.
@param message
643 |
# File 'sig/checkoff.rbs', line 643
def error: (?Object? message) -> void
|
#filter_asana_events(filters, asana_events) ⇒ ::Array[::Hash[untyped, untyped]]
@param filters — The filters to match against
@param asana_events — The events that Asana sent
@return — The events that should be acted on
67 68 69 70 |
# File 'lib/checkoff/events.rb', line 67 def filter_asana_events(filters, asana_events) asana_event_filter = @asana_event_filter_class.new(filters:) asana_events.select { |event| asana_event_filter.matches?(event) } end |
#finer ⇒ void
This method returns an undefined value.
@param message
655 |
# File 'sig/checkoff.rbs', line 655
def finer: (?Object? message) -> void
|
#info ⇒ void
This method returns an undefined value.
@param message
649 |
# File 'sig/checkoff.rbs', line 649
def info: (?Object? message) -> void
|
#log_level ⇒ Symbol
@sg-ignore
658 |
# File 'sig/checkoff.rbs', line 658
def log_level: () -> Symbol
|
#logger ⇒ ::Logger
640 |
# File 'sig/checkoff.rbs', line 640
def logger: () -> ::Logger
|
#warn ⇒ void
This method returns an undefined value.
@param message
646 |
# File 'sig/checkoff.rbs', line 646
def warn: (?Object? message) -> void
|