Skip to content

Commit dfafa5e

Browse files
j4rspjg
authored andcommitted
Remove unecessary options fields
1 parent f31c69d commit dfafa5e

File tree

3 files changed

+6
-36
lines changed

3 files changed

+6
-36
lines changed

README.md

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -71,14 +71,10 @@ provider :linkedin, ENV['LINKEDIN_KEY'], ENV['LINKEDIN_SECRET'], :fields => ['id
7171

7272
To see a complete list of available fields, consult the LinkedIn documentation at: https://developer.linkedin.com/documents/profile-fields
7373

74-
## Other Options
75-
76-
* `secure_image_url` - Set to `true` to use https for the profile picture url. Default is `false`.
77-
7874
## Contributing
7975

80-
1. Fork it
81-
2. Create your feature branch (`git checkout -b my-new-feature`)
82-
3. Commit your changes (`git commit -am 'Add some feature'`)
83-
4. Push to the branch (`git push origin my-new-feature`)
84-
5. Create new Pull Request
76+
1. Fork it
77+
2. Create your feature branch (`git checkout -b my-new-feature`)
78+
3. Commit your changes (`git commit -am 'Add some feature'`)
79+
4. Push to the branch (`git push origin my-new-feature`)
80+
5. Create new Pull Request

lib/omniauth/strategies/linkedin.rb

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -60,17 +60,11 @@ def access_token
6060
end
6161

6262
def raw_info
63-
@raw_info ||= access_token.get("/v1/people/~:(#{option_fields.join(',')})?format=json").parsed
63+
@raw_info ||= access_token.get("/v1/people/~:(#{fields.join(',')})?format=json").parsed
6464
end
6565

6666
private
6767

68-
def option_fields
69-
fields = options.fields
70-
fields.map! { |f| f == "picture-url" ? "picture-url;secure=true" : f } if !!options[:secure_image_url]
71-
fields
72-
end
73-
7468
def user_name
7569
name = "#{raw_info['firstName']} #{raw_info['lastName']}".strip
7670
name.empty? ? nil : name

spec/omniauth/strategies/linkedin_spec.rb

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@
7979
response = double('response', :parsed => { :foo => 'bar' })
8080
expect(access_token).to receive(:get).with("/v1/people/~:(baz,qux)?format=json").and_return(response)
8181

82-
allow(subject).to receive(:option_fields) { ['baz', 'qux'] }
8382
allow(subject).to receive(:access_token) { access_token }
8483
end
8584

@@ -99,23 +98,4 @@
9998
end
10099
end
101100
end
102-
103-
describe '#option_fields' do
104-
it 'returns options fields' do
105-
subject.stub(:options => double('options', :fields => ['foo', 'bar']).as_null_object)
106-
expect(subject.send(:option_fields)).to eq(['foo', 'bar'])
107-
end
108-
109-
it 'http avatar image by default' do
110-
subject.stub(:options => double('options', :fields => ['picture-url']))
111-
allow(subject.options).to receive(:[]).with(:secure_image_url).and_return(false)
112-
expect(subject.send(:option_fields)).to eq(['picture-url'])
113-
end
114-
115-
it 'https avatar image if secure_image_url truthy' do
116-
subject.stub(:options => double('options', :fields => ['picture-url']))
117-
allow(subject.options).to receive(:[]).with(:secure_image_url).and_return(true)
118-
expect(subject.send(:option_fields)).to eq(['picture-url;secure=true'])
119-
end
120-
end
121101
end

0 commit comments

Comments
 (0)