Class: Runcible::Resources::RepositorySchedule

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

Overview

Instance Attribute Summary

Attributes inherited from Base

#logs

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#add_http_auth_header, #add_oauth_header, #call, #combine_get_params, #config, #exception_to_log, #format_payload_json, #generate_payload, #get_response, #initialize, #lazy_config=, #log_debug, #log_exception, #log_info, #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

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



13
14
15
16
17
# File 'lib/runcible/resources/repository_schedule.rb', line 13

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

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)


35
36
37
38
# File 'lib/runcible/resources/repository_schedule.rb', line 35

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

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)


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

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

Parameters:

  • repo_id (String)

    the ID of the repository

  • importer_type (String)

    the importer type

Returns:

  • (RestClient::Response)


24
25
26
# File 'lib/runcible/resources/repository_schedule.rb', line 24

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

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)


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

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