Class: Runcible::Resources::Content
- Defined in:
- lib/runcible/resources/content.rb
Overview
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.
-
#list_orphans(type_id = nil) ⇒ Object
List all orphaned content optionally by type.
-
#orphan_path(type_id = nil) ⇒ String
Generates an api path for orphaned content.
-
#remove_orphans(type_id = nil) ⇒ Object
Delete all orphaned content optionally by type.
-
#upload_bits(upload_id, offset, content) ⇒ RestClient::Response
Upload bits.
-
#upload_path(upload_id = nil) ⇒ String
Generates the API path for Contents.
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
Instance Method Details
#create_upload_request ⇒ RestClient::Response
Creates an Upload Request
Request Body Contents: None
43 44 45 |
# File 'lib/runcible/resources/content.rb', line 43 def create_upload_request call(:post, upload_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, upload_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, upload_path) end |
#list_orphans(type_id = nil) ⇒ Object
List all orphaned content optionally by type
101 102 103 |
# File 'lib/runcible/resources/content.rb', line 101 def list_orphans(type_id = nil) call(:get, orphan_path(type_id)) end |
#orphan_path(type_id = nil) ⇒ String
Generates an api path for orphaned content
91 92 93 94 95 |
# File 'lib/runcible/resources/content.rb', line 91 def orphan_path(type_id = nil) path = "content/orphans/" path << "#{type_id}/" if type_id path end |
#remove_orphans(type_id = nil) ⇒ Object
Delete all orphaned content optionally by type
109 110 111 |
# File 'lib/runcible/resources/content.rb', line 109 def remove_orphans(type_id = nil) call(:delete, orphan_path(type_id)) end |
#upload_bits(upload_id, offset, content) ⇒ RestClient::Response
Upload bits
53 54 55 |
# File 'lib/runcible/resources/content.rb', line 53 def upload_bits(upload_id, offset, content) call(:put, upload_path("#{upload_id}/#{offset}/"), :payload => content) end |
#upload_path(upload_id = nil) ⇒ String
Generates the API path for Contents
35 36 37 |
# File 'lib/runcible/resources/content.rb', line 35 def upload_path(upload_id=nil) (upload_id == nil) ? "content/uploads/" : "content/uploads/#{upload_id}/" end |