Module: LinkedIn::Api::ShareAndSocialStream

Included in:
Client
Defined in:
lib/linked_in/api/share_and_social_stream.rb

Overview

Share and Social Stream APIs

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

  • GET Network Statistics
  • POST Post Network Update

(contribute here)

See Also:

Instance Method Summary collapse

Instance Method Details

#add_share(share) ⇒ void

This method returns an undefined value.

Create a share for the authenticated user

Permissions: rw_nus

See Also:



91
92
93
94
95
# 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) ⇒ void

This method returns an undefined value.

(Update) like an update as the authenticated user

Parameters:

  • update_key (String)

    a update/update-key representing a particular network update

See Also:



118
119
120
121
# 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 = {}) ⇒ LinkedIn::Mash

Retrieve the authenticated users network updates

Permissions: rw_nus

Parameters:

  • options (Hash) (defaults to: {})

    identifies the user profile you want

Options Hash (options):

  • :id (String)

    a member token

  • :url (String)

    a Public Profile URL

  • :email (String)
  • :scope (String)
  • :type (String)
  • :count (String)
  • :start (String)
  • :after (String)
  • :before (String)
  • :show-hidden-members (String)

Returns:

See Also:



33
34
35
36
# 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 = {}) ⇒ Object



44
45
46
47
# 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 = {}) ⇒ LinkedIn::Mash

Note:

The first 5 comments are included in the response to #network_updates

Retrieve all comments for a particular network update

Permissions: rw_nus

Parameters:

  • update_key (String)

    a update/update-key representing a particular network update

  • options (Hash) (defaults to: {})

    identifies the user profile you want

Options Hash (options):

  • :id (String)

    a member token

  • :url (String)

    a Public Profile URL

  • :email (String)

Returns:

See Also:



61
62
63
64
# 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 = {}) ⇒ LinkedIn::Mash

Note:

Some likes are included in the response to #network_updates

Retrieve all likes for a particular network update

Permissions: rw_nus

Parameters:

  • update_key (String)

    a update/update-key representing a particular network update

  • options (Hash) (defaults to: {})

    identifies the user profile you want

Options Hash (options):

  • :id (String)

    a member token

  • :url (String)

    a Public Profile URL

  • :email (String)

Returns:

See Also:



78
79
80
81
# 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 = {}) ⇒ Object

TODO refactor to use #network_updates



39
40
41
42
# 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) ⇒ void

This method returns an undefined value.

(Destroy) unlike an update the authenticated user previously liked

Parameters:

  • update_key (String)

    a update/update-key representing a particular network update

See Also:



131
132
133
134
# 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) ⇒ void

This method returns an undefined value.

Create a comment on an update from the authenticated user

Parameters:

  • update_key (String)

    a update/update-key representing a particular network update

  • comment (String)

    The text of the comment

See Also:



105
106
107
108
109
# 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