omniauth-cacoo 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,5 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
5
+ coverage
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --colour
data/.travis.yml ADDED
@@ -0,0 +1,6 @@
1
+ rvm:
2
+ - 1.8.7
3
+ - 1.9.2
4
+ - 1.9.3
5
+ - ree
6
+ - jruby
data/Gemfile ADDED
@@ -0,0 +1,5 @@
1
+ source "http://rubygems.org"
2
+
3
+ gem 'rake'
4
+ # Specify your gem's dependencies in omniauth-twitter.gemspec
5
+ gemspec
data/README.md ADDED
@@ -0,0 +1,57 @@
1
+ # OmniAuth Cacoo
2
+
3
+ [Build Status](https://secure.travis-ci.org/bonsaiben/omniauth-cacoo.png)](http://travis-ci.org/bonsaiben/omniauth-cacoo)
4
+
5
+ `OmniAuth::Strategies::Cacoo` is an OmniAuth strategy for authenticating to
6
+ cacoo.com with OAuth1.
7
+
8
+ ## Installing
9
+
10
+ Add to your `Gemfile`:
11
+
12
+ ```ruby
13
+ gem 'omniauth-cacoo'
14
+ ```
15
+
16
+ Then `bundle install`.
17
+
18
+ ## Usage
19
+
20
+ To get started you will need to register an OAuth Consumer in your
21
+ cacoo.com account
22
+ [here](https://cacoo.com/profile/apps)
23
+
24
+ Here's a quick example, adding the middleware to a Rails app in
25
+ `config/initializers/omniauth.rb`:
26
+
27
+ ```ruby
28
+ Rails.application.config.middleware.use OmniAuth::Builder do
29
+ provider :cacoo, ENV['CACOO_KEY'], ENV['CACOO_SECRET']
30
+ end
31
+ ```
32
+ You can then implement your authentication as usual with OmniAuth as
33
+ shown in the excellent [Railscast
34
+ 241](http://railscasts.com/episodes/241-simple-omniauth)
35
+
36
+ ## License
37
+
38
+ Copyright (c) 2013 by Benjamin Sullivan
39
+
40
+ Permission is hereby granted, free of charge, to any person obtaining a
41
+ copy of this software and associated documentation files (the
42
+ "Software"), to deal in the Software without restriction, including
43
+ without limitation the rights to use, copy, modify, merge, publish,
44
+ distribute, sublicense, and/or sell copies of the Software, and to
45
+ permit persons to whom the Software is furnished to do so, subject to
46
+ the following conditions:
47
+
48
+ The above copyright notice and this permission notice shall be included
49
+ in all copies or substantial portions of the Software.
50
+
51
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
52
+ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
53
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
54
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
55
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
56
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
57
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ require "bundler/gem_tasks"
2
+ require 'rspec/core/rake_task'
3
+
4
+ desc "Run specs"
5
+ RSpec::Core::RakeTask.new
6
+
7
+ desc 'Default: run specs.'
8
+ task :default => :spec
@@ -0,0 +1,2 @@
1
+ require "omniauth-cacoo/version"
2
+ require 'omniauth/strategies/cacoo'
@@ -0,0 +1,5 @@
1
+ module OmniAuth
2
+ module Cacoo
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
@@ -0,0 +1,40 @@
1
+ require 'omniauth-oauth'
2
+ require 'multi_json'
3
+
4
+ module OmniAuth
5
+ module Strategies
6
+ class Cacoo < OmniAuth::Strategies::OAuth
7
+ option :name, 'cacoo'
8
+
9
+ option :client_options, {
10
+ :site => 'https://cacoo.com',
11
+ :authorize_path => '/oauth/authorize',
12
+ :access_token_path => '/oauth/access_token',
13
+ :request_token_path => '/oauth/request_token'
14
+ }
15
+
16
+ uid { raw_info['name'] }
17
+
18
+ info do
19
+ {
20
+ :name => raw_info['name'],
21
+ :nickname => raw_info['nickname'],
22
+ :image_url => raw_info['imageUrl']
23
+ }
24
+ end
25
+
26
+ extra do
27
+ {
28
+ 'raw_info' => raw_info
29
+ }
30
+ end
31
+
32
+ def raw_info
33
+ @raw_info ||= MultiJson.decode(access_token.get('/api/v1/account.json').body)
34
+ rescue ::Errno::ETIMEDOUT
35
+ raise ::Timeout::Error
36
+ end
37
+
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,26 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "omniauth-cacoo/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "omniauth-cacoo"
7
+ s.version = OmniAuth::Cacoo::VERSION
8
+ s.authors = ["Benjamin Sullivan"]
9
+ s.email = ["bsullivan2@gmail.com"]
10
+ s.homepage = "https://github.com/bonsaiben/omniauth-cacoo"
11
+ s.summary = %q{OmniAuth strategy for Cacoo}
12
+ s.description = %q{OmniAuth strategy for Cacoo}
13
+ s.license = "MIT"
14
+
15
+ s.files = `git ls-files`.split("\n")
16
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
17
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
18
+ s.require_paths = ["lib"]
19
+
20
+ s.add_dependency 'multi_json', '~> 1.3'
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,29 @@
1
+ require 'spec_helper'
2
+
3
+ describe OmniAuth::Strategies::Cacoo do
4
+ subject do
5
+ OmniAuth::Strategies::Cacoo.new({})
6
+ end
7
+
8
+ context 'client options' do
9
+ it 'should have correct name' do
10
+ expect(subject.options.name).to eq('cacoo')
11
+ end
12
+
13
+ it 'should have correct site' do
14
+ expect(subject.options.client_options.site).to eq('https://cacoo.com')
15
+ end
16
+
17
+ it 'should have correct authorize url' do
18
+ expect(subject.options.client_options.authorize_path).to eq('/oauth/authorize')
19
+ end
20
+
21
+ it 'should have correct access token url' do
22
+ expect(subject.options.client_options.access_token_path).to eq('/oauth/access_token')
23
+ end
24
+
25
+ it 'should have correct request token url' do
26
+ expect(subject.options.client_options.request_token_path).to eq('/oauth/request_token')
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,18 @@
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-cacoo'
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
+ config.expect_with :rspec do |c|
16
+ c.syntax = :expect
17
+ end
18
+ end
metadata ADDED
@@ -0,0 +1,156 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: omniauth-cacoo
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Benjamin Sullivan
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-03-10 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: multi_json
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: '1.3'
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.3'
30
+ - !ruby/object:Gem::Dependency
31
+ name: omniauth-oauth
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ~>
36
+ - !ruby/object:Gem::Version
37
+ version: '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.0'
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.7'
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.7'
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: simplecov
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
+ - !ruby/object:Gem::Dependency
95
+ name: webmock
96
+ requirement: !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ! '>='
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
+ type: :development
103
+ prerelease: false
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
110
+ description: OmniAuth strategy for Cacoo
111
+ email:
112
+ - bsullivan2@gmail.com
113
+ executables: []
114
+ extensions: []
115
+ extra_rdoc_files: []
116
+ files:
117
+ - .gitignore
118
+ - .rspec
119
+ - .travis.yml
120
+ - Gemfile
121
+ - README.md
122
+ - Rakefile
123
+ - lib/omniauth-cacoo.rb
124
+ - lib/omniauth-cacoo/version.rb
125
+ - lib/omniauth/strategies/cacoo.rb
126
+ - omniauth-cacoo.gemspec
127
+ - spec/omniauth/strategies/cacoo_spec.rb
128
+ - spec/spec_helper.rb
129
+ homepage: https://github.com/bonsaiben/omniauth-cacoo
130
+ licenses:
131
+ - MIT
132
+ post_install_message:
133
+ rdoc_options: []
134
+ require_paths:
135
+ - lib
136
+ required_ruby_version: !ruby/object:Gem::Requirement
137
+ none: false
138
+ requirements:
139
+ - - ! '>='
140
+ - !ruby/object:Gem::Version
141
+ version: '0'
142
+ required_rubygems_version: !ruby/object:Gem::Requirement
143
+ none: false
144
+ requirements:
145
+ - - ! '>='
146
+ - !ruby/object:Gem::Version
147
+ version: '0'
148
+ requirements: []
149
+ rubyforge_project:
150
+ rubygems_version: 1.8.24
151
+ signing_key:
152
+ specification_version: 3
153
+ summary: OmniAuth strategy for Cacoo
154
+ test_files:
155
+ - spec/omniauth/strategies/cacoo_spec.rb
156
+ - spec/spec_helper.rb