linkedin 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/linked_in/client.rb +2 -2
- data/lib/linkedin.rb +34 -0
- data/test/oauth_test.rb +11 -0
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.3
|
data/lib/linked_in/client.rb
CHANGED
@@ -3,7 +3,7 @@ module LinkedIn
|
|
3
3
|
|
4
4
|
attr_reader :ctoken, :csecret, :consumer_options
|
5
5
|
|
6
|
-
def initialize(ctoken, csecret, options={})
|
6
|
+
def initialize(ctoken=LinkedIn.token, csecret=LinkedIn.secret, options={})
|
7
7
|
opts = {
|
8
8
|
:request_token_path => "/uas/oauth/requestToken",
|
9
9
|
:access_token_path => "/uas/oauth/accessToken",
|
@@ -23,7 +23,7 @@ module LinkedIn
|
|
23
23
|
|
24
24
|
# Note: If using oauth with a web app, be sure to provide :oauth_callback.
|
25
25
|
# Options:
|
26
|
-
# :oauth_callback => String, url that
|
26
|
+
# :oauth_callback => String, url that LinkedIn should redirect to
|
27
27
|
def request_token(options={})
|
28
28
|
@request_token ||= consumer.get_request_token(options)
|
29
29
|
end
|
data/lib/linkedin.rb
CHANGED
@@ -29,6 +29,40 @@ module LinkedIn
|
|
29
29
|
class Unavailable < StandardError; end
|
30
30
|
class InformLinkedIn < StandardError; end
|
31
31
|
class NotFound < StandardError; end
|
32
|
+
|
33
|
+
# config/initializers/linkedin.rb (for instance)
|
34
|
+
#
|
35
|
+
# LinkedIn.configure do |config|
|
36
|
+
# config.token = 'consumer_token'
|
37
|
+
# config.secret = 'consumer_secret'
|
38
|
+
# end
|
39
|
+
#
|
40
|
+
# elsewhere
|
41
|
+
#
|
42
|
+
# client = LinkedIn::Client.new
|
43
|
+
def self.configure
|
44
|
+
yield self
|
45
|
+
|
46
|
+
LinkedIn.token = token
|
47
|
+
LinkedIn.secret = secret
|
48
|
+
true
|
49
|
+
end
|
50
|
+
|
51
|
+
def self.token
|
52
|
+
@token
|
53
|
+
end
|
54
|
+
|
55
|
+
def self.token=(token)
|
56
|
+
@token = token
|
57
|
+
end
|
58
|
+
|
59
|
+
def self.secret
|
60
|
+
@secret
|
61
|
+
end
|
62
|
+
|
63
|
+
def self.secret=(secret)
|
64
|
+
@secret = secret
|
65
|
+
end
|
32
66
|
end
|
33
67
|
|
34
68
|
directory = File.expand_path(File.dirname(__FILE__))
|
data/test/oauth_test.rb
CHANGED
@@ -102,5 +102,16 @@ class OAuthTest < Test::Unit::TestCase
|
|
102
102
|
linkedin.access_token.secret.should == 'asecret'
|
103
103
|
end
|
104
104
|
|
105
|
+
should "be able to configure consumer token and consumer secret without passing to initialize" do
|
106
|
+
LinkedIn.configure do |config|
|
107
|
+
config.token = 'consumer_token'
|
108
|
+
config.secret = 'consumer_secret'
|
109
|
+
end
|
110
|
+
|
111
|
+
linkedin = LinkedIn::Client.new
|
112
|
+
linkedin.ctoken.should == 'consumer_token'
|
113
|
+
linkedin.csecret.should == 'consumer_secret'
|
114
|
+
end
|
115
|
+
|
105
116
|
|
106
117
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: linkedin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Wynn Netherland
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-12-
|
12
|
+
date: 2009-12-24 00:00:00 -06:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|