Skip to content

Commit

Permalink
Revert "Merge pull request decioferreira#46 from gabrielgaraujo/add-c…
Browse files Browse the repository at this point in the history
…ountry-and-preferred-language-fields"

This reverts commit fe10f04, reversing
changes made to 629a8ed.
  • Loading branch information
decioferreira committed Jan 12, 2024
1 parent c093dae commit 11b6bc4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 20 deletions.
8 changes: 7 additions & 1 deletion lib/omniauth/strategies/linkedin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,20 @@ def fields
end

def localized_field field_name
raw_info.dig(*[field_name, 'localized', field_locale(field_name)])
return unless localized_field_available? field_name

raw_info[field_name]['localized'][field_locale(field_name)]
end

def field_locale field_name
"#{ raw_info[field_name]['preferredLocale']['language'] }_" \
"#{ raw_info[field_name]['preferredLocale']['country'] }"
end

def localized_field_available? field_name
raw_info[field_name] && raw_info[field_name]['localized']
end

def picture_url
return unless picture_available?

Expand Down
19 changes: 0 additions & 19 deletions spec/omniauth/strategies/linkedin_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -110,23 +110,4 @@
end
end
end

describe '#localized_field' do
let(:raw_info) do
{
'foo' => {
'preferredLocale' => {
'language' => 'bar',
'country' => 'BAZ'
}
}
}
end

before :each do
allow(subject).to receive(:raw_info).and_return raw_info
end

specify { expect(subject.send(:field_locale,'foo')).to eq 'bar_BAZ' }
end
end

0 comments on commit 11b6bc4

Please sign in to comment.