Class: LinkedIn::Media

Inherits:
APIResource show all
Defined in:
lib/linked_in/media.rb

Overview

Rich Media APIs

[(contribute here)](github.com/mdesjardins/linkedin-v2)

Instance Method Summary collapse

Methods inherited from APIResource

#id_to_urn, #initialize, #urn_to_id

Constructor Details

This class inherits a constructor from LinkedIn::APIResource

Instance Method Details

#summary(options = {}) ⇒ Object


12
13
14
15
# File 'lib/linked_in/media.rb', line 12

def summary(options = {})
  path = "/richMediaSummariesV2/#{options.delete(:id)}"
  get(path, options)
end

#upload(options = {}) ⇒ LinkedIn::Mash

Uploads rich media content to LinkedIn from a supplied URL.


26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/linked_in/media.rb', line 26

def upload(options = {})
  source_url = options.delete(:source_url)
  timeout = options.delete(:timeout) || DEFAULT_TIMEOUT_SECONDS
  media_upload_endpoint = LinkedIn.config.api + '/media/upload'
  response =
    @connection.post(media_upload_endpoint, file: file(source_url, options)) do |req|
      req.headers['Accept'] = 'application/json'
      req.options.timeout = timeout
      req.options.open_timeout = timeout
    end
  Mash.from_json(response.body)
end