Class: Runcible::Resources::RepositorySchedule

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

Overview

Class Method Summary collapse

Methods inherited from Base

add_http_auth_header, add_oauth_header, call, combine_get_params, config, config=, generate_log_message, generate_payload, get_response, log_debug, log_exception, process_response, required_params

Class Method Details

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

Create a schedule for a repository for a given importer type

Parameters:

  • repo_id (String)

    the ID of the repository

  • importer_type (String)

    the importer type

  • schedule (Hash)

    a hash representing a schedule

  • optional (Hash) (defaults to: {})

    container for all optional parameters

Returns:

  • (RestClient::Response)


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

def self.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

Parameters:

  • repo_id (String)

    the ID of the repository

  • importer_type (String)

    the importer type

  • schedule_id (String)

    the ID of the schedule

Returns:

  • (RestClient::Response)


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

def self.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

Parameters:

  • repo_id (String)

    the ID of the repository

  • importer_type (String)

    the importer type

Returns:

  • (RestClient::Response)


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

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

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

Generates the API path for Repository Schedules

Parameters:

  • repo_id (String)

    the ID of the repository

  • importer_id (String)

    the ID of the importer

  • schedule_id (String) (defaults to: nil)

    the ID of the schedule

Returns:

  • (String)

    the repository schedule path, may contain the ID of the schedule if passed



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

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

Update a schedule for a repository for a given importer type

Parameters:

  • repo_id (String)

    the ID of the repository

  • importer_type (String)

    the importer type

  • schedule_id (String)

    the ID of the schedule

  • optional (Hash) (defaults to: {})

    container for all optional parameters

Returns:

  • (RestClient::Response)


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

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