Codebase list ruby-omniauth-twitter / 10a8edc
Imported Upstream version 1.2.1 Praveen Arimbrathodiyil 8 years ago
4 changed file(s) with 61 addition(s) and 16 deletion(s). Raw diff Collapse all Expand all
1515 {
1616 :nickname => raw_info['screen_name'],
1717 :name => raw_info['name'],
18 :email => raw_info["email"],
1819 :location => raw_info['location'],
1920 :image => image_url,
2021 :description => raw_info['description'],
3031 end
3132
3233 def raw_info
33 @raw_info ||= JSON.load(access_token.get('/1.1/account/verify_credentials.json?include_entities=false&skip_status=true').body)
34 @raw_info ||= JSON.load(access_token.get('/1.1/account/verify_credentials.json?include_entities=false&skip_status=true&include_email=true').body)
3435 rescue ::Errno::ETIMEDOUT
3536 raise ::Timeout::Error
3637 end
00 module OmniAuth
11 module Twitter
2 VERSION = "1.2.0"
2 VERSION = "1.2.1"
33 end
44 end
00 --- !ruby/object:Gem::Specification
11 name: omniauth-twitter
22 version: !ruby/object:Gem::Version
3 version: 1.2.0
3 version: 1.2.1
44 platform: ruby
55 authors:
66 - Arun Agrawal
77 autorequire:
88 bindir: bin
99 cert_chain: []
10 date: 2015-04-22 00:00:00.000000000 Z
10 date: 2015-07-29 00:00:00.000000000 Z
1111 dependencies:
1212 - !ruby/object:Gem::Dependency
1313 name: json
1414 requirement: !ruby/object:Gem::Requirement
1515 requirements:
16 - - ~>
16 - - "~>"
1717 - !ruby/object:Gem::Version
1818 version: '1.3'
1919 type: :runtime
2020 prerelease: false
2121 version_requirements: !ruby/object:Gem::Requirement
2222 requirements:
23 - - ~>
23 - - "~>"
2424 - !ruby/object:Gem::Version
2525 version: '1.3'
2626 - !ruby/object:Gem::Dependency
2727 name: omniauth-oauth
2828 requirement: !ruby/object:Gem::Requirement
2929 requirements:
30 - - ~>
30 - - "~>"
3131 - !ruby/object:Gem::Version
3232 version: '1.1'
3333 type: :runtime
3434 prerelease: false
3535 version_requirements: !ruby/object:Gem::Requirement
3636 requirements:
37 - - ~>
37 - - "~>"
3838 - !ruby/object:Gem::Version
3939 version: '1.1'
4040 - !ruby/object:Gem::Dependency
4141 name: bundler
4242 requirement: !ruby/object:Gem::Requirement
4343 requirements:
44 - - ~>
44 - - "~>"
4545 - !ruby/object:Gem::Version
4646 version: '1.0'
4747 type: :development
4848 prerelease: false
4949 version_requirements: !ruby/object:Gem::Requirement
5050 requirements:
51 - - ~>
51 - - "~>"
5252 - !ruby/object:Gem::Version
5353 version: '1.0'
5454 description: OmniAuth strategy for Twitter
5858 extensions: []
5959 extra_rdoc_files: []
6060 files:
61 - .gitignore
62 - .rspec
63 - .travis.yml
61 - ".gitignore"
62 - ".rspec"
63 - ".travis.yml"
6464 - CONTRIBUTING.md
6565 - Gemfile
6666 - README.md
8181 - lib
8282 required_ruby_version: !ruby/object:Gem::Requirement
8383 requirements:
84 - - '>='
84 - - ">="
8585 - !ruby/object:Gem::Version
8686 version: '0'
8787 required_rubygems_version: !ruby/object:Gem::Requirement
8888 requirements:
89 - - '>='
89 - - ">="
9090 - !ruby/object:Gem::Version
9191 version: '0'
9292 requirements: []
9393 rubyforge_project:
94 rubygems_version: 2.0.14
94 rubygems_version: 2.4.5
9595 signing_key:
9696 specification_version: 4
9797 summary: OmniAuth strategy for Twitter
2222
2323 it 'should have correct authorize url' do
2424 expect(subject.options.client_options.authorize_path).to eq('/oauth/authenticate')
25 end
26 end
27
28 describe 'info' do
29 before do
30 allow(subject).to receive(:raw_info).and_return(raw_info_hash)
31 end
32
33 it 'should returns the nickname' do
34 expect(subject.info[:nickname]).to eq(raw_info_hash['screen_name'])
35 end
36
37 it 'should returns the name' do
38 expect(subject.info[:name]).to eq(raw_info_hash['name'])
39 end
40
41 it 'should returns the email' do
42 expect(subject.info[:email]).to eq(raw_info_hash['email'])
43 end
44
45 it 'should returns the location' do
46 expect(subject.info[:location]).to eq(raw_info_hash['location'])
47 end
48
49 it 'should returns the description' do
50 expect(subject.info[:description]).to eq(raw_info_hash['description'])
51 end
52
53 it 'should returns the urls' do
54 expect(subject.info[:urls]['Website']).to eq(raw_info_hash['url'])
55 expect(subject.info[:urls]['Twitter']).to eq("https://twitter.com/#{raw_info_hash['screen_name']}")
2556 end
2657 end
2758
112143 end
113144 end
114145 end
146
147 private
148
149 def raw_info_hash
150 {
151 'screen_name' => 'foo',
152 'name' => 'Foo Bar',
153 'email' => 'foo@example.com',
154 'location' => 'India',
155 'description' => 'Developer',
156 'url' => 'example.com/foobar'
157 }
158 end