Class: RMC::Scheduler
- Inherits:
-
Object
- Object
- RMC::Scheduler
- Defined in:
- lib/rmc/scheduler.rb
Constant Summary collapse
- FREQUENCY_ONETIME =
'onetimeonly'
- FREQUENCY_BY_MINUTES =
'by minutes'
- FREQUENCY_HOURLY =
'hourly'
- FREQUENCY_DAILY =
'daily'
- FREQUENCY_WEEKLY =
'weekly'
- FREQUENCY_MONTHLY =
'monthly'
- FREQUENCY_YEARLY =
'yearly'
- RESOURCE_CATEGORY_SCRIPT =
'script'
- RESOURCE_CATEGORY_SNAPSHOTS =
'script'
- RESOURCE_CATEGORY_BACKUPS =
'backup-sets'
Instance Attribute Summary collapse
-
#connection ⇒ Object
readonly
Returns the value of attribute connection.
Instance Method Summary collapse
- #create_schedule(data) ⇒ Object
- #get_schedule(id) ⇒ Object
-
#initialize(connection) ⇒ Scheduler
constructor
A new instance of Scheduler.
- #list_schedules(query = nil) ⇒ Object
Constructor Details
#initialize(connection) ⇒ Scheduler
Returns a new instance of Scheduler.
19 20 21 |
# File 'lib/rmc/scheduler.rb', line 19 def initialize(connection) @connection = connection end |
Instance Attribute Details
#connection ⇒ Object (readonly)
Returns the value of attribute connection.
17 18 19 |
# File 'lib/rmc/scheduler.rb', line 17 def connection @connection end |
Instance Method Details
#create_schedule(data) ⇒ Object
44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/rmc/scheduler.rb', line 44 def create_schedule(data) response = @connection.request( url: "/schedule-jobs", payload: { schedule: data }, method: :post ) get_schedule(response['schedule']['id']) end |
#get_schedule(id) ⇒ Object
36 37 38 39 40 41 42 |
# File 'lib/rmc/scheduler.rb', line 36 def get_schedule(id) response = @connection.request( url: "/schedule-jobs/#{id}" ) RMC::Item::Schedule.new(@connection, response['schedule']) end |
#list_schedules(query = nil) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/rmc/scheduler.rb', line 23 def list_schedules(query=nil) response = @connection.request( url: "/schedule-jobs#{query ? "?query=\"#{query}\"" : ''}" ) schedules = [] response['schedules'].each do |_data| schedules << RMC::Item::Schedule.new(@connection, _data) end schedules end |