liangzan_omniauth-trello 0.0.6

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
+ .rvmrc
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --colour
data/Gemfile ADDED
@@ -0,0 +1,5 @@
1
+ source "http://rubygems.org"
2
+
3
+
4
+ # Specify your gem's dependencies in omniauth-trello.gemspec
5
+ gemspec
data/README.md ADDED
@@ -0,0 +1,24 @@
1
+ omniauth-trello
2
+ ===============
3
+
4
+ Trello OAuth strategy for OmniAuth 1.0
5
+
6
+ # OmniAuth Trello
7
+
8
+ This gem contains the Trello strategy for OmniAuth.
9
+
10
+ Trello uses the OAuth 1.0 flow, you can read about it here: https://trello.com/docs/gettingstarted/
11
+
12
+ ## Installation
13
+
14
+ ```
15
+ gem install liangzan_omniauth-trello
16
+ ```
17
+
18
+ ## Usage
19
+
20
+ ``` ruby
21
+ use OmniAuth::Builder do
22
+ provider :github, ENV[TRELLO_KEY'], ENV[TRELLO_SECRET'], scope: 'read,write'
23
+ end
24
+ ```
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
@@ -0,0 +1,25 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "omniauth-trello/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "liangzan_omniauth-trello"
7
+ s.version = Omniauth::Trello::VERSION
8
+ s.authors = ["Dunya Kirkali", "Wong Liang Zan"]
9
+ s.email = ["dunyakirkali@gmail.com", "zan@liangzan.net"]
10
+ s.homepage = "https://github.com/liangzan/omniauth-trello"
11
+ s.summary = %q{Trello strategy for OmniAuth.}
12
+ s.description = %q{Trello strategy for OmniAuth.}
13
+
14
+ s.files = `git ls-files`.split("\n")
15
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
16
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
17
+ s.require_paths = ["lib"]
18
+
19
+ s.add_dependency 'multi_json', '~> 1.3'
20
+ s.add_runtime_dependency 'omniauth-oauth', '~> 1.0'
21
+ s.add_development_dependency 'rspec', '~> 2.7'
22
+ s.add_development_dependency 'rake'
23
+ s.add_development_dependency 'webmock'
24
+ s.add_development_dependency 'rack-test'
25
+ end
@@ -0,0 +1,54 @@
1
+ require 'omniauth-oauth'
2
+ require 'multi_json'
3
+
4
+ module OmniAuth
5
+ module Strategies
6
+ class Trello < OmniAuth::Strategies::OAuth
7
+ option :name, 'trello'
8
+
9
+ option :client_options, {
10
+ :authorize_path => '/1/OAuthAuthorizeToken',
11
+ :request_token_path => '/1/OAuthGetRequestToken',
12
+ :access_token_path => '/1/OAuthGetAccessToken',
13
+ :site => 'https://trello.com'
14
+ }
15
+
16
+ uid do
17
+ raw_info['id']
18
+ end
19
+
20
+ info do
21
+ {
22
+ :nickname => raw_info['username'],
23
+ :name => raw_info['fullName'],
24
+ :email => raw_info['email'],
25
+ :description => raw_info['description'],
26
+ :urls => {
27
+ 'Website' => raw_info['url'],
28
+ 'Trello' => 'http://trello.com/' + raw_info['username']
29
+ }
30
+ }
31
+ end
32
+
33
+ def request_phase
34
+ if request.params["scope"]
35
+ super.merge({:scope => request.params["scope"]})
36
+ else
37
+ super
38
+ end
39
+ end
40
+
41
+ extra do
42
+ {
43
+ :raw_info => raw_info
44
+ }
45
+ end
46
+
47
+ def raw_info
48
+ @raw_info ||= MultiJson.load(access_token.get('/1/members/me').body)
49
+ rescue ::Errno::ETIMEDOUT
50
+ raise ::Timeout::Error
51
+ end
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,5 @@
1
+ module Omniauth
2
+ module Trello
3
+ VERSION = "0.0.6"
4
+ end
5
+ end
@@ -0,0 +1,2 @@
1
+ require "omniauth-trello/version"
2
+ require 'omniauth/strategies/trello'
@@ -0,0 +1,31 @@
1
+ # TOTEST
2
+
3
+ require 'spec_helper'
4
+
5
+ describe OmniAuth::Strategies::Trello do
6
+ subject do
7
+ OmniAuth::Strategies::Trello.new({})
8
+ end
9
+
10
+ context "client options" do
11
+ it 'should have correct name' do
12
+ subject.options.name.should eq("trello")
13
+ end
14
+
15
+ it 'should have correct site' do
16
+ subject.options.client_options.site.should eq('https://trello.com')
17
+ end
18
+
19
+ it 'should have correct request token path' do
20
+ subject.options.client_options.request_token_path.should eq('/1/OAuthGetRequestToken')
21
+ end
22
+
23
+ it 'should have correct authorize path' do
24
+ subject.options.client_options.authorize_path.should eq('/1/OAuthAuthorizeToken')
25
+ end
26
+
27
+ it 'should have correct access token url' do
28
+ subject.options.client_options.access_token_path.should eq('/1/OAuthGetAccessToken')
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,10 @@
1
+ require 'rubygems'
2
+ require 'bundler'
3
+ Bundler.setup :default, :development, :test
4
+
5
+ require 'rack/test'
6
+ require 'omniauth-trello'
7
+
8
+ RSpec.configure do |config|
9
+ config.include Rack::Test::Methods
10
+ end
metadata ADDED
@@ -0,0 +1,156 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: liangzan_omniauth-trello
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.6
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Dunya Kirkali
9
+ - Wong Liang Zan
10
+ autorequire:
11
+ bindir: bin
12
+ cert_chain: []
13
+ date: 2012-12-18 00:00:00.000000000 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: multi_json
17
+ requirement: !ruby/object:Gem::Requirement
18
+ none: false
19
+ requirements:
20
+ - - ~>
21
+ - !ruby/object:Gem::Version
22
+ version: '1.3'
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ none: false
27
+ requirements:
28
+ - - ~>
29
+ - !ruby/object:Gem::Version
30
+ version: '1.3'
31
+ - !ruby/object:Gem::Dependency
32
+ name: omniauth-oauth
33
+ requirement: !ruby/object:Gem::Requirement
34
+ none: false
35
+ requirements:
36
+ - - ~>
37
+ - !ruby/object:Gem::Version
38
+ version: '1.0'
39
+ type: :runtime
40
+ prerelease: false
41
+ version_requirements: !ruby/object:Gem::Requirement
42
+ none: false
43
+ requirements:
44
+ - - ~>
45
+ - !ruby/object:Gem::Version
46
+ version: '1.0'
47
+ - !ruby/object:Gem::Dependency
48
+ name: rspec
49
+ requirement: !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: '2.7'
55
+ type: :development
56
+ prerelease: false
57
+ version_requirements: !ruby/object:Gem::Requirement
58
+ none: false
59
+ requirements:
60
+ - - ~>
61
+ - !ruby/object:Gem::Version
62
+ version: '2.7'
63
+ - !ruby/object:Gem::Dependency
64
+ name: rake
65
+ requirement: !ruby/object:Gem::Requirement
66
+ none: false
67
+ requirements:
68
+ - - ! '>='
69
+ - !ruby/object:Gem::Version
70
+ version: '0'
71
+ type: :development
72
+ prerelease: false
73
+ version_requirements: !ruby/object:Gem::Requirement
74
+ none: false
75
+ requirements:
76
+ - - ! '>='
77
+ - !ruby/object:Gem::Version
78
+ version: '0'
79
+ - !ruby/object:Gem::Dependency
80
+ name: webmock
81
+ requirement: !ruby/object:Gem::Requirement
82
+ none: false
83
+ requirements:
84
+ - - ! '>='
85
+ - !ruby/object:Gem::Version
86
+ version: '0'
87
+ type: :development
88
+ prerelease: false
89
+ version_requirements: !ruby/object:Gem::Requirement
90
+ none: false
91
+ requirements:
92
+ - - ! '>='
93
+ - !ruby/object:Gem::Version
94
+ version: '0'
95
+ - !ruby/object:Gem::Dependency
96
+ name: rack-test
97
+ requirement: !ruby/object:Gem::Requirement
98
+ none: false
99
+ requirements:
100
+ - - ! '>='
101
+ - !ruby/object:Gem::Version
102
+ version: '0'
103
+ type: :development
104
+ prerelease: false
105
+ version_requirements: !ruby/object:Gem::Requirement
106
+ none: false
107
+ requirements:
108
+ - - ! '>='
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ description: Trello strategy for OmniAuth.
112
+ email:
113
+ - dunyakirkali@gmail.com
114
+ - zan@liangzan.net
115
+ executables: []
116
+ extensions: []
117
+ extra_rdoc_files: []
118
+ files:
119
+ - .gitignore
120
+ - .rspec
121
+ - Gemfile
122
+ - README.md
123
+ - Rakefile
124
+ - liangzan_omniauth-trello.gemspec
125
+ - lib/omniauth-trello.rb
126
+ - lib/omniauth-trello/version.rb
127
+ - lib/omniauth/strategies/trello.rb
128
+ - spec/omniauth/strategies/trello_spec.rb
129
+ - spec/spec_helper.rb
130
+ homepage: https://github.com/liangzan/omniauth-trello
131
+ licenses: []
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: Trello strategy for OmniAuth.
154
+ test_files:
155
+ - spec/omniauth/strategies/trello_spec.rb
156
+ - spec/spec_helper.rb