Module: Robodash
- Defined in:
- lib/robodash.rb,
lib/robodash/version.rb
Constant Summary collapse
- DEFAULT_HOST =
Defaults
"https://robodash.app"- OPEN_TIMEOUT =
2- READ_TIMEOUT =
5- SCHEDULE_REGEX =
Parse flexible format like “every 30 minutes”, “3 days”, “2 hours”
/^(?:every\s+)?(\d+)\s*(minute|hour|day|week|month|year)s?$/- VERSION =
"0.3.0"
Class Attribute Summary collapse
-
.api_token ⇒ Object
Returns the value of attribute api_token.
-
.enabled ⇒ Object
Returns the value of attribute enabled.
-
.host ⇒ Object
writeonly
Sets the attribute host.
Class Method Summary collapse
-
.count(name, count, range = nil) ⇒ Object
Count should always be an integer.
- .enabled? ⇒ Boolean
-
.ping(name, schedule = nil, grace_period: nil) ⇒ Object
Possible schedules: - minutely - hourly - daily - weekly - monthly - yearly.
Class Attribute Details
.api_token ⇒ Object
Returns the value of attribute api_token.
18 19 20 |
# File 'lib/robodash.rb', line 18 def api_token @api_token end |
.enabled ⇒ Object
Returns the value of attribute enabled.
18 19 20 |
# File 'lib/robodash.rb', line 18 def enabled @enabled end |
.host=(value) ⇒ Object
Sets the attribute host
18 19 20 |
# File 'lib/robodash.rb', line 18 def host=(value) @host = value end |
Class Method Details
.count(name, count, range = nil) ⇒ Object
Count should always be an integer
45 46 47 |
# File 'lib/robodash.rb', line 45 def count(name, count, range = nil) fire_and_forget("count", {name: name, count: count.to_i}) end |
.enabled? ⇒ Boolean
20 21 22 23 |
# File 'lib/robodash.rb', line 20 def enabled? return true if @enabled.nil? @enabled end |
.ping(name, schedule = nil, grace_period: nil) ⇒ Object
Possible schedules:
-
minutely
-
hourly
-
daily
-
weekly
-
monthly
-
yearly
Examples: Robodash.ping(“Some task”, :daily, grace_period: 10.minutes) Robodash.ping(“Some task”, “every 10 minutes”, grace_period: 10.minutes)
36 37 38 39 40 41 42 |
# File 'lib/robodash.rb', line 36 def ping(name, schedule = nil, grace_period: nil) params = {name: name} params.merge!({grace_period: grace_period.to_i}) if grace_period.present? params.merge!(parse_schedule(schedule)) if schedule.present? fire_and_forget("ping", params) end |