module LinkedIn::Api::ShareAndSocialStream

Share and Social Stream APIs

@see developer.linkedin.com/docs/share-on-linkedin Share API

The following API actions do not have corresponding methods in this module

* GET Network Statistics
* POST Post Network Update

[(contribute here)](github.com/hexgnu/linkedin)

Public Instance Methods

add_share(share) click to toggle source

Create a share for the authenticated user

Permissions: rw_nus

@see developer.linkedin.com/docs/share-on-linkedin Share API

@macro share_input_fields @return [void]

# File lib/linked_in/api/share_and_social_stream.rb, line 91
def add_share(share)
  path = "/people/~/shares"
  defaults = {:visibility => {:code => "anyone"}}
  post(path, MultiJson.dump(defaults.merge(share)), "Content-Type" => "application/json")
end
like_share(update_key) click to toggle source

(Update) like an update as the authenticated user

@see developer.linkedin.com/documents/commenting-reading-comments-and-likes-network-updates

@param [String] update_key a update/update-key representing a

particular network update

@return [void]

# File lib/linked_in/api/share_and_social_stream.rb, line 118
def like_share(update_key)
  path = "/people/~/network/updates/key=#{update_key}/is-liked"
  put(path, 'true', "Content-Type" => "application/json")
end
network_updates(options={}) click to toggle source

Retrieve the authenticated users network updates

Permissions: rw_nus

@see developer.linkedin.com/documents/get-network-updates-and-statistics-api @see developer.linkedin.com/documents/network-update-types Network Update Types

@macro person_path_options @option options [String] :scope @option options [String] :type @option options [String] :count @option options [String] :start @option options [String] :after @option options [String] :before @option options [String] :show-hidden-members @return [LinkedIn::Mash]

# File lib/linked_in/api/share_and_social_stream.rb, line 33
def network_updates(options={})
  path = "#{person_path(options)}/network/updates"
  simple_query(path, options)
end
share(update_key, options={}) click to toggle source
# File lib/linked_in/api/share_and_social_stream.rb, line 44
def share(update_key, options={})
  path = "#{person_path(options)}/network/updates/key=#{update_key}"
  simple_query(path, options)
end
share_comments(update_key, options={}) click to toggle source

Retrieve all comments for a particular network update

@note The first 5 comments are included in the response to network_updates

Permissions: rw_nus

@see developer.linkedin.com/documents/commenting-reading-comments-and-likes-network-updates

@param [String] update_key a update/update-key representing a

particular network update

@macro person_path_options @return [LinkedIn::Mash]

# File lib/linked_in/api/share_and_social_stream.rb, line 61
def share_comments(update_key, options={})
  path = "#{person_path(options)}/network/updates/key=#{update_key}/update-comments"
  simple_query(path, options)
end
share_likes(update_key, options={}) click to toggle source

Retrieve all likes for a particular network update

@note Some likes are included in the response to network_updates

Permissions: rw_nus

@see developer.linkedin.com/documents/commenting-reading-comments-and-likes-network-updates

@param [String] update_key a update/update-key representing a

particular network update

@macro person_path_options @return [LinkedIn::Mash]

# File lib/linked_in/api/share_and_social_stream.rb, line 78
def share_likes(update_key, options={})
  path = "#{person_path(options)}/network/updates/key=#{update_key}/likes"
  simple_query(path, options)
end
shares(options={}) click to toggle source

TODO refactor to use network_updates

# File lib/linked_in/api/share_and_social_stream.rb, line 39
def shares(options={})
  path = "#{person_path(options)}/network/updates"
  simple_query(path, {:type => "SHAR", :scope => "self"}.merge(options))
end
unlike_share(update_key) click to toggle source

(Destroy) unlike an update the authenticated user previously liked

@see developer.linkedin.com/documents/commenting-reading-comments-and-likes-network-updates

@param [String] update_key a update/update-key representing a

particular network update

@return [void]

# File lib/linked_in/api/share_and_social_stream.rb, line 131
def unlike_share(update_key)
  path = "/people/~/network/updates/key=#{update_key}/is-liked"
  put(path, 'false', "Content-Type" => "application/json")
end
update_comment(update_key, comment) click to toggle source

Create a comment on an update from the authenticated user

@see developer.linkedin.com/documents/commenting-reading-comments-and-likes-network-updates

@param [String] update_key a update/update-key representing a

particular network update

@param [String] comment The text of the comment @return [void]

# File lib/linked_in/api/share_and_social_stream.rb, line 105
def update_comment(update_key, comment)
  path = "/people/~/network/updates/key=#{update_key}/update-comments"
  body = {'comment' => comment}
  post(path, MultiJson.dump(body), "Content-Type" => "application/json")
end