Class: LinkedIn::ShareAndSocialStream

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

Overview

Share and Social Stream APIs

LinkedIn’s v2 API adherence to the documentation is shaky at best. Several of the calls simply don’t work if you, e.g., pass the URN in as a path element for a resource - you have to use the ids= format w/ a single URN. Or sometimes passing in an “actor” parameter in the request body simply doesn’t work, and you have to pass it in as a URL parameter. What you see in this file is the result of trial-and-error getting these endpoints to work, and the inconsistency is usually a result of either misunderstanding the docs or the API not working as advertised. It’s also a bit unclear when the API wants an activity URN vs, e.g., an article URN. Caveat emptor.

[(contribute here)](github.com/mallowtechdev/linkedin-ruby)

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

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

Create one share from a person, organization, or organizationBrand.

Permissions:

1.) For personal shares, you may only post shares as the authorized member.
2.) For organization shares, you may only post shares as an organization for which the
    authorized member is an administrator.

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :owner, (String)

    the URN of the entity posting the share.

Returns:

See Also:



33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/linked_in/share_and_social_stream.rb', line 33

def share(options = {})
  path = '/shares'
  defaults = {distribution:
                  {
                      linkedInDistributionTarget:
                          {
                              visibleToGuest: true
                          }
                  }
  }
  post(path, MultiJson.dump(defaults.merge(options)), 'Content-Type' => 'application/json')
end