Class: Runcible::Resources::Content
- Defined in:
- lib/runcible/resources/content.rb
Overview
Class Method Summary collapse
-
.path(upload_id = nil) ⇒ String
Generates the API path for Contents.
Instance Method Summary collapse
-
#create_upload_request ⇒ RestClient::Response
Creates an Upload Request.
-
#delete_upload_request(upload_id) ⇒ RestClient::Response
Delete an upload request.
-
#import_into_repo(repo_id, unit_type_id, upload_id, unit_key, optional = {}) ⇒ RestClient::Response
Import into a repository.
-
#list_all_requests ⇒ RestClient::Response
List all upload requests.
-
#upload_bits(upload_id, offset, content) ⇒ RestClient::Response
Upload bits.
Methods inherited from Base
#add_http_auth_header, #add_oauth_header, #call, #combine_get_params, #config, #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(upload_id = nil) ⇒ String
Generates the API path for Contents
34 35 36 |
# File 'lib/runcible/resources/content.rb', line 34 def self.path(upload_id=nil) (upload_id == nil) ? "content/uploads/" : "content/uploads/#{upload_id}/" end |
Instance Method Details
#create_upload_request ⇒ RestClient::Response
Creates an Upload Request
Request Body Contents: None
42 43 44 |
# File 'lib/runcible/resources/content.rb', line 42 def create_upload_request call(:post, path) end |
#delete_upload_request(upload_id) ⇒ RestClient::Response
Delete an upload request
Query Parameters: None
75 76 77 |
# File 'lib/runcible/resources/content.rb', line 75 def delete_upload_request(upload_id) call(:delete, path("#{upload_id}/")) end |
#import_into_repo(repo_id, unit_type_id, upload_id, unit_key, optional = {}) ⇒ RestClient::Response
Import into a repository
65 66 67 68 |
# File 'lib/runcible/resources/content.rb', line 65 def import_into_repo(repo_id, unit_type_id, upload_id, unit_key, optional={}) required = required_params(binding.send(:local_variables), binding) call(:post, Repository.path("#{repo_id}/actions/import_upload/"), :payload => { :required =>required, :optional => optional }) end |
#list_all_requests ⇒ RestClient::Response
List all upload requests
Query Parameters: None
83 84 85 |
# File 'lib/runcible/resources/content.rb', line 83 def list_all_requests call(:get, path) end |
#upload_bits(upload_id, offset, content) ⇒ RestClient::Response
Upload bits
52 53 54 55 |
# File 'lib/runcible/resources/content.rb', line 52 def upload_bits(upload_id, offset, content) required = required_params(binding.send(:local_variables), binding) call(:put, path("#{upload_id}/#{offset}/"), :payload => { :required => required }) end |