Class: Runcible::Resources::RepositorySchedule

Inherits:
Base
  • Object
show all
Defined in:
lib/runcible/resources/repository_schedule.rb

Overview

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#add_http_auth_header, #add_oauth_header, #call, #combine_get_params, #config, #format_payload_json, #generate_log_message, #generate_payload, #get_response, #initialize, #lazy_config=, #log_debug, #log_exception, #logger, #path, #process_response, #required_params

Constructor Details

This class inherits a constructor from Runcible::Base

Class Method Details

.path(repo_id, importer_id, schedule_id = nil) ⇒ String

Generates the API path for Repository Schedules



37
38
39
40
41
# File 'lib/runcible/resources/repository_schedule.rb', line 37

def self.path(repo_id, importer_id, schedule_id=nil)
  repo_path = Runcible::Resources::Repository.path(repo_id)
  path = "#{repo_path}importers/#{importer_id}/schedules/sync/"
  (schedule_id == nil) ? path : "#{path}#{schedule_id}/"
end

Instance Method Details

#create(repo_id, importer_type, schedule, optional = {}) ⇒ RestClient::Response

Create a schedule for a repository for a given importer type



59
60
61
62
# File 'lib/runcible/resources/repository_schedule.rb', line 59

def create(repo_id, importer_type, schedule, optional={})
  call(:post, path(repo_id, importer_type),
       :payload => { :required => {:schedule=>schedule}, :optional => optional })
end

#delete(repo_id, importer_type, schedule_id) ⇒ RestClient::Response

Delete a schedule for a repository for a given importer type



82
83
84
# File 'lib/runcible/resources/repository_schedule.rb', line 82

def delete(repo_id, importer_type, schedule_id)
  call(:delete, path(repo_id, importer_type, schedule_id))
end

#list(repo_id, importer_type) ⇒ RestClient::Response

List the schedules for a repository for a given importer type



48
49
50
# File 'lib/runcible/resources/repository_schedule.rb', line 48

def list(repo_id, importer_type)
  call(:get, path(repo_id, importer_type))
end

#update(repo_id, importer_type, schedule_id, optional = {}) ⇒ RestClient::Response

Update a schedule for a repository for a given importer type



71
72
73
74
# File 'lib/runcible/resources/repository_schedule.rb', line 71

def update(repo_id, importer_type, schedule_id, optional={})
  call(:put, path(repo_id, importer_type, schedule_id),
       :payload => {:optional => optional })
end