linkedin 0.4.6 → 0.4.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +0 -1
- data/.yardopts +7 -0
- data/{changelog.markdown → CHANGELOG.md} +5 -1
- data/EXAMPLES.md +199 -0
- data/Gemfile +4 -0
- data/README.md +43 -0
- data/Rakefile +2 -7
- data/lib/linked_in/api.rb +34 -2
- data/lib/linked_in/api/communications.rb +44 -0
- data/lib/linked_in/api/companies.rb +128 -0
- data/lib/linked_in/api/groups.rb +115 -0
- data/lib/linked_in/api/jobs.rb +64 -0
- data/lib/linked_in/api/people.rb +72 -0
- data/lib/linked_in/api/query_helpers.rb +86 -0
- data/lib/linked_in/api/share_and_social_stream.rb +133 -0
- data/lib/linked_in/client.rb +7 -2
- data/lib/linked_in/errors.rb +12 -2
- data/lib/linked_in/mash.rb +31 -4
- data/lib/linked_in/search.rb +16 -1
- data/lib/linked_in/version.rb +1 -1
- data/lib/linkedin.rb +4 -1
- data/linkedin.gemspec +5 -3
- data/spec/cases/api_spec.rb +15 -5
- data/spec/cases/mash_spec.rb +30 -2
- data/spec/cases/oauth_spec.rb +5 -6
- data/spec/cases/search_spec.rb +53 -23
- data/spec/fixtures/cassette_library/LinkedIn_Api/Company_API.yml +3 -3
- data/spec/fixtures/cassette_library/LinkedIn_Api/Company_API/should_load_correct_company_data.yml +81 -0
- data/spec/fixtures/cassette_library/LinkedIn_Client/{_authorize_from_request.yml → _authorize_from_request/should_return_a_valid_access_token.yml} +0 -0
- data/spec/fixtures/cassette_library/LinkedIn_Client/_request_token/{with_a_callback_url.yml → with_a_callback_url/should_return_a_valid_access_token.yml} +0 -0
- data/spec/fixtures/cassette_library/LinkedIn_Client/_request_token/{with_default_options.yml → with_default_options/should_return_a_valid_request_token.yml} +0 -0
- data/spec/fixtures/cassette_library/LinkedIn_Search/_search/{by_company_name_option.yml → by_company_name_option/should_perform_a_search.yml} +8 -9
- data/spec/fixtures/cassette_library/LinkedIn_Search/_search/by_email_address/should_perform_a_people_search.yml +57 -0
- data/spec/fixtures/cassette_library/LinkedIn_Search/_search/{by_first_name_and_last_name_options.yml → by_first_name_and_last_name_options/should_perform_a_search.yml} +15 -15
- data/spec/fixtures/cassette_library/LinkedIn_Search/_search/by_first_name_and_last_name_options_with_fields/should_perform_a_search.yml +114 -0
- data/spec/fixtures/cassette_library/LinkedIn_Search/_search/{by_keywords_string_parameter.yml → by_keywords_string_parameter/should_perform_a_search.yml} +8 -9
- data/spec/fixtures/cassette_library/LinkedIn_Search/_search/by_multiple_email_address/should_perform_a_multi-email_search.yml +59 -0
- data/spec/fixtures/cassette_library/LinkedIn_Search/_search/{by_single_keywords_option.yml → by_single_keywords_option/should_perform_a_search.yml} +8 -9
- data/spec/fixtures/cassette_library/LinkedIn_Search/_search/{by_single_keywords_option_with_pagination.yml → by_single_keywords_option_with_pagination/should_perform_a_search.yml} +1 -3
- data/spec/fixtures/cassette_library/LinkedIn_Search/_search/email_search_returns_unauthorized/should_raise_an_unauthorized_error.yml +59 -0
- data/spec/fixtures/cassette_library/LinkedIn_Search/_search_company/by_keywords_options_with_fields/should_perform_a_search.yml +43 -0
- data/spec/fixtures/cassette_library/LinkedIn_Search/_search_company/{by_keywords_string_parameter.yml → by_keywords_string_parameter/should_perform_a_company_search.yml} +19 -19
- data/spec/fixtures/cassette_library/LinkedIn_Search/_search_company/{by_single_keywords_option.yml → by_single_keywords_option/should_perform_a_company_search.yml} +19 -19
- data/spec/fixtures/cassette_library/LinkedIn_Search/_search_company/{by_single_keywords_option_with_facets_to_return.yml → by_single_keywords_option_with_facets_to_return/should_return_a_facet.yml} +14 -14
- data/spec/fixtures/cassette_library/LinkedIn_Search/_search_company/{by_single_keywords_option_with_pagination.yml → by_single_keywords_option_with_pagination/should_perform_a_search.yml} +15 -15
- data/spec/helper.rb +9 -5
- metadata +76 -61
- data/.document +0 -5
- data/README.markdown +0 -84
- data/examples/authenticate.rb +0 -26
- data/examples/communication.rb +0 -7
- data/examples/network.rb +0 -12
- data/examples/profile.rb +0 -18
- data/examples/sinatra.rb +0 -77
- data/examples/status.rb +0 -6
- data/lib/linked_in/api/query_methods.rb +0 -176
- data/lib/linked_in/api/update_methods.rb +0 -85
- data/spec/fixtures/cassette_library/LinkedIn_Client/_request_token.yml +0 -37
- data/spec/fixtures/cassette_library/LinkedIn_Search/_search/by_first_name_and_last_name_options_with_fields.yml +0 -112
- data/spec/fixtures/cassette_library/LinkedIn_Search/_search_company/by_keywords_options_with_fields.yml +0 -232
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4586ae7fcf4a2d1ed3767ba0f9f086366394f6b0
|
4
|
+
data.tar.gz: 7d56220662ae630e2aebc568348ae46fd073b354
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fc14611de8a4c196203fd8300e1af097067172b463d919102d635ffb24f27a7b8b5e787530a0ca0e5b2669dae1be632e116097d7691b03ff3964952750dcaf41
|
7
|
+
data.tar.gz: 1a74bf22abe4fb30e037aeb004d3528965ed9050ab8bd416079cd1640223461a4bbc19c6c92172f2fd83068fbcf008111e7ac416bb02b3bba7983a1b86febdc4
|
data/.travis.yml
CHANGED
data/.yardopts
ADDED
@@ -1,5 +1,9 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
* Document all methods
|
4
|
+
* Re-organize modules under Api to match organization in LinkedIn's REST
|
5
|
+
API documentation
|
6
|
+
|
3
7
|
## 0.4.4 - Jan 11, 2014
|
4
8
|
|
5
9
|
* Group share add
|
@@ -92,4 +96,4 @@
|
|
92
96
|
|
93
97
|
## 0.0.1 - November 24, 2009
|
94
98
|
|
95
|
-
* Initial release
|
99
|
+
* Initial release
|
data/EXAMPLES.md
ADDED
@@ -0,0 +1,199 @@
|
|
1
|
+
# Linkedin Gem Examples
|
2
|
+
|
3
|
+
## OAuth 1.0a Authentication
|
4
|
+
|
5
|
+
Here's an example of authenticating with the LinkedIn API
|
6
|
+
|
7
|
+
```ruby
|
8
|
+
require 'rubygems'
|
9
|
+
require 'linkedin'
|
10
|
+
|
11
|
+
# get your api keys at https://www.linkedin.com/secure/developer
|
12
|
+
client = LinkedIn::Client.new('your_consumer_key', 'your_consumer_secret')
|
13
|
+
|
14
|
+
# If you want to use one of the scopes from linkedin you have to pass it in at this point
|
15
|
+
# You can learn more about it here: http://developer.linkedin.com/documents/authentication
|
16
|
+
request_token = client.request_token({}, :scope => "r_basicprofile+r_emailaddress")
|
17
|
+
|
18
|
+
rtoken = request_token.token
|
19
|
+
rsecret = request_token.secret
|
20
|
+
|
21
|
+
# to test from your desktop, open the following url in your browser
|
22
|
+
# and record the pin it gives you
|
23
|
+
request_token.authorize_url
|
24
|
+
=> "https://api.linkedin.com/uas/oauth/authorize?oauth_token=<generated_token>"
|
25
|
+
|
26
|
+
# then fetch your access keys
|
27
|
+
client.authorize_from_request(rtoken, rsecret, pin)
|
28
|
+
=> ["OU812", "8675309"] # <= save these for future requests
|
29
|
+
|
30
|
+
# or authorize from previously fetched access keys
|
31
|
+
client.authorize_from_access("OU812", "8675309")
|
32
|
+
|
33
|
+
# you're now free to move about the cabin, call any API method
|
34
|
+
```
|
35
|
+
|
36
|
+
|
37
|
+
## Profile
|
38
|
+
|
39
|
+
Here are some examples of accessing a user's profile
|
40
|
+
|
41
|
+
```ruby
|
42
|
+
# AUTHENTICATE FIRST found in examples/authenticate.rb
|
43
|
+
|
44
|
+
# client is a LinkedIn::Client
|
45
|
+
|
46
|
+
# get the profile for the authenticated user
|
47
|
+
client.profile
|
48
|
+
|
49
|
+
# get a profile for someone found in network via ID
|
50
|
+
client.profile(:id => 'gNma67_AdI')
|
51
|
+
|
52
|
+
# get a profile for someone via their public profile url
|
53
|
+
client.profile(:url => 'http://www.linkedin.com/in/netherland')
|
54
|
+
|
55
|
+
# provides the ability to access authenticated user's company field in the profile
|
56
|
+
user = client.profile(:fields => %w(positions))
|
57
|
+
companies = user.positions.all.map{|t| t.company}
|
58
|
+
# Example: most recent company can be accessed via companies[0]
|
59
|
+
|
60
|
+
# Example of a multi-email search against the special email search API
|
61
|
+
account_exists = client.profile(:email => 'email=yy@zz.com,email=xx@yy.com', :fields => ['id'])
|
62
|
+
```
|
63
|
+
|
64
|
+
|
65
|
+
## Sending a Message
|
66
|
+
|
67
|
+
Here's an example of sending a message to two recipients
|
68
|
+
|
69
|
+
```ruby
|
70
|
+
# AUTHENTICATE FIRST found in examples/authenticate.md
|
71
|
+
|
72
|
+
# client is a LinkedIn::Client
|
73
|
+
|
74
|
+
# send a message to a person in your network. you will need to authenticate the
|
75
|
+
# user and ask for the "w_messages" permission.
|
76
|
+
response = client.send_message("subject", "body", ["person_1_id", "person_2_id"])
|
77
|
+
```
|
78
|
+
|
79
|
+
|
80
|
+
## User's Network
|
81
|
+
|
82
|
+
Here are some examples of accessing network updates and connections of
|
83
|
+
the authenticated user
|
84
|
+
|
85
|
+
``` ruby
|
86
|
+
# AUTHENTICATE FIRST found in examples/authenticate.rb
|
87
|
+
|
88
|
+
# client is a LinkedIn::Client
|
89
|
+
|
90
|
+
# get network updates for the authenticated user
|
91
|
+
client.network_updates
|
92
|
+
|
93
|
+
# get profile picture changes
|
94
|
+
client.network_updates(:type => 'PICT')
|
95
|
+
|
96
|
+
# view connections for the currently authenticated user
|
97
|
+
client.connections
|
98
|
+
```
|
99
|
+
# get the original picture-url for one of the connections
|
100
|
+
client.picture_urls(:id => 'id_of_connection')
|
101
|
+
|
102
|
+
## Update User's Status
|
103
|
+
|
104
|
+
Here's an example of updating the current user's status
|
105
|
+
|
106
|
+
```ruby
|
107
|
+
# AUTHENTICATE FIRST found in examples/authenticate.rb
|
108
|
+
|
109
|
+
# client is a LinkedIn::Client
|
110
|
+
|
111
|
+
# update status for the authenticated user
|
112
|
+
client.add_share(:comment => 'is playing with the LinkedIn Ruby gem')
|
113
|
+
```
|
114
|
+
|
115
|
+
|
116
|
+
## Sinatra App
|
117
|
+
|
118
|
+
Here's an example sinatra application that performs authentication,
|
119
|
+
after which some info about the authenticated user can be retrieved.
|
120
|
+
|
121
|
+
```ruby
|
122
|
+
require "rubygems"
|
123
|
+
require "haml"
|
124
|
+
require "sinatra"
|
125
|
+
require "linkedin"
|
126
|
+
|
127
|
+
enable :sessions
|
128
|
+
|
129
|
+
helpers do
|
130
|
+
def login?
|
131
|
+
!session[:atoken].nil?
|
132
|
+
end
|
133
|
+
|
134
|
+
def profile
|
135
|
+
linkedin_client.profile unless session[:atoken].nil?
|
136
|
+
end
|
137
|
+
|
138
|
+
def connections
|
139
|
+
linkedin_client.connections unless session[:atoken].nil?
|
140
|
+
end
|
141
|
+
|
142
|
+
private
|
143
|
+
def linkedin_client
|
144
|
+
client = LinkedIn::Client.new(settings.api, settings.secret)
|
145
|
+
client.authorize_from_access(session[:atoken], session[:asecret])
|
146
|
+
client
|
147
|
+
end
|
148
|
+
|
149
|
+
end
|
150
|
+
|
151
|
+
configure do
|
152
|
+
# get your api keys at https://www.linkedin.com/secure/developer
|
153
|
+
set :api, "your_api_key"
|
154
|
+
set :secret, "your_secret"
|
155
|
+
end
|
156
|
+
|
157
|
+
get "/" do
|
158
|
+
haml :index
|
159
|
+
end
|
160
|
+
|
161
|
+
get "/auth" do
|
162
|
+
client = LinkedIn::Client.new(settings.api, settings.secret)
|
163
|
+
request_token = client.request_token(:oauth_callback => "http://#{request.host}:#{request.port}/auth/callback")
|
164
|
+
session[:rtoken] = request_token.token
|
165
|
+
session[:rsecret] = request_token.secret
|
166
|
+
|
167
|
+
redirect client.request_token.authorize_url
|
168
|
+
end
|
169
|
+
|
170
|
+
get "/auth/logout" do
|
171
|
+
session[:atoken] = nil
|
172
|
+
redirect "/"
|
173
|
+
end
|
174
|
+
|
175
|
+
get "/auth/callback" do
|
176
|
+
client = LinkedIn::Client.new(settings.api, settings.secret)
|
177
|
+
if session[:atoken].nil?
|
178
|
+
pin = params[:oauth_verifier]
|
179
|
+
atoken, asecret = client.authorize_from_request(session[:rtoken], session[:rsecret], pin)
|
180
|
+
session[:atoken] = atoken
|
181
|
+
session[:asecret] = asecret
|
182
|
+
end
|
183
|
+
redirect "/"
|
184
|
+
end
|
185
|
+
|
186
|
+
|
187
|
+
__END__
|
188
|
+
@@index
|
189
|
+
-if login?
|
190
|
+
%p Welcome #{profile.first_name}!
|
191
|
+
%a{:href => "/auth/logout"} Logout
|
192
|
+
%p= profile.headline
|
193
|
+
%br
|
194
|
+
%div= "You have #{connections.total} connections!"
|
195
|
+
-connections.all.each do |c|
|
196
|
+
%div= "#{c.first_name} #{c.last_name} - #{c.headline}"
|
197
|
+
-else
|
198
|
+
%a{:href => "/auth"} Login using LinkedIn
|
199
|
+
```
|
data/Gemfile
CHANGED
data/README.md
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
# LinkedIn
|
2
|
+
|
3
|
+
Ruby wrapper for the [LinkedIn API](http://developer.linkedin.com). The LinkedIn gem provides an easy-to-use wrapper for LinkedIn's REST APIs.
|
4
|
+
|
5
|
+
Travis CI : [](http://travis-ci.org/hexgnu/linkedin)
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
gem install linkedin
|
10
|
+
|
11
|
+
## Documentation
|
12
|
+
|
13
|
+
[http://rdoc.info/gems/linkedin](http://rdoc.info/gems/linkedin)
|
14
|
+
|
15
|
+
## Usage
|
16
|
+
|
17
|
+
[View the Examples](EXAMPLES.md)
|
18
|
+
|
19
|
+
## Changelog
|
20
|
+
|
21
|
+
[View the Changelog](CHANGELOG.md)
|
22
|
+
|
23
|
+
## TODO
|
24
|
+
|
25
|
+
* Update and correct test suite
|
26
|
+
* Change to Faraday for authentication
|
27
|
+
* Implement Messaging APIs
|
28
|
+
|
29
|
+
## Note on Patches/Pull Requests
|
30
|
+
|
31
|
+
* Fork the project.
|
32
|
+
* Make your feature addition or bug fix.
|
33
|
+
* Add tests for it. This is important so I don't break it in a
|
34
|
+
future version unintentionally.
|
35
|
+
* Make sure your test doesn't just check of instance of LinkedIn::Mash :smile:.
|
36
|
+
* Commit, do not mess with rakefile, version, or history.
|
37
|
+
(if you want to have your own version, that is fine but
|
38
|
+
bump version in a commit by itself I can ignore when I pull)
|
39
|
+
* Send me a pull request. Bonus points for topic branches.
|
40
|
+
|
41
|
+
## Copyright
|
42
|
+
|
43
|
+
Copyright (c) 2013-Present [Matt Kirk](http://matthewkirk.com) 2009-11 [Wynn Netherland](http://wynnnetherland.com). See LICENSE for details.
|
data/Rakefile
CHANGED
@@ -10,11 +10,6 @@ task :test => :spec
|
|
10
10
|
task :default => :spec
|
11
11
|
load 'vcr/tasks/vcr.rake'
|
12
12
|
|
13
|
-
require 'rdoc/task'
|
14
13
|
require File.expand_path('../lib/linked_in/version', __FILE__)
|
15
|
-
|
16
|
-
|
17
|
-
rdoc.title = "linkedin #{LinkedIn::VERSION::STRING}"
|
18
|
-
rdoc.rdoc_files.include('README*')
|
19
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
20
|
-
end
|
14
|
+
require 'yard'
|
15
|
+
YARD::Rake::YardocTask.new
|
data/lib/linked_in/api.rb
CHANGED
@@ -1,6 +1,38 @@
|
|
1
1
|
module LinkedIn
|
2
2
|
module Api
|
3
|
-
|
4
|
-
|
3
|
+
|
4
|
+
# @!macro person_path_options
|
5
|
+
# @param [Hash] options identifies the user profile you want
|
6
|
+
# @option options [String] :id a member token
|
7
|
+
# @option options [String] :url a Public Profile URL
|
8
|
+
# @option options [String] :email
|
9
|
+
|
10
|
+
# @!macro company_path_options
|
11
|
+
# @param [Hash] options identifies the user profile you want
|
12
|
+
# @option options [String] :domain company email domain
|
13
|
+
# @option options [String] :id company ID
|
14
|
+
# @option options [String] :url
|
15
|
+
# @option options [String] :name company universal name
|
16
|
+
# @option options [String] :is_admin list all companies that the
|
17
|
+
# authenticated is an administrator of
|
18
|
+
|
19
|
+
# @!macro share_input_fields
|
20
|
+
# @param [Hash] share content of the share
|
21
|
+
# @option share [String] :comment
|
22
|
+
# @option share [String] :content
|
23
|
+
# @option share [String] :title
|
24
|
+
# @option share [String] :submitted-url
|
25
|
+
# @option share [String] :submitted-image-url
|
26
|
+
# @option share [String] :description
|
27
|
+
# @option share [String] :visibility
|
28
|
+
# @option share [String] :code
|
29
|
+
|
30
|
+
autoload :QueryHelpers, "linked_in/api/query_helpers"
|
31
|
+
autoload :People, "linked_in/api/people"
|
32
|
+
autoload :Groups, "linked_in/api/groups"
|
33
|
+
autoload :Companies, "linked_in/api/companies"
|
34
|
+
autoload :Jobs, "linked_in/api/jobs"
|
35
|
+
autoload :ShareAndSocialStream, "linked_in/api/share_and_social_stream"
|
36
|
+
autoload :Communications, "linked_in/api/communications"
|
5
37
|
end
|
6
38
|
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
module LinkedIn
|
2
|
+
module Api
|
3
|
+
|
4
|
+
# Communications APIs
|
5
|
+
#
|
6
|
+
# @see http://developer.linkedin.com/documents/communications
|
7
|
+
module Communications
|
8
|
+
|
9
|
+
# (Create) send a message from the authenticated user to a
|
10
|
+
# connection
|
11
|
+
#
|
12
|
+
# Permissions: w_messages
|
13
|
+
#
|
14
|
+
# @see http://developer.linkedin.com/documents/messaging-between-connections-api
|
15
|
+
# @see http://developer.linkedin.com/documents/invitation-api Invitation API
|
16
|
+
#
|
17
|
+
# @example
|
18
|
+
# client.send_message("subject", "body", ["person_1_id", "person_2_id"])
|
19
|
+
#
|
20
|
+
# @param [String] subject Subject of the message
|
21
|
+
# @param [String] body Body of the message, plain text only
|
22
|
+
# @param [Array<String>] recipient_paths a collection of
|
23
|
+
# profile paths that identify the users who will receive the
|
24
|
+
# message
|
25
|
+
# @return [void]
|
26
|
+
def send_message(subject, body, recipient_paths)
|
27
|
+
path = "/people/~/mailbox"
|
28
|
+
|
29
|
+
message = {
|
30
|
+
'subject' => subject,
|
31
|
+
'body' => body,
|
32
|
+
'recipients' => {
|
33
|
+
'values' => recipient_paths.map do |profile_path|
|
34
|
+
{ 'person' => { '_path' => "/people/#{profile_path}" } }
|
35
|
+
end
|
36
|
+
}
|
37
|
+
}
|
38
|
+
post(path, MultiJson.dump(message), "Content-Type" => "application/json")
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,128 @@
|
|
1
|
+
module LinkedIn
|
2
|
+
module Api
|
3
|
+
|
4
|
+
# Companies API
|
5
|
+
#
|
6
|
+
# @see http://developer.linkedin.com/documents/companies Companies API
|
7
|
+
# @see http://developer.linkedin.com/documents/company-lookup-api-and-fields Company Fields
|
8
|
+
#
|
9
|
+
# The following API actions do not have corresponding methods in
|
10
|
+
# this module
|
11
|
+
#
|
12
|
+
# * Permissions Checking Endpoints for Company Shares
|
13
|
+
# * GET Suggested Companies to Follow
|
14
|
+
# * GET Company Products
|
15
|
+
#
|
16
|
+
# [(contribute here)](https://github.com/hexgnu/linkedin)
|
17
|
+
module Companies
|
18
|
+
|
19
|
+
# Retrieve a Company Profile
|
20
|
+
#
|
21
|
+
# @see http://developer.linkedin.com/documents/company-lookup-api-and-fields
|
22
|
+
#
|
23
|
+
# @macro company_path_options
|
24
|
+
# @option options [String] :scope
|
25
|
+
# @option options [String] :type
|
26
|
+
# @option options [String] :count
|
27
|
+
# @option options [String] :start
|
28
|
+
# @return [LinkedIn::Mash]
|
29
|
+
def company(options = {})
|
30
|
+
path = company_path(options)
|
31
|
+
simple_query(path, options)
|
32
|
+
end
|
33
|
+
|
34
|
+
# Retrieve a feed of event items for a Company
|
35
|
+
#
|
36
|
+
# @see http://developer.linkedin.com/reading-company-shares
|
37
|
+
#
|
38
|
+
# @macro company_path_options
|
39
|
+
# @option options [String] :event-type
|
40
|
+
# @option options [String] :count
|
41
|
+
# @option options [String] :start
|
42
|
+
# @return [LinkedIn::Mash]
|
43
|
+
def company_updates(options={})
|
44
|
+
path = "#{company_path(options)}/updates"
|
45
|
+
simple_query(path, options)
|
46
|
+
end
|
47
|
+
|
48
|
+
# Retrieve statistics for a particular company page
|
49
|
+
#
|
50
|
+
# Permissions: rw_company_admin
|
51
|
+
#
|
52
|
+
# @see http://developer.linkedin.com/documents/company-statistics
|
53
|
+
#
|
54
|
+
# @macro company_path_options
|
55
|
+
# @return [LinkedIn::Mash]
|
56
|
+
def company_statistics(options={})
|
57
|
+
path = "#{company_path(options)}/company-statistics"
|
58
|
+
simple_query(path, options)
|
59
|
+
end
|
60
|
+
|
61
|
+
# Retrieve comments on a particular company update:
|
62
|
+
#
|
63
|
+
# @see http://developer.linkedin.com/reading-company-shares
|
64
|
+
#
|
65
|
+
# @param [String] update_key a update/update-key representing a
|
66
|
+
# particular company update
|
67
|
+
# @macro company_path_options
|
68
|
+
# @return [LinkedIn::Mash]
|
69
|
+
def company_updates_comments(update_key, options={})
|
70
|
+
path = "#{company_path(options)}/updates/key=#{update_key}/update-comments"
|
71
|
+
simple_query(path, options)
|
72
|
+
end
|
73
|
+
|
74
|
+
# Retrieve likes on a particular company update:
|
75
|
+
#
|
76
|
+
# @see http://developer.linkedin.com/reading-company-shares
|
77
|
+
#
|
78
|
+
# @param [String] update_key a update/update-key representing a
|
79
|
+
# particular company update
|
80
|
+
# @macro company_path_options
|
81
|
+
# @return [LinkedIn::Mash]
|
82
|
+
def company_updates_likes(update_key, options={})
|
83
|
+
path = "#{company_path(options)}/updates/key=#{update_key}/likes"
|
84
|
+
simple_query(path, options)
|
85
|
+
end
|
86
|
+
|
87
|
+
# Create a share for a company that the authenticated user
|
88
|
+
# administers
|
89
|
+
#
|
90
|
+
# Permissions: rw_company_admin
|
91
|
+
#
|
92
|
+
# @see http://developer.linkedin.com/creating-company-shares
|
93
|
+
# @see http://developer.linkedin.com/documents/targeting-company-shares Targeting Company Shares
|
94
|
+
#
|
95
|
+
# @param [String] company_id Company ID
|
96
|
+
# @macro share_input_fields
|
97
|
+
# @return [void]
|
98
|
+
def add_company_share(company_id, share)
|
99
|
+
path = "/companies/#{company_id}/shares"
|
100
|
+
defaults = {:visibility => {:code => "anyone"}}
|
101
|
+
post(path, MultiJson.dump(defaults.merge(share)), "Content-Type" => "application/json")
|
102
|
+
end
|
103
|
+
|
104
|
+
# (Create) authenticated user starts following a company
|
105
|
+
#
|
106
|
+
# @see http://developer.linkedin.com/documents/company-follow-and-suggestions
|
107
|
+
#
|
108
|
+
# @param [String] company_id Company ID
|
109
|
+
# @return [void]
|
110
|
+
def follow_company(company_id)
|
111
|
+
path = "/people/~/following/companies"
|
112
|
+
body = {:id => company_id }
|
113
|
+
post(path, MultiJson.dump(body), "Content-Type" => "application/json")
|
114
|
+
end
|
115
|
+
|
116
|
+
# (Destroy) authenticated user stops following a company
|
117
|
+
#
|
118
|
+
# @see http://developer.linkedin.com/documents/company-follow-and-suggestions
|
119
|
+
#
|
120
|
+
# @param [String] company_id Company ID
|
121
|
+
# @return [void]
|
122
|
+
def unfollow_company(company_id)
|
123
|
+
path = "/people/~/following/companies/id=#{company_id}"
|
124
|
+
delete(path)
|
125
|
+
end
|
126
|
+
end
|
127
|
+
end
|
128
|
+
end
|