Class: Runcible::Resources::Content
- Defined in:
- lib/runcible/resources/content.rb
Overview
Instance Attribute Summary
Attributes inherited from Base
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, #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
Instance Method Details
#create_upload_request ⇒ RestClient::Response
Creates an Upload Request
Request Body Contents: None
19 20 21 |
# File 'lib/runcible/resources/content.rb', line 19 def create_upload_request call(:post, upload_path) end |
#delete_upload_request(upload_id) ⇒ RestClient::Response
Delete an upload request
Query Parameters: None
53 54 55 |
# File 'lib/runcible/resources/content.rb', line 53 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
42 43 44 45 46 |
# File 'lib/runcible/resources/content.rb', line 42 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
62 63 64 |
# File 'lib/runcible/resources/content.rb', line 62 def list_all_requests call(:get, upload_path) end |
#list_orphans(type_id = nil) ⇒ Object
List all orphaned content optionally by type
80 81 82 |
# File 'lib/runcible/resources/content.rb', line 80 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
70 71 72 73 74 |
# File 'lib/runcible/resources/content.rb', line 70 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
88 89 90 |
# File 'lib/runcible/resources/content.rb', line 88 def remove_orphans(type_id = nil) call(:delete, orphan_path(type_id)) end |
#upload_bits(upload_id, offset, content) ⇒ RestClient::Response
Upload bits
29 30 31 |
# File 'lib/runcible/resources/content.rb', line 29 def upload_bits(upload_id, offset, content) call(:put, upload_path("#{upload_id}/#{offset}/"), :payload => content, :no_log_payload => true) end |
#upload_path(upload_id = nil) ⇒ String
Generates the API path for Contents
11 12 13 |
# File 'lib/runcible/resources/content.rb', line 11 def upload_path(upload_id = nil) upload_id.nil? ? 'content/uploads/' : "content/uploads/#{upload_id}/" end |