linkedin 0.3.2 → 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -11,7 +11,7 @@ task :default => :spec
11
11
 
12
12
  require 'rdoc/task'
13
13
  require File.expand_path('../lib/linked_in/version', __FILE__)
14
- Rake::RDocTask.new do |rdoc|
14
+ RDoc::Task.new do |rdoc|
15
15
  rdoc.rdoc_dir = 'rdoc'
16
16
  rdoc.title = "linkedin #{LinkedIn::VERSION::STRING}"
17
17
  rdoc.rdoc_files.include('README*')
@@ -18,6 +18,11 @@ module LinkedIn
18
18
  simple_query(path, options)
19
19
  end
20
20
 
21
+ def company(options = {})
22
+ path = company_path(options)
23
+ simple_query(path, options)
24
+ end
25
+
21
26
  private
22
27
 
23
28
  def simple_query(path, options={})
@@ -43,6 +48,17 @@ module LinkedIn
43
48
  end
44
49
  end
45
50
 
51
+ def company_path(options)
52
+ path = "/companies/"
53
+ if options[:id]
54
+ path += "id=#{options[:id]}"
55
+ elsif options[:url]
56
+ path += "url=#{CGI.escape(options[:url])}"
57
+ else
58
+ path += "~"
59
+ end
60
+ end
61
+
46
62
  end
47
63
 
48
64
  end
@@ -3,7 +3,7 @@ module LinkedIn
3
3
  module VERSION #:nodoc:
4
4
  MAJOR = 0
5
5
  MINOR = 3
6
- PATCH = 2
6
+ PATCH = 3
7
7
  PRE = nil
8
8
  STRING = [MAJOR, MINOR, PATCH, PRE].compact.join('.')
9
9
  end
@@ -5,13 +5,13 @@ Gem::Specification.new do |gem|
5
5
  gem.add_dependency 'hashie', '~> 1.1.0'
6
6
  gem.add_dependency 'multi_json', '~> 1.0.3'
7
7
  gem.add_dependency 'oauth', '~> 0.4.5'
8
+ gem.add_development_dependency 'json', '~> 1.6'
8
9
  gem.add_development_dependency 'rake', '~> 0.9'
9
10
  gem.add_development_dependency 'rdoc', '~> 3.8'
10
11
  gem.add_development_dependency 'rspec', '~> 2.6'
11
- gem.add_development_dependency 'simplecov', '~> 0.4'
12
+ gem.add_development_dependency 'simplecov', '~> 0.5'
12
13
  gem.add_development_dependency 'vcr', '~> 1.10'
13
14
  gem.add_development_dependency 'webmock', '~> 1.7'
14
- gem.add_development_dependency 'yajl-ruby', '~> 0.8'
15
15
  gem.authors = ["Wynn Netherland", "Josh Kalderimis"]
16
16
  gem.description = %q{Ruby wrapper for the LinkedIn API}
17
17
  gem.email = ['wynn.netherland@gmail.com', 'josh.kalderimis@gmail.com']
@@ -29,4 +29,25 @@ describe LinkedIn::Api do
29
29
  client.network_updates.should be_an_instance_of(LinkedIn::Mash)
30
30
  end
31
31
 
32
+ context "Company API" do
33
+ use_vcr_cassette
34
+
35
+ it "should be able to view a company profile" do
36
+ stub_request(:get, "https://api.linkedin.com/v1/companies/id=1586").to_return(:body => "{}")
37
+ client.company(:id => 1586).should be_an_instance_of(LinkedIn::Mash)
38
+ end
39
+
40
+ it "should load correct company data" do
41
+ client.company(:id => 1586).name.should == "Amazon"
42
+
43
+ data = client.company(:id => 1586, :fields => %w{ id name industry locations:(address:(city state country-code) is-headquarters) employee-count-range })
44
+ data.id.should == 1586
45
+ data.name.should == "Amazon"
46
+ data.employee_count_range.name.should == "10001+"
47
+ data.industry.should == "Internet"
48
+ data.locations.all[0].address.city.should == "Seattle"
49
+ data.locations.all[0].is_headquarters.should == true
50
+ end
51
+ end
52
+
32
53
  end
@@ -0,0 +1,73 @@
1
+ ---
2
+ - !ruby/struct:VCR::HTTPInteraction
3
+ request: !ruby/struct:VCR::Request
4
+ method: :get
5
+ uri: https://api.linkedin.com:443/v1/companies/id=1586
6
+ body: !!null
7
+ headers:
8
+ x-li-format:
9
+ - json
10
+ user-agent:
11
+ - OAuth gem v0.4.5
12
+ authorization:
13
+ - OAuth oauth_consumer_key="consumer_key",
14
+ oauth_nonce="nonce", oauth_signature="signature",
15
+ oauth_signature_method="HMAC-SHA1", oauth_timestamp="1319129843", oauth_token="token",
16
+ oauth_version="1.0"
17
+ response: !ruby/struct:VCR::Response
18
+ status: !ruby/struct:VCR::ResponseStatus
19
+ code: 200
20
+ message: OK
21
+ headers:
22
+ server:
23
+ - Apache-Coyote/1.1
24
+ vary:
25
+ - ! '*'
26
+ x-li-format:
27
+ - json
28
+ content-type:
29
+ - application/json;charset=UTF-8
30
+ transfer-encoding:
31
+ - chunked
32
+ date:
33
+ - Thu, 20 Oct 2011 16:57:24 GMT
34
+ body: ! "{\n \"id\": 1586,\n \"name\": \"Amazon\"\n}"
35
+ http_version: '1.1'
36
+ - !ruby/struct:VCR::HTTPInteraction
37
+ request: !ruby/struct:VCR::Request
38
+ method: :get
39
+ uri: https://api.linkedin.com:443/v1/companies/id=1586:(id,name,industry,locations:(address:(city,state,country-code),is-headquarters),employee-count-range)
40
+ body: !!null
41
+ headers:
42
+ x-li-format:
43
+ - json
44
+ user-agent:
45
+ - OAuth gem v0.4.5
46
+ authorization:
47
+ - OAuth oauth_consumer_key="consumer_key",
48
+ oauth_nonce="nonc", oauth_signature="signature",
49
+ oauth_signature_method="HMAC-SHA1", oauth_timestamp="1319129844", oauth_token="token",
50
+ oauth_version="1.0"
51
+ response: !ruby/struct:VCR::Response
52
+ status: !ruby/struct:VCR::ResponseStatus
53
+ code: 200
54
+ message: OK
55
+ headers:
56
+ server:
57
+ - Apache-Coyote/1.1
58
+ vary:
59
+ - ! '*'
60
+ x-li-format:
61
+ - json
62
+ content-type:
63
+ - application/json;charset=UTF-8
64
+ transfer-encoding:
65
+ - chunked
66
+ date:
67
+ - Thu, 20 Oct 2011 16:57:24 GMT
68
+ body: ! "{\n \"employeeCountRange\": {\n \"code\": \"I\",\n \"name\": \"10001+\"\n
69
+ \ },\n \"id\": 1586,\n \"industry\": \"Internet\",\n \"locations\": {\n \"_total\":
70
+ 1,\n \"values\": [{\n \"address\": {\n \"city\": \"Seattle\",\n
71
+ \ \"countryCode\": \"us\",\n \"state\": \"WA\"\n },\n \"isHeadquarters\":
72
+ true\n }]\n },\n \"name\": \"Amazon\"\n}"
73
+ http_version: '1.1'
metadata CHANGED
@@ -1,139 +1,135 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: linkedin
3
- version: !ruby/object:Gem::Version
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.3.3
4
5
  prerelease:
5
- version: 0.3.2
6
6
  platform: ruby
7
- authors:
7
+ authors:
8
8
  - Wynn Netherland
9
9
  - Josh Kalderimis
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
-
14
- date: 2011-09-04 00:00:00 Z
15
- dependencies:
16
- - !ruby/object:Gem::Dependency
13
+ date: 2011-10-20 00:00:00.000000000Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
17
16
  name: hashie
18
- prerelease: false
19
- requirement: &id001 !ruby/object:Gem::Requirement
17
+ requirement: &70166241464060 !ruby/object:Gem::Requirement
20
18
  none: false
21
- requirements:
19
+ requirements:
22
20
  - - ~>
23
- - !ruby/object:Gem::Version
21
+ - !ruby/object:Gem::Version
24
22
  version: 1.1.0
25
23
  type: :runtime
26
- version_requirements: *id001
27
- - !ruby/object:Gem::Dependency
28
- name: multi_json
29
24
  prerelease: false
30
- requirement: &id002 !ruby/object:Gem::Requirement
25
+ version_requirements: *70166241464060
26
+ - !ruby/object:Gem::Dependency
27
+ name: multi_json
28
+ requirement: &70166241493740 !ruby/object:Gem::Requirement
31
29
  none: false
32
- requirements:
30
+ requirements:
33
31
  - - ~>
34
- - !ruby/object:Gem::Version
32
+ - !ruby/object:Gem::Version
35
33
  version: 1.0.3
36
34
  type: :runtime
37
- version_requirements: *id002
38
- - !ruby/object:Gem::Dependency
39
- name: oauth
40
35
  prerelease: false
41
- requirement: &id003 !ruby/object:Gem::Requirement
36
+ version_requirements: *70166241493740
37
+ - !ruby/object:Gem::Dependency
38
+ name: oauth
39
+ requirement: &70166241493280 !ruby/object:Gem::Requirement
42
40
  none: false
43
- requirements:
41
+ requirements:
44
42
  - - ~>
45
- - !ruby/object:Gem::Version
43
+ - !ruby/object:Gem::Version
46
44
  version: 0.4.5
47
45
  type: :runtime
48
- version_requirements: *id003
49
- - !ruby/object:Gem::Dependency
50
- name: rake
51
46
  prerelease: false
52
- requirement: &id004 !ruby/object:Gem::Requirement
47
+ version_requirements: *70166241493280
48
+ - !ruby/object:Gem::Dependency
49
+ name: json
50
+ requirement: &70166241492820 !ruby/object:Gem::Requirement
53
51
  none: false
54
- requirements:
52
+ requirements:
55
53
  - - ~>
56
- - !ruby/object:Gem::Version
57
- version: "0.9"
54
+ - !ruby/object:Gem::Version
55
+ version: '1.6'
58
56
  type: :development
59
- version_requirements: *id004
60
- - !ruby/object:Gem::Dependency
61
- name: rdoc
62
57
  prerelease: false
63
- requirement: &id005 !ruby/object:Gem::Requirement
58
+ version_requirements: *70166241492820
59
+ - !ruby/object:Gem::Dependency
60
+ name: rake
61
+ requirement: &70166241492360 !ruby/object:Gem::Requirement
64
62
  none: false
65
- requirements:
63
+ requirements:
66
64
  - - ~>
67
- - !ruby/object:Gem::Version
68
- version: "3.8"
65
+ - !ruby/object:Gem::Version
66
+ version: '0.9'
69
67
  type: :development
70
- version_requirements: *id005
71
- - !ruby/object:Gem::Dependency
72
- name: rspec
73
68
  prerelease: false
74
- requirement: &id006 !ruby/object:Gem::Requirement
69
+ version_requirements: *70166241492360
70
+ - !ruby/object:Gem::Dependency
71
+ name: rdoc
72
+ requirement: &70166241491900 !ruby/object:Gem::Requirement
75
73
  none: false
76
- requirements:
74
+ requirements:
77
75
  - - ~>
78
- - !ruby/object:Gem::Version
79
- version: "2.6"
76
+ - !ruby/object:Gem::Version
77
+ version: '3.8'
80
78
  type: :development
81
- version_requirements: *id006
82
- - !ruby/object:Gem::Dependency
83
- name: simplecov
84
79
  prerelease: false
85
- requirement: &id007 !ruby/object:Gem::Requirement
80
+ version_requirements: *70166241491900
81
+ - !ruby/object:Gem::Dependency
82
+ name: rspec
83
+ requirement: &70166241491440 !ruby/object:Gem::Requirement
86
84
  none: false
87
- requirements:
85
+ requirements:
88
86
  - - ~>
89
- - !ruby/object:Gem::Version
90
- version: "0.4"
87
+ - !ruby/object:Gem::Version
88
+ version: '2.6'
91
89
  type: :development
92
- version_requirements: *id007
93
- - !ruby/object:Gem::Dependency
94
- name: vcr
95
90
  prerelease: false
96
- requirement: &id008 !ruby/object:Gem::Requirement
91
+ version_requirements: *70166241491440
92
+ - !ruby/object:Gem::Dependency
93
+ name: simplecov
94
+ requirement: &70166241490980 !ruby/object:Gem::Requirement
97
95
  none: false
98
- requirements:
96
+ requirements:
99
97
  - - ~>
100
- - !ruby/object:Gem::Version
101
- version: "1.10"
98
+ - !ruby/object:Gem::Version
99
+ version: '0.5'
102
100
  type: :development
103
- version_requirements: *id008
104
- - !ruby/object:Gem::Dependency
105
- name: webmock
106
101
  prerelease: false
107
- requirement: &id009 !ruby/object:Gem::Requirement
102
+ version_requirements: *70166241490980
103
+ - !ruby/object:Gem::Dependency
104
+ name: vcr
105
+ requirement: &70166241490520 !ruby/object:Gem::Requirement
108
106
  none: false
109
- requirements:
107
+ requirements:
110
108
  - - ~>
111
- - !ruby/object:Gem::Version
112
- version: "1.7"
109
+ - !ruby/object:Gem::Version
110
+ version: '1.10'
113
111
  type: :development
114
- version_requirements: *id009
115
- - !ruby/object:Gem::Dependency
116
- name: yajl-ruby
117
112
  prerelease: false
118
- requirement: &id010 !ruby/object:Gem::Requirement
113
+ version_requirements: *70166241490520
114
+ - !ruby/object:Gem::Dependency
115
+ name: webmock
116
+ requirement: &70166241490060 !ruby/object:Gem::Requirement
119
117
  none: false
120
- requirements:
118
+ requirements:
121
119
  - - ~>
122
- - !ruby/object:Gem::Version
123
- version: "0.8"
120
+ - !ruby/object:Gem::Version
121
+ version: '1.7'
124
122
  type: :development
125
- version_requirements: *id010
123
+ prerelease: false
124
+ version_requirements: *70166241490060
126
125
  description: Ruby wrapper for the LinkedIn API
127
- email:
126
+ email:
128
127
  - wynn.netherland@gmail.com
129
128
  - josh.kalderimis@gmail.com
130
129
  executables: []
131
-
132
130
  extensions: []
133
-
134
131
  extra_rdoc_files: []
135
-
136
- files:
132
+ files:
137
133
  - .autotest
138
134
  - .document
139
135
  - .gemtest
@@ -166,6 +162,7 @@ files:
166
162
  - spec/cases/linkedin_spec.rb
167
163
  - spec/cases/mash_spec.rb
168
164
  - spec/cases/oauth_spec.rb
165
+ - spec/fixtures/cassette_library/LinkedIn_Api/Company_API.yml
169
166
  - spec/fixtures/cassette_library/LinkedIn_Client/_authorize_from_request.yml
170
167
  - spec/fixtures/cassette_library/LinkedIn_Client/_request_token.yml
171
168
  - spec/fixtures/cassette_library/LinkedIn_Client/_request_token/with_a_callback_url.yml
@@ -173,36 +170,34 @@ files:
173
170
  - spec/helper.rb
174
171
  homepage: http://github.com/pengwynn/linkedin
175
172
  licenses: []
176
-
177
173
  post_install_message:
178
174
  rdoc_options: []
179
-
180
- require_paths:
175
+ require_paths:
181
176
  - lib
182
- required_ruby_version: !ruby/object:Gem::Requirement
177
+ required_ruby_version: !ruby/object:Gem::Requirement
183
178
  none: false
184
- requirements:
185
- - - ">="
186
- - !ruby/object:Gem::Version
187
- version: "0"
188
- required_rubygems_version: !ruby/object:Gem::Requirement
179
+ requirements:
180
+ - - ! '>='
181
+ - !ruby/object:Gem::Version
182
+ version: '0'
183
+ required_rubygems_version: !ruby/object:Gem::Requirement
189
184
  none: false
190
- requirements:
191
- - - ">="
192
- - !ruby/object:Gem::Version
193
- version: "0"
185
+ requirements:
186
+ - - ! '>='
187
+ - !ruby/object:Gem::Version
188
+ version: '0'
194
189
  requirements: []
195
-
196
190
  rubyforge_project:
197
- rubygems_version: 1.8.10
191
+ rubygems_version: 1.8.6
198
192
  signing_key:
199
193
  specification_version: 3
200
194
  summary: Ruby wrapper for the LinkedIn API
201
- test_files:
195
+ test_files:
202
196
  - spec/cases/api_spec.rb
203
197
  - spec/cases/linkedin_spec.rb
204
198
  - spec/cases/mash_spec.rb
205
199
  - spec/cases/oauth_spec.rb
200
+ - spec/fixtures/cassette_library/LinkedIn_Api/Company_API.yml
206
201
  - spec/fixtures/cassette_library/LinkedIn_Client/_authorize_from_request.yml
207
202
  - spec/fixtures/cassette_library/LinkedIn_Client/_request_token.yml
208
203
  - spec/fixtures/cassette_library/LinkedIn_Client/_request_token/with_a_callback_url.yml