omniauth-youroom 0.0.2

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.
data/.gitignore ADDED
@@ -0,0 +1,5 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
5
+ coverage
data/Gemfile ADDED
@@ -0,0 +1,5 @@
1
+ source "http://rubygems.org"
2
+
3
+ gem 'rake'
4
+ # Specify your gem's dependencies in omniauth-youroom.gemspec
5
+ gemspec
data/README.md ADDED
@@ -0,0 +1,39 @@
1
+ # Notice
2
+
3
+ This gem is incomplete.
4
+
5
+ # OmniAuth youRoom
6
+
7
+ This gem contains the youRoom strategy for OmniAuth.
8
+
9
+ You can read about it here: http://apidoc.youroom.in/
10
+
11
+ ## How To Use It
12
+
13
+ Usage is as per any other OmniAuth 1.0 strategy. So let's say you're using Rails, you need to add the strategy to your `Gemfile`:
14
+
15
+ gem 'omniauth-youroom'
16
+
17
+ You can pull them in directly from github e.g.:
18
+
19
+ gem 'omniauth-youroom', :git => 'https://github.com/shiraco/omniauth-youroom.git'
20
+
21
+ Once these are in, you need to add the following to your `config/initializers/omniauth.rb`:
22
+
23
+ Rails.application.config.middleware.use OmniAuth::Builder do
24
+ provider :youroom, "consumer_key", "consumer_secret"
25
+ end
26
+
27
+ You will obviously have to put in your key and secret, which you get when you register your app with Twitter (they call them API Key and Secret Key).
28
+
29
+ Now just follow the README at: https://github.com/intridea/omniauth
30
+
31
+ ## License
32
+
33
+ Copyright (c) 2012 by shiraco
34
+
35
+ 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:
36
+
37
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
38
+
39
+ 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.
data/Rakefile ADDED
@@ -0,0 +1,11 @@
1
+ require "bundler/gem_tasks"
2
+ require 'rspec/core/rake_task'
3
+
4
+ desc 'Default: run specs.'
5
+ task :default => :spec
6
+
7
+ desc "Run specs"
8
+ RSpec::Core::RakeTask.new
9
+
10
+ desc 'Run specs'
11
+ task :default => :spec
@@ -0,0 +1,2 @@
1
+ require "omniauth-youroom/version"
2
+ require 'omniauth/strategies/youroom'
@@ -0,0 +1,5 @@
1
+ module Omniauth
2
+ module Youroom
3
+ VERSION = "0.0.2"
4
+ end
5
+ end
@@ -0,0 +1,35 @@
1
+ require 'omniauth-oauth'
2
+ require 'multi_json'
3
+
4
+ module OmniAuth
5
+ module Strategies
6
+ class Youroom < OmniAuth::Strategies::OAuth
7
+ option :name, 'youroom'
8
+ option :client_options, {:site => 'https://www.youroom.in',
9
+ :authorize_path => '/oauth/authorize',
10
+ :request_token_path => '/oauth/request_token',
11
+ :access_token_path => '/oauth/access_token'}
12
+
13
+ uid { raw_info['user']['email'] }
14
+
15
+ info do
16
+ {
17
+ :name => raw_info['user']['email'],
18
+ :email => raw_info['user']['email'],
19
+ :participations => raw_info['user']['participations']
20
+ }
21
+ end
22
+
23
+ extra do
24
+ { :raw_info => raw_info }
25
+ end
26
+
27
+ def raw_info
28
+ @raw_info ||= MultiJson.load(access_token.get('/verify_credentials.json').body)
29
+ rescue ::Errno::ETIMEDOUT
30
+ raise ::Timeout::Error
31
+ end
32
+
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,26 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "omniauth-youroom/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "omniauth-youroom"
7
+ s.version = Omniauth::Youroom::VERSION
8
+ s.authors = ["Koji Shiraishi"]
9
+ s.email = ["shiraco@gmail.com"]
10
+ s.homepage = "https://github.com/shiraco/omniauth-youroom"
11
+ s.summary = %q{OmniAuth strategy for youRoom}
12
+ s.description = %q{OmniAuth strategy for youRoom}
13
+
14
+ s.rubyforge_project = "omniauth-youroom"
15
+
16
+ s.files = `git ls-files`.split("\n")
17
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
+ s.require_paths = ["lib"]
20
+
21
+ s.add_runtime_dependency 'omniauth-oauth', '~> 1.0'
22
+ s.add_development_dependency 'rspec', '~> 2.7'
23
+ s.add_development_dependency 'rack-test'
24
+ s.add_development_dependency 'simplecov'
25
+ s.add_development_dependency 'webmock'
26
+ end
@@ -0,0 +1,21 @@
1
+ require 'spec_helper'
2
+
3
+ describe OmniAuth::Strategies::Youroom do
4
+ subject do
5
+ OmniAuth::Strategies::Youroom.new({})
6
+ end
7
+
8
+ context "client options" do
9
+ it 'should have correct name' do
10
+ subject.options.name.should eq("youroom")
11
+ end
12
+
13
+ it 'should have correct site' do
14
+ subject.options.client_options.site.should eq('https://www.youroom.in')
15
+ end
16
+
17
+ it 'should have correct authorize url' do
18
+ subject.options.client_options.authorize_path.should eq('/oauth/authorize')
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,15 @@
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-youroom'
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
metadata ADDED
@@ -0,0 +1,112 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: omniauth-youroom
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Koji Shiraishi
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-04-30 00:00:00.000000000Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: omniauth-oauth
16
+ requirement: &70308314463600 !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: *70308314463600
25
+ - !ruby/object:Gem::Dependency
26
+ name: rspec
27
+ requirement: &70308314463020 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ~>
31
+ - !ruby/object:Gem::Version
32
+ version: '2.7'
33
+ type: :development
34
+ prerelease: false
35
+ version_requirements: *70308314463020
36
+ - !ruby/object:Gem::Dependency
37
+ name: rack-test
38
+ requirement: &70308314462380 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
44
+ type: :development
45
+ prerelease: false
46
+ version_requirements: *70308314462380
47
+ - !ruby/object:Gem::Dependency
48
+ name: simplecov
49
+ requirement: &70308314461600 !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ type: :development
56
+ prerelease: false
57
+ version_requirements: *70308314461600
58
+ - !ruby/object:Gem::Dependency
59
+ name: webmock
60
+ requirement: &70308314461000 !ruby/object:Gem::Requirement
61
+ none: false
62
+ requirements:
63
+ - - ! '>='
64
+ - !ruby/object:Gem::Version
65
+ version: '0'
66
+ type: :development
67
+ prerelease: false
68
+ version_requirements: *70308314461000
69
+ description: OmniAuth strategy for youRoom
70
+ email:
71
+ - shiraco@gmail.com
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - .gitignore
77
+ - Gemfile
78
+ - README.md
79
+ - Rakefile
80
+ - lib/omniauth-youroom.rb
81
+ - lib/omniauth-youroom/version.rb
82
+ - lib/omniauth/strategies/youroom.rb
83
+ - omniauth-youroom.gemspec
84
+ - spec/omniauth/strategies/youroom_spec.rb
85
+ - spec/spec_helper.rb
86
+ homepage: https://github.com/shiraco/omniauth-youroom
87
+ licenses: []
88
+ post_install_message:
89
+ rdoc_options: []
90
+ require_paths:
91
+ - lib
92
+ required_ruby_version: !ruby/object:Gem::Requirement
93
+ none: false
94
+ requirements:
95
+ - - ! '>='
96
+ - !ruby/object:Gem::Version
97
+ version: '0'
98
+ required_rubygems_version: !ruby/object:Gem::Requirement
99
+ none: false
100
+ requirements:
101
+ - - ! '>='
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ requirements: []
105
+ rubyforge_project: omniauth-youroom
106
+ rubygems_version: 1.8.10
107
+ signing_key:
108
+ specification_version: 3
109
+ summary: OmniAuth strategy for youRoom
110
+ test_files:
111
+ - spec/omniauth/strategies/youroom_spec.rb
112
+ - spec/spec_helper.rb