omniauth-storenvy 0.1.0

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,36 @@
1
+ i*.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
18
+ testapp/
19
+ .rvmrc
20
+ .DS_Store
21
+ *.rbc
22
+ *.sassc
23
+ .sass-cache
24
+ capybara-*.html
25
+ .rspec
26
+ /.bundle
27
+ /vendor/bundle
28
+ /log/*
29
+ /tmp/*
30
+ /db/*.sqlite3
31
+ /public/system/*
32
+ /coverage/
33
+ /spec/tmp/*
34
+ **.orig
35
+ rerun.txt
36
+ pickle-email-*.html
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in omniauth-storenvy.gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2012 Jeff Mehlhoff
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,4 @@
1
+ storenvy-omniauth
2
+ =================
3
+
4
+ An omni-auth strategy for the Storenvy API. More info at http://developers.storenvy.com
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env rake
2
+ require "bundler/gem_tasks"
@@ -0,0 +1,39 @@
1
+ # Credit this mini-app to: https://github.com/zquestz/omniauth-google-oauth2
2
+ # Make sure to setup the ENV variables STORENVY_KEY and STORENVY_SECRET
3
+ # bundle exec rackup
4
+
5
+ require 'rubygems'
6
+ require 'bundler'
7
+ require 'sinatra'
8
+ require 'omniauth'
9
+ require 'omniauth-storenvy'
10
+
11
+ OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE
12
+
13
+ class App < Sinatra::Base
14
+ get '/' do
15
+ <<-HTML
16
+ <ul>
17
+ <li><a href='/auth/storenvy'>Sign in with Storenvy</a></li>
18
+ </ul>
19
+ HTML
20
+ end
21
+
22
+ get '/auth/:provider/callback' do
23
+ content_type 'text/plain'
24
+ request.env['omniauth.auth'].to_hash.inspect rescue "No Data"
25
+ end
26
+
27
+ get '/auth/failure' do
28
+ content_type 'text/plain'
29
+ request.env['omniauth.auth'].to_hash.inspect rescue "No Data"
30
+ end
31
+ end
32
+
33
+ use Rack::Session::Cookie, :secret => ENV['RACK_COOKIE_SECRET']
34
+
35
+ use OmniAuth::Builder do
36
+ provider :storenvy, ENV['STORENVY_KEY'], ENV['STORENVY_SECRET'] #, :scope => 'store_write store_read user'
37
+ end
38
+
39
+ run App.new
@@ -0,0 +1,3 @@
1
+ Rails.application.config.middleware.use OmniAuth::Builder do
2
+ provider :storenvy, ENV['STORENVY_KEY'], ENV['STORENVY_SECRET'] #, :scope => 'store_write user store_read'
3
+ end
@@ -0,0 +1,2 @@
1
+ require "omniauth-storenvy/version"
2
+ require "omniauth/strategies/storenvy"
@@ -0,0 +1,5 @@
1
+ module Omniauth
2
+ module Storenvy
3
+ VERSION = "0.1.0"
4
+ end
5
+ end
@@ -0,0 +1,33 @@
1
+ require 'omniauth-oauth2'
2
+
3
+ module OmniAuth
4
+ module Strategies
5
+ class Storenvy < OmniAuth::Strategies::OAuth2
6
+ option :name, "storenvy"
7
+ option :authorize_options, [:scope]
8
+ option :client_options, {
9
+ :site => "https://api.storenvy.com",
10
+ :authorize_url => "https://www.storenvy.com/oauth/authorize"
11
+ }
12
+
13
+ uid do
14
+ raw_info["id"]
15
+ end
16
+
17
+ info do
18
+ {
19
+ id: raw_info["id"],
20
+ email: raw_info["email"],
21
+ login: raw_info["login"],
22
+ bio: raw_info["bio"],
23
+ location: raw_info["location"],
24
+ gender: raw_info["gender"]
25
+ }
26
+ end
27
+
28
+ def raw_info
29
+ @raw_info ||= access_token.get('/v1/me.json').parsed["data"]
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,22 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/omniauth-storenvy/version', __FILE__)
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.authors = ["Storenvy"]
6
+ gem.email = ["Storenvy"]
7
+ gem.description = %q{Storenvy is the world's easiest online store platform and a social shopping marketplace. This Omniauth strategy connects to Storenvy OAuth 2 API.}
8
+ gem.summary = %q{Omniauth strategy for Storenvy}
9
+ gem.homepage = "http://github.com/Storenvy/omniauth-storenvy"
10
+
11
+ gem.files = `git ls-files`.split($\)
12
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
13
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
14
+ gem.name = "omniauth-storenvy"
15
+ gem.require_paths = ["lib"]
16
+ gem.version = Omniauth::Storenvy::VERSION
17
+
18
+ gem.add_dependency 'omniauth', '~> 1.0'
19
+ gem.add_dependency 'omniauth-oauth2', '~> 1.1.0'
20
+ gem.add_dependency 'multi_json'
21
+
22
+ end
metadata ADDED
@@ -0,0 +1,105 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: omniauth-storenvy
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Storenvy
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-08-03 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.0'
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.0'
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.0
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.0
46
+ - !ruby/object:Gem::Dependency
47
+ name: multi_json
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :runtime
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ description: Storenvy is the world's easiest online store platform and a social shopping
63
+ marketplace. This Omniauth strategy connects to Storenvy OAuth 2 API.
64
+ email:
65
+ - Storenvy
66
+ executables: []
67
+ extensions: []
68
+ extra_rdoc_files: []
69
+ files:
70
+ - .gitignore
71
+ - Gemfile
72
+ - LICENSE
73
+ - README.md
74
+ - Rakefile
75
+ - examples/config.ru
76
+ - examples/omniauth.rb
77
+ - lib/omniauth-storenvy.rb
78
+ - lib/omniauth-storenvy/version.rb
79
+ - lib/omniauth/strategies/storenvy.rb
80
+ - omniauth-storenvy.gemspec
81
+ homepage: http://github.com/Storenvy/omniauth-storenvy
82
+ licenses: []
83
+ post_install_message:
84
+ rdoc_options: []
85
+ require_paths:
86
+ - lib
87
+ required_ruby_version: !ruby/object:Gem::Requirement
88
+ none: false
89
+ requirements:
90
+ - - ! '>='
91
+ - !ruby/object:Gem::Version
92
+ version: '0'
93
+ required_rubygems_version: !ruby/object:Gem::Requirement
94
+ none: false
95
+ requirements:
96
+ - - ! '>='
97
+ - !ruby/object:Gem::Version
98
+ version: '0'
99
+ requirements: []
100
+ rubyforge_project:
101
+ rubygems_version: 1.8.24
102
+ signing_key:
103
+ specification_version: 3
104
+ summary: Omniauth strategy for Storenvy
105
+ test_files: []