class Contentful::Management::Upload
Resource
class for Upload
. @see _ www.contentful.com/developers/docs/references/content-management-api/#/reference/uploads
Public Class Methods
create(client, space_id, attributes = {})
click to toggle source
Creates an upload.
@param [Contentful::Management::Client] client @param [String] space_id @param [Hash] attributes @see _ README for full attribute list for each resource.
@return [Contentful::Management::Upload]
Calls superclass method
# File lib/contentful/management/upload.rb, line 25 def self.create(client, space_id, attributes = {}) super(client, space_id, nil, attributes) end
create_attributes(_client, path_or_file)
click to toggle source
@private
# File lib/contentful/management/upload.rb, line 41 def self.create_attributes(_client, path_or_file) case path_or_file when ::String ::File.binread(path_or_file) when ::IO path_or_file.read end end
create_headers(_client, _attributes)
click to toggle source
@private
# File lib/contentful/management/upload.rb, line 13 def self.create_headers(_client, _attributes) { 'Content-Type' => 'application/octet-stream' } end
find(client, space_id, upload_id)
click to toggle source
Finds an upload by ID.
@param [Contentful::Management::Client] client @param [String] space_id @param [String] upload_id
@return [Contentful::Management::Upload]
Calls superclass method
# File lib/contentful/management/upload.rb, line 36 def self.find(client, space_id, upload_id) super(client, space_id, nil, upload_id) end
Public Instance Methods
to_link_json()
click to toggle source
Gets [Contentful::Management::Link]-like representation of the upload This is used in particular for associating the upload with an asset
@return [Hash] link-like representation of the upload
# File lib/contentful/management/upload.rb, line 54 def to_link_json { sys: { type: 'Link', linkType: 'Upload', id: id } } end