omniauth-eyeem 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in omniauth-eyeem.gemspec
4
+ gemspec
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Varek
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,81 @@
1
+ # Omniauth::EyeEm
2
+
3
+ Omniauth Strategy for [EyeEm](http://www.eyeem.com)
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'omniauth-eyeem'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install omniauth-eyeem
18
+
19
+ ## Usage
20
+
21
+ ### Sinatra Example
22
+ ```ruby
23
+
24
+ require 'sinatra'
25
+ require 'omniauth'
26
+ require 'omniauth-eyeem'
27
+ require 'json'
28
+
29
+ use Rack::Session::Cookie
30
+ use OmniAuth::Builder do
31
+ provider :eyeem, 'client_id', 'client_secret'
32
+ end
33
+
34
+ get '/auth/:provider/callback' do
35
+ # Do something with auth_hash
36
+ erb "<h1>eyeem</h1>
37
+ <pre>#{JSON.pretty_generate(auth_hash)}</pre>"
38
+ end
39
+
40
+ def auth_hash
41
+ request.env['omniauth.auth']
42
+ end
43
+
44
+ ```
45
+
46
+ ## Resources
47
+
48
+
49
+ * [EyeEm API Documentation](https://github.com/eyeem/Public-API)
50
+ * [EyeEm App Registration](http://www.eyeem.com/developers/myapps)
51
+ * [EyeEmConnector - EyeEm API Wrapper in Ruby](https://github.com/Varek/EyeEmConnector)
52
+
53
+ ## Contributing
54
+
55
+ 1. Fork it
56
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
57
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
58
+ 4. Push to the branch (`git push origin my-new-feature`)
59
+ 5. Create new Pull Request
60
+
61
+ ## Liscense
62
+ Copyright (c) 2013 André Rieck
63
+
64
+ Permission is hereby granted, free of charge, to any person obtaining
65
+ a copy of this software and associated documentation files (the
66
+ "Software"), to deal in the Software without restriction, including
67
+ without limitation the rights to use, copy, modify, merge, publish,
68
+ distribute, sublicense, and/or sell copies of the Software, and to
69
+ permit persons to whom the Software is furnished to do so, subject to
70
+ the following conditions:
71
+
72
+ The above copyright notice and this permission notice shall be
73
+ included in all copies or substantial portions of the Software.
74
+
75
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
76
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
77
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
78
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
79
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
80
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
81
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,2 @@
1
+ require "omniauth-eyeem/version"
2
+ require 'omniauth/strategies/eyeem'
@@ -0,0 +1,5 @@
1
+ module Omniauth
2
+ module EyeEm
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
@@ -0,0 +1,37 @@
1
+ require 'omniauth-oauth2'
2
+
3
+ module OmniAuth
4
+ module Strategies
5
+ class EyeEm < OmniAuth::Strategies::OAuth2
6
+ option :client_options, {
7
+ :site => 'https://www.eyeem.com/api/v2',
8
+ :authorize_url => 'http://www.eyeem.com/oauth/authorize',
9
+ :token_url => 'http://www.eyeem.com/api/v2/oauth/token'
10
+ }
11
+
12
+ option :name, "eyeem"
13
+
14
+ uid { raw_info['user']['id'] }
15
+
16
+ info do
17
+ {
18
+ :nickname => raw_info['user']['nickname'],
19
+ :name => raw_info['user']['fullname'],
20
+ :image => raw_info['user']['photoUrl'],
21
+ :description => raw_info['user']['description'],
22
+ :email => raw_info['user']['email']
23
+ }
24
+ end
25
+
26
+ extra do
27
+ { :raw_info => raw_info }
28
+ end
29
+
30
+ def raw_info
31
+ @raw_info ||= access_token.get('users/me').parsed
32
+ end
33
+ end
34
+ end
35
+ end
36
+
37
+ OmniAuth.config.add_camelization 'eyeem', 'EyeEm'
@@ -0,0 +1,26 @@
1
+ # -*- encoding: utf-8 -*-
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'omniauth-eyeem/version'
5
+
6
+ Gem::Specification.new do |gem|
7
+ gem.name = "omniauth-eyeem"
8
+ gem.version = Omniauth::EyeEm::VERSION
9
+ gem.authors = ["Varek"]
10
+ gem.email = ["4ndr3r13ck@googlemail.com"]
11
+ gem.description = "Omniauth Strategy for EyeEm"
12
+ gem.summary = "Omniauth Strategy for EyeEm"
13
+ gem.homepage = ""
14
+
15
+ gem.files = `git ls-files`.split($/)
16
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
17
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
18
+ gem.require_paths = ["lib"]
19
+
20
+
21
+ gem.add_dependency 'omniauth', '~> 1.1'
22
+ gem.add_dependency 'omniauth-oauth2', '~> 1.1'
23
+ gem.add_development_dependency "rspec", "~> 2"
24
+ gem.add_development_dependency 'rack-test'
25
+ gem.add_development_dependency 'webmock'
26
+ end
@@ -0,0 +1,29 @@
1
+ require 'spec_helper'
2
+
3
+ describe OmniAuth::Strategies::EyeEm do
4
+
5
+ subject do
6
+ OmniAuth::Strategies::EyeEm.new({})
7
+ end
8
+
9
+ context "general" do
10
+ it "should be called appnet" do
11
+ subject.options.name.should eq('eyeem')
12
+ end
13
+ end
14
+
15
+ context "endpoints" do
16
+ it "has correct site" do
17
+ subject.options.client_options.site.should eq("https://www.eyeem.com/api/v2")
18
+ end
19
+
20
+ it "has correct authorize_url" do
21
+ subject.options.client_options.authorize_url.should eq("http://www.eyeem.com/oauth/authorize")
22
+ end
23
+
24
+ it "has correct token_url" do
25
+ subject.options.client_options.token_url.should eq("http://www.eyeem.com/api/v2/oauth/token")
26
+ end
27
+ end
28
+
29
+ end
@@ -0,0 +1,13 @@
1
+ $:.unshift File.expand_path('..', __FILE__)
2
+ $:.unshift File.expand_path('../../lib', __FILE__)
3
+ require 'rspec'
4
+ require 'rack/test'
5
+ require 'webmock/rspec'
6
+ require 'omniauth'
7
+ require 'omniauth-eyeem'
8
+
9
+ RSpec.configure do |config|
10
+ config.include WebMock::API
11
+ config.include Rack::Test::Methods
12
+ config.extend OmniAuth::Test::StrategyMacros, :type => :strategy
13
+ end
metadata ADDED
@@ -0,0 +1,139 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: omniauth-eyeem
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Varek
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-04-17 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: omniauth
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: '1.1'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: '1.1'
30
+ - !ruby/object:Gem::Dependency
31
+ name: omniauth-oauth2
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ~>
36
+ - !ruby/object:Gem::Version
37
+ version: '1.1'
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: '1.1'
46
+ - !ruby/object:Gem::Dependency
47
+ name: rspec
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ~>
52
+ - !ruby/object:Gem::Version
53
+ version: '2'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: '2'
62
+ - !ruby/object:Gem::Dependency
63
+ name: rack-test
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ type: :development
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ - !ruby/object:Gem::Dependency
79
+ name: webmock
80
+ requirement: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ! '>='
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
86
+ type: :development
87
+ prerelease: false
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
94
+ description: Omniauth Strategy for EyeEm
95
+ email:
96
+ - 4ndr3r13ck@googlemail.com
97
+ executables: []
98
+ extensions: []
99
+ extra_rdoc_files: []
100
+ files:
101
+ - .gitignore
102
+ - Gemfile
103
+ - LICENSE.txt
104
+ - README.md
105
+ - Rakefile
106
+ - lib/omniauth-eyeem.rb
107
+ - lib/omniauth-eyeem/version.rb
108
+ - lib/omniauth/strategies/eyeem.rb
109
+ - omniauth-eyeem.gemspec
110
+ - spec/omniauth/strategies/eyeem_spec.rb
111
+ - spec/spec_helper.rb
112
+ homepage: ''
113
+ licenses: []
114
+ post_install_message:
115
+ rdoc_options: []
116
+ require_paths:
117
+ - lib
118
+ required_ruby_version: !ruby/object:Gem::Requirement
119
+ none: false
120
+ requirements:
121
+ - - ! '>='
122
+ - !ruby/object:Gem::Version
123
+ version: '0'
124
+ required_rubygems_version: !ruby/object:Gem::Requirement
125
+ none: false
126
+ requirements:
127
+ - - ! '>='
128
+ - !ruby/object:Gem::Version
129
+ version: '0'
130
+ requirements: []
131
+ rubyforge_project:
132
+ rubygems_version: 1.8.25
133
+ signing_key:
134
+ specification_version: 3
135
+ summary: Omniauth Strategy for EyeEm
136
+ test_files:
137
+ - spec/omniauth/strategies/eyeem_spec.rb
138
+ - spec/spec_helper.rb
139
+ has_rdoc: