Class: LinkedIn::ShareAndSocialStream

Inherits:
APIResource show all
Defined in:
lib/linked_in/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

Methods inherited from APIResource

#initialize

Constructor Details

This class inherits a constructor from LinkedIn::APIResource

Instance Method Details

#add_share(share) ⇒ void

This method returns an undefined value.

Create a share for the authenticated user

Permissions: rw_nus

Parameters:

  • share (Hash)

    content of the share

Options Hash (share):

  • :comment (String)
  • :content (String)
  • :title (String)
  • :submitted-url (String)
  • :submitted-image-url (String)
  • :description (String)
  • :visibility (String)
  • :code (String)

See Also:



84
85
86
87
88
# File 'lib/linked_in/share_and_social_stream.rb', line 84

def add_share(share)
  path = "/people/~/shares"
  defaults = {visibility: {code: "anyone"}}
  post(path, defaults.merge(share))
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:



110
111
112
113
# File 'lib/linked_in/share_and_social_stream.rb', line 110

def like_share(update_key)
  path = "/people/~/network/updates/key=#{update_key}/is-liked"
  put(path, "true")
end

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

Retrieve the authenticated users network updates

Permissions: rw_nus

Parameters:

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

    a customizable set of options

Options Hash (options):

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

Returns:

See Also:



31
32
33
34
# File 'lib/linked_in/share_and_social_stream.rb', line 31

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

Returns:

See Also:



54
55
56
57
# File 'lib/linked_in/share_and_social_stream.rb', line 54

def share_comments(update_key, options={})
  path = "#{profile_path(options)}/network/updates/key=#{update_key}/update-comments"
  get(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

Returns:

See Also:



71
72
73
74
# File 'lib/linked_in/share_and_social_stream.rb', line 71

def share_likes(update_key, options={})
  path = "#{profile_path(options)}/network/updates/key=#{update_key}/likes"
  get(path, options)
end

#shares(options = {}) ⇒ Object

TODO refactor to use #network_updates



37
38
39
40
# File 'lib/linked_in/share_and_social_stream.rb', line 37

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



123
124
125
126
# File 'lib/linked_in/share_and_social_stream.rb', line 123

def unlike_share(update_key)
  path = "/people/~/network/updates/key=#{update_key}/is-liked"
  put(path, "false")
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:



98
99
100
101
# File 'lib/linked_in/share_and_social_stream.rb', line 98

def update_comment(update_key, comment)
  path = "/people/~/network/updates/key=#{update_key}/update-comments"
  post(path, {comment: comment})
end