ezlinkedin 0.4.2 → 0.5.2
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/.gitignore +1 -0
- data/README.md +14 -4
- data/ezlinkedin.gemspec +1 -1
- data/lib/ezlinkedin/api/query_methods.rb +2 -2
- data/lib/ezlinkedin/search.rb +11 -6
- data/lib/ezlinkedin/version.rb +1 -1
- data/spec/api_spec.rb +1 -54
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2fad8964262cf88a3f1256749ca8a883f88495e5
|
4
|
+
data.tar.gz: 055e3da775bdd9af13d2037e3789a92d3512779b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 38198a60608cb378749ec6042f6f12aec0fdab1e717137b90d2d75a26b45a01caaebbd6177b8a087e4ae3c42d274b6fc91bc42ef9a2fdf9e8a8cee7871252e09
|
7
|
+
data.tar.gz: 1bf2f9f87b46a5502bd4e0daac4c45279ce93ba2824c3d1f70334100c6dca3b022bfb5a4f888396d98c5c408881b5b3696d02ade72ffd021dd08ed5e21357242
|
data/README.md
CHANGED
@@ -5,7 +5,7 @@ A simple way to make calls on Linkedin's API. NOTE: It is not yet completed and
|
|
5
5
|
This is heavily inspired and influenced by the [pengwynn/linkedin](https://github.com/pengwynn/linkedin) gem. I was having issues with his gem though and there is very little documentation for using it so I decided to redo it myself in order to:
|
6
6
|
* Make it work for what I needed
|
7
7
|
* Add precise and useful documentation
|
8
|
-
*
|
8
|
+
* learn the api
|
9
9
|
|
10
10
|
Most of the tests are from pengwynn's gem
|
11
11
|
|
@@ -33,7 +33,7 @@ require 'ezlinkedin'
|
|
33
33
|
# Create a client
|
34
34
|
linkedin = EzLinkedin::Client.new("API KEY", "SECRET KEY", options) # options are the typical OAuth consumer options
|
35
35
|
linkedin.authorize("access_token", "access_token_secret") # tokens obtained from omniauth
|
36
|
-
|
36
|
+
|
37
37
|
linkedin.profile(id: 1234, fields: ['name', 'email']
|
38
38
|
linkedin.connections(count: 30)
|
39
39
|
linkedin.network_updates(types: [:shar, :prfx, :conn], count: 50)
|
@@ -44,8 +44,18 @@ linkedin.post_share({:comment => "I'm a comment",
|
|
44
44
|
:submitted_image_url => "http..." },
|
45
45
|
:visibility => { :code => "anyone"} })
|
46
46
|
```
|
47
|
-
Currently, one can
|
48
|
-
|
47
|
+
Currently, one can:
|
48
|
+
* post shares
|
49
|
+
* retrieve network updates, user profile, and connections
|
50
|
+
* search for companies
|
51
|
+
* use the company and people search api
|
52
|
+
|
53
|
+
## TODO
|
54
|
+
|
55
|
+
I'd really like to include the facets capabilities in the search because it would really boost search efficiency.
|
56
|
+
|
57
|
+
This gem fits the purposes I had for it and I'm satisfied. Besides implementing Faceted search, I don't plan on implementing other features at this point. But feel free to contribute
|
58
|
+
|
49
59
|
## Contributing
|
50
60
|
|
51
61
|
1. Fork it
|
data/ezlinkedin.gemspec
CHANGED
@@ -27,6 +27,6 @@ Gem::Specification.new do |spec|
|
|
27
27
|
spec.add_development_dependency "rspec", '~> 2.6'
|
28
28
|
spec.add_development_dependency 'guard'
|
29
29
|
spec.add_development_dependency 'guard-rspec'
|
30
|
-
spec.add_development_dependency '
|
30
|
+
spec.add_development_dependency 'terminal-notifier-guard'
|
31
31
|
spec.add_development_dependency "webmock", '~> 1.11.0'
|
32
32
|
end
|
@@ -45,7 +45,7 @@ module EzLinkedin
|
|
45
45
|
# Do a company search based on id, email, or universal-name
|
46
46
|
# @param options={} [Hash] parameters to search by, includes:
|
47
47
|
# id, universal-name(pass it in as :name), email-domain(:domain).
|
48
|
-
#
|
48
|
+
# The 'fields' option only works if you search with an id. See
|
49
49
|
# the linkedin api for available fields
|
50
50
|
#
|
51
51
|
# @return [Mash] Mash hash of results
|
@@ -164,4 +164,4 @@ module EzLinkedin
|
|
164
164
|
end
|
165
165
|
|
166
166
|
end
|
167
|
-
end
|
167
|
+
end
|
data/lib/ezlinkedin/search.rb
CHANGED
@@ -6,16 +6,21 @@ module EzLinkedin
|
|
6
6
|
# @param options [Hash or String] Hash of search criteria or
|
7
7
|
# a string of keyword(s).
|
8
8
|
# In order to specify fields for a resource(companies or people):
|
9
|
-
# pass in the fields as a hash of arrays.
|
10
|
-
|
11
|
-
|
9
|
+
# pass in the fields as a hash of arrays with the type of search as the key.
|
10
|
+
# In this context, regular 'fields' key is for field pertaining to the search
|
11
|
+
# and not the resource being searched on.
|
12
|
+
# client.search(:people => ['id', 'first-name'], fields: ['num-results'], first_name: 'bob')
|
13
|
+
# client.search(:company => ['id', 'name'], keywords: 'stuff')
|
12
14
|
# @param type="people" [String or symbol] :people or :company search?
|
13
15
|
#
|
14
16
|
# @return [Mash] hash of results
|
15
17
|
def search(options, type="people")
|
16
|
-
|
17
|
-
|
18
|
+
path = "/#{type.to_s}-search"
|
18
19
|
if options.is_a?(Hash)
|
20
|
+
if options.has_key? :company
|
21
|
+
type = 'company'
|
22
|
+
end
|
23
|
+
path = "/#{type.to_s}-search"
|
19
24
|
if type_fields = options.delete(type.to_sym)
|
20
25
|
if type != 'people'
|
21
26
|
path += ":(companies:(#{type_fields.join(',')})#{search_fields(options)})"
|
@@ -55,4 +60,4 @@ module EzLinkedin
|
|
55
60
|
key.gsub("_", "-")
|
56
61
|
end
|
57
62
|
end
|
58
|
-
end
|
63
|
+
end
|
data/lib/ezlinkedin/version.rb
CHANGED
data/spec/api_spec.rb
CHANGED
@@ -35,16 +35,6 @@ describe EzLinkedin::Api do
|
|
35
35
|
client.network_updates(types: [:shar], count: 5, scope: 'self').should be_an_instance_of(EzLinkedin::Mash)
|
36
36
|
end
|
37
37
|
|
38
|
-
# it "should be able to view network_update's comments" do
|
39
|
-
# stub_request(:get, "https://api.linkedin.com/v1/people/~/network/updates/key=network_update_key/update-comments").to_return(:body => "{}")
|
40
|
-
# client.share_comments("network_update_key").should be_an_instance_of(EzLinkedin::Mash)
|
41
|
-
# end
|
42
|
-
|
43
|
-
# it "should be able to view network_update's likes" do
|
44
|
-
# stub_request(:get, "https://api.linkedin.com/v1/people/~/network/updates/key=network_update_key/likes").to_return(:body => "{}")
|
45
|
-
# client.share_likes("network_update_key").should be_an_instance_of(EzLinkedin::Mash)
|
46
|
-
# end
|
47
|
-
#
|
48
38
|
it "should be able to search with a keyword if given a String" do
|
49
39
|
stub_request(:get, "https://api.linkedin.com/v1/people-search?keywords=business").to_return(:body => "{}")
|
50
40
|
client.search("business").should be_an_instance_of(EzLinkedin::Mash)
|
@@ -64,7 +54,7 @@ describe EzLinkedin::Api do
|
|
64
54
|
it "should be able to search companies" do
|
65
55
|
stub_request(:get, "https://api.linkedin.com/v1/company-search:(companies:(id,name),num-results)?keywords=apple").to_return(
|
66
56
|
:body => "{}")
|
67
|
-
client.search({:keywords => "apple", :company => ["id", "name"], :fields => ['num-results']}
|
57
|
+
client.search({:keywords => "apple", :company => ["id", "name"], :fields => ['num-results']}).should be_an_instance_of(EzLinkedin::Mash)
|
68
58
|
end
|
69
59
|
|
70
60
|
it "should be able to post a share" do
|
@@ -74,39 +64,7 @@ it "should be able to search companies" do
|
|
74
64
|
response.code.should == "201"
|
75
65
|
end
|
76
66
|
|
77
|
-
# it "should be able to comment on network update" do
|
78
|
-
# stub_request(:post, "https://api.linkedin.com/v1/people/~/network/updates/key=SOMEKEY/update-comments").to_return(
|
79
|
-
# :body => "", :status => 201)
|
80
|
-
# response = client.update_comment('SOMEKEY', "Testing, 1, 2, 3")
|
81
|
-
# response.body.should == nil
|
82
|
-
# response.code.should == "201"
|
83
|
-
# end
|
84
|
-
#
|
85
|
-
# it "should be able to send a message" do
|
86
|
-
# stub_request(:post, "https://api.linkedin.com/v1/people/~/mailbox").to_return(:body => "", :status => 201)
|
87
|
-
# response = client.send_message("subject", "body", ["recip1", "recip2"])
|
88
|
-
# response.body.should == nil
|
89
|
-
# response.code.should == "201"
|
90
|
-
# end
|
91
|
-
#
|
92
|
-
# it "should be able to like a network update" do
|
93
|
-
# stub_request(:put, "https://api.linkedin.com/v1/people/~/network/updates/key=SOMEKEY/is-liked").
|
94
|
-
# with(:body => "true").to_return(:body => "", :status => 201)
|
95
|
-
# response = client.like_share('SOMEKEY')
|
96
|
-
# response.body.should == nil
|
97
|
-
# response.code.should == "201"
|
98
|
-
# end
|
99
|
-
#
|
100
|
-
# it "should be able to unlike a network update" do
|
101
|
-
# stub_request(:put, "https://api.linkedin.com/v1/people/~/network/updates/key=SOMEKEY/is-liked").
|
102
|
-
# with(:body => "false").to_return(:body => "", :status => 201)
|
103
|
-
# response = client.unlike_share('SOMEKEY')
|
104
|
-
# response.body.should == nil
|
105
|
-
# response.code.should == "201"
|
106
|
-
# end
|
107
|
-
#
|
108
67
|
context "Company API" do
|
109
|
-
# use_vcr_cassette
|
110
68
|
|
111
69
|
it "should be able to view a company profile" do
|
112
70
|
stub_request(:get, "https://api.linkedin.com/v1/companies/1586").to_return(:body => "{}")
|
@@ -123,17 +81,6 @@ it "should be able to search companies" do
|
|
123
81
|
client.company(:domain => 'acme.com').should be_an_instance_of(EzLinkedin::Mash)
|
124
82
|
end
|
125
83
|
|
126
|
-
# it "should load correct company data" do
|
127
|
-
# client.company(:id => 1586).name.should == "Amazon"
|
128
|
-
|
129
|
-
# data = client.company(:id => 1586, :fields => %w{ id name industry locations:(address:(city state country-code) is-headquarters) employee-count-range })
|
130
|
-
# data.id.should == 1586
|
131
|
-
# data.name.should == "Amazon"
|
132
|
-
# data.employee_count_range.name.should == "10001+"
|
133
|
-
# data.industry.should == "Internet"
|
134
|
-
# data.locations.all[0].address.city.should == "Seattle"
|
135
|
-
# data.locations.all[0].is_headquarters.should == true
|
136
|
-
# end
|
137
84
|
end
|
138
85
|
|
139
86
|
context "Group API" do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ezlinkedin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- akonwi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-08-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: oauth
|
@@ -137,7 +137,7 @@ dependencies:
|
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: '0'
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
|
-
name:
|
140
|
+
name: terminal-notifier-guard
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
142
142
|
requirements:
|
143
143
|
- - '>='
|