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)

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



87
88
89
90
91
# File 'lib/linked_in/api/share_and_social_stream.rb', line 87

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:



114
115
116
117
# File 'lib/linked_in/api/share_and_social_stream.rb', line 114

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:



34
35
36
37
# File 'lib/linked_in/api/share_and_social_stream.rb', line 34

def network_updates(options={})
  path = "#{person_path(options)}/network/updates"
  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:



57
58
59
60
# File 'lib/linked_in/api/share_and_social_stream.rb', line 57

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:



74
75
76
77
# File 'lib/linked_in/api/share_and_social_stream.rb', line 74

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



40
41
42
43
# File 'lib/linked_in/api/share_and_social_stream.rb', line 40

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:



127
128
129
130
# File 'lib/linked_in/api/share_and_social_stream.rb', line 127

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:



101
102
103
104
105
# File 'lib/linked_in/api/share_and_social_stream.rb', line 101

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