omniauth-mybigcampus 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,2 @@
1
+ .DS_Store
2
+ omniauth-mybigcampus-0.0.1.gem
data/Gemfile ADDED
@@ -0,0 +1,5 @@
1
+ source "http://rubygems.org"
2
+
3
+ gem 'rake'
4
+ # Specify your gem's dependencies in omniauth-mybigcampus.gemspec
5
+ gemspec
@@ -0,0 +1,45 @@
1
+ # OmniAuth for My Big Campus
2
+
3
+ This gem contains the My Big Campus strategy for OmniAuth.
4
+
5
+ My Big Campus uses the OAuth 2.0 flow.
6
+
7
+ ## How To Use It
8
+
9
+ Usage is as per any other OmniAuth 2.0 strategy. If you are using Rails, you need to add the strategy to your `Gemfile`:
10
+
11
+ gem 'omniauth-mybigcampus'
12
+
13
+ You can pull it directly from github via:
14
+
15
+ gem 'omniauth-mybigcampus', :git => 'https://github.com/ryanbond/omniauth-mybigcampus.git'
16
+
17
+ Once these are in, you need to add the following to your `config/initializers/omniauth.rb`:
18
+
19
+ Rails.application.config.middleware.use OmniAuth::Builder do
20
+ provider :mybigcampus, "consumer_key", "consumer_secret"
21
+ end
22
+
23
+ Now just follow the README at: https://github.com/intridea/omniauth
24
+
25
+ ## Supported Rubies
26
+
27
+ OmniAuth for My Big Campus is tested under 1.8.7, 1.9.2, 1.9.3 and Ruby Enterprise Edition.
28
+
29
+ ## Note on Patches/Pull Requests
30
+
31
+ - Fork the project.
32
+ - Make your feature addition or bug fix.
33
+ - Add tests for it. This is important so I don’t break it in a future version unintentionally.
34
+ - Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
35
+ - Send me a pull request. Bonus points for topic branches.
36
+
37
+ ## License
38
+
39
+ Copyright (c) 2012 by Ryan Bond
40
+
41
+ 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:
42
+
43
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
44
+
45
+ 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,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-mybigcampus/version"
2
+ require 'omniauth/strategies/mybigcampus'
@@ -0,0 +1,5 @@
1
+ module Omniauth
2
+ module Mybigcampus
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
@@ -0,0 +1,36 @@
1
+ require 'omniauth-oauth'
2
+ require 'multi_json'
3
+
4
+ module OmniAuth
5
+ module Strategies
6
+ class Mybigcampus < OmniAuth::Strategies::OAuth2
7
+ option :name, :mybigcampus
8
+ option :client_options, {:authorize_path => '/oauth/authorize',
9
+ :site => 'http://www.mybigcampus.com'}
10
+
11
+ uid { raw_info["id"] }
12
+
13
+ info do
14
+ {
15
+ :name => raw_info['full_name'],
16
+ :nickname => raw_info['screen_name'],
17
+ :first_name => raw_info['first_name'],
18
+ :last_name => raw_info['last_name'],
19
+ :email => raw_info['email'],
20
+ :user_type => raw_info['user_type'],
21
+ :urls => {
22
+ :profile => "http://www.mybigcampus.com/users/#{raw_info['screen_name']}",
23
+ :image => "http://www.mybigcampus.com#{raw_info['photo_url_thumb']}"
24
+ }
25
+ }
26
+ end
27
+
28
+ def raw_info
29
+ @raw_info ||= access_token.get('/api/v1/credentials/verify.json').parsed
30
+ rescue ::Errno::ETIMEDOUT
31
+ raise ::Timeout::Error
32
+ end
33
+
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,26 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "omniauth-mybigcampus/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "omniauth-mybigcampus"
7
+ s.version = Omniauth::Mybigcampus::VERSION
8
+ s.authors = ["Ryan Bond"]
9
+ s.email = ["ryan@lightspeedsystems.com"]
10
+ s.homepage = "https://github.com/ryanbond/omniauth-mybigcampus"
11
+ s.summary = %q{OmniAuth strategy for My Big Campus}
12
+ s.description = %q{OmniAuth strategy for My Big Campus}
13
+
14
+ s.rubyforge_project = "omniauth-mybigcampus"
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,7 @@
1
+ require 'spec_helper'
2
+
3
+ describe OmniAuth::Strategies::Mybigcampus do
4
+ it 'should do some testing' do
5
+ pending
6
+ end
7
+ 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-mybigcampus'
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,112 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: omniauth-mybigcampus
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Ryan Bond
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-03-27 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: omniauth-oauth
16
+ requirement: &70293213447740 !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: *70293213447740
25
+ - !ruby/object:Gem::Dependency
26
+ name: rspec
27
+ requirement: &70293213446440 !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: *70293213446440
36
+ - !ruby/object:Gem::Dependency
37
+ name: rack-test
38
+ requirement: &70293213445720 !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: *70293213445720
47
+ - !ruby/object:Gem::Dependency
48
+ name: simplecov
49
+ requirement: &70293213444780 !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: *70293213444780
58
+ - !ruby/object:Gem::Dependency
59
+ name: webmock
60
+ requirement: &70293213421000 !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: *70293213421000
69
+ description: OmniAuth strategy for My Big Campus
70
+ email:
71
+ - ryan@lightspeedsystems.com
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - .gitignore
77
+ - Gemfile
78
+ - README.md
79
+ - Rakefile
80
+ - lib/omniauth-mybigcampus.rb
81
+ - lib/omniauth-mybigcampus/version.rb
82
+ - lib/omniauth/strategies/mybigcampus.rb
83
+ - omniauth-mybigcampus.gemspec
84
+ - spec/omniauth/strategies/mybigcampus_spec.rb
85
+ - spec/spec_helper.rb
86
+ homepage: https://github.com/ryanbond/omniauth-mybigcampus
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-mybigcampus
106
+ rubygems_version: 1.8.17
107
+ signing_key:
108
+ specification_version: 3
109
+ summary: OmniAuth strategy for My Big Campus
110
+ test_files:
111
+ - spec/omniauth/strategies/mybigcampus_spec.rb
112
+ - spec/spec_helper.rb