omniauth-imgur 0.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 893edeed61511f5d5c5af2b19fd9b50da0a0f1f7
4
+ data.tar.gz: 85f6eb546624cf1f85ef744afcf9164f73f0a919
5
+ SHA512:
6
+ metadata.gz: 5fdfe587a8007ce955604515dcb0a0b6f3d1c04750145859ed6ba15391c6748352bff31d0b90deaa2e97f6f386a4753d829518dc4b7b84156a7aa10cf1ebf85a
7
+ data.tar.gz: 210a28ccf1cccc58059e42b016bff4fbfa558347c49064436eb840dea35c6791174bd8a751786014f08dbbe2327d2e703c16af78130c0f427a5a364abd5ea148
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ /pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'http://rubygems.org'
2
+ # Specify your gem's dependencies in omniauth-instagram.gemspec
3
+ gemspec
@@ -0,0 +1,21 @@
1
+ # OmniAuth Imgur
2
+
3
+ This is the unofficial OmniAuth strategy for authenticating to Imgur. To
4
+ use it, you'll need to sign up for an OAuth2 Application ID and Secret
5
+ on the [Imgur Add Client page](https://api.imgur.com/oauth2/addclient).
6
+
7
+ ## Basic Usage
8
+
9
+ use OmniAuth::Builder do
10
+ provider :imgur, ENV['IMGUR_CLIENT_ID'], ENV['IMGUR_CLIENT_SECRET']
11
+ end
12
+
13
+ ## License
14
+
15
+ Copyright (c) 2015 Kirk Okada and Intridea, Inc.
16
+
17
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
18
+
19
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
20
+
21
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env rake
2
+ require "bundler/gem_tasks"
3
+ require 'rspec/core/rake_task'
4
+
5
+ desc 'Default: run specs.'
6
+ task :default => :spec
7
+
8
+ desc "Run specs"
9
+ RSpec::Core::RakeTask.new
10
+
11
+ desc 'Run specs'
12
+ task :default => :spec
@@ -0,0 +1,2 @@
1
+ require "omniauth-imgur/version"
2
+ require 'omniauth/strategies/imgur'
@@ -0,0 +1,5 @@
1
+ module OmniAuth
2
+ module Imgur
3
+ VERSION = "0.0.0"
4
+ end
5
+ end
@@ -0,0 +1,35 @@
1
+ require 'omniauth-oauth2'
2
+
3
+ module OmniAuth
4
+ module Strategies
5
+ class Imgur < OmniAuth::Strategies::OAuth2
6
+ option :client_options, {
7
+ :site => 'https://api.imgur.com',
8
+ :authorize_url => 'https://api.imgur.com/oauth2/authorize',
9
+ :token_url => 'https://api.imgur.com/oauth2/token'
10
+ }
11
+
12
+ def request_phase
13
+ options[:response_type] ||= 'code'
14
+ redirect client.auth_code.authorize_url(authorize_params)
15
+ end
16
+
17
+ uid { access_token.params['account_id'] }
18
+
19
+ info do
20
+ {
21
+ 'name' => raw_info['url'],
22
+ 'bio' => raw_info['bio'],
23
+ 'reputation' => raw_info['reputation'],
24
+ 'created' => raw_info['created'],
25
+ 'pro_expiration' => raw_info['pro_expiration']
26
+ }
27
+ end
28
+
29
+ def raw_info
30
+ @raw_info ||= access_token.get("/3/account/me").parsed["data"]
31
+ end
32
+
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,25 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/omniauth-imgur/version', __FILE__)
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.authors = ["Kirk Okada"]
6
+ gem.email = ["kirkokada@gmail.com"]
7
+ gem.description = %q{OmniAuth strategy for Imgur.}
8
+ gem.summary = %q{OmniAuth strategy for Imgur.}
9
+ gem.homepage = "https://github.com/kirkokada/omniauth-instagram"
10
+ gem.license = "MIT"
11
+
12
+ gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
13
+ gem.files = `git ls-files`.split("\n")
14
+ gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
15
+ gem.name = "omniauth-imgur"
16
+ gem.require_paths = ["lib"]
17
+ gem.version = OmniAuth::Imgur::VERSION
18
+
19
+ gem.add_dependency 'omniauth', '~> 1'
20
+ gem.add_dependency 'omniauth-oauth2', '~> 1'
21
+ gem.add_development_dependency 'rspec', '~> 2.12'
22
+ gem.add_development_dependency 'rack-test'
23
+ gem.add_development_dependency 'simplecov'
24
+ gem.add_development_dependency 'webmock'
25
+ end
@@ -0,0 +1,21 @@
1
+ require 'spec_helper'
2
+
3
+ describe OmniAuth::Strategies::Imgur do
4
+ context "client options" do
5
+ subject do
6
+ OmniAuth::Strategies::Imgur.new({})
7
+ end
8
+
9
+ it "should have the correct site" do
10
+ expect(subject.options.client_options.site).to eq('https://api.imgur.com')
11
+ end
12
+
13
+ it "should have the correct authorize url" do
14
+ expect(subject.options.client_options.authorize_url).to eq('https://api.imgur.com/oauth2/authorize')
15
+ end
16
+
17
+ it "should have the correct token url" do
18
+ expect(subject.options.client_options.token_url).to eq('https://api.imgur.com/oauth2/token')
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,16 @@
1
+ $:.unshift File.expand_path('..', __FILE__)
2
+ $:.unshift File.expand_path('../../lib', __FILE__)
3
+ require 'simplecov'
4
+ SimpleCov.start
5
+ require 'rspec'
6
+ require 'rack/test'
7
+ require 'webmock/rspec'
8
+ require 'omniauth'
9
+ require 'omniauth-imgur'
10
+
11
+ RSpec.configure do |config|
12
+ config.include WebMock::API
13
+ config.include Rack::Test::Methods
14
+ config.extend OmniAuth::Test::StrategyMacros, :type => :strategy
15
+ end
16
+
metadata ADDED
@@ -0,0 +1,141 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: omniauth-imgur
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Kirk Okada
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-05-21 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: omniauth
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1'
27
+ - !ruby/object:Gem::Dependency
28
+ name: omniauth-oauth2
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '2.12'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '2.12'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rack-test
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: simplecov
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: webmock
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ description: OmniAuth strategy for Imgur.
98
+ email:
99
+ - kirkokada@gmail.com
100
+ executables: []
101
+ extensions: []
102
+ extra_rdoc_files: []
103
+ files:
104
+ - ".gitignore"
105
+ - Gemfile
106
+ - README.md
107
+ - Rakefile
108
+ - lib/omniauth-imgur.rb
109
+ - lib/omniauth-imgur/version.rb
110
+ - lib/omniauth/strategies/imgur.rb
111
+ - omniauth-imgur.gemspec
112
+ - spec/omniauth/strategies/imgur_spec.rb
113
+ - spec/spec_helper.rb
114
+ homepage: https://github.com/kirkokada/omniauth-instagram
115
+ licenses:
116
+ - MIT
117
+ metadata: {}
118
+ post_install_message:
119
+ rdoc_options: []
120
+ require_paths:
121
+ - lib
122
+ required_ruby_version: !ruby/object:Gem::Requirement
123
+ requirements:
124
+ - - ">="
125
+ - !ruby/object:Gem::Version
126
+ version: '0'
127
+ required_rubygems_version: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ requirements: []
133
+ rubyforge_project:
134
+ rubygems_version: 2.4.6
135
+ signing_key:
136
+ specification_version: 4
137
+ summary: OmniAuth strategy for Imgur.
138
+ test_files:
139
+ - spec/omniauth/strategies/imgur_spec.rb
140
+ - spec/spec_helper.rb
141
+ has_rdoc: