omniauth-delivery-food 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.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +33 -0
- data/Rakefile +1 -0
- data/lib/omniauth/delivery/food.rb +2 -0
- data/lib/omniauth/delivery/version.rb +5 -0
- data/lib/omniauth/strategies/delivery.rb +42 -0
- data/omniauth-delivery.gemspec +26 -0
- data/spec/omniauth/strategies/omniauth_spec.rb +40 -0
- data/spec/spec_helper.rb +8 -0
- metadata +128 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 3f5645c8b3091147acc51c13533b369c6378a99f
|
4
|
+
data.tar.gz: 5fb4f1a015b5882c0e72c21850d0bdb1ea8866d5
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 9bb8f8f388e178d918c26f700921e9e4dfdfee9cc84dbe7908fd7ebd74e6af5ad8a0339f2fed173576befd54f2026036c5f1da0b6cf88dc50f04af49bf660722
|
7
|
+
data.tar.gz: aea24592a7174a2b0904169444035a1c3acf9737d84d5b9c19d1ce6be95c78206507391defad4b7d717f0935a588a5de15e54e9f56c741e94cc4c3692b6a3c46
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Isaac Rosenberg
|
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.
|
data/README.md
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
# Omniauth Delivery
|
2
|
+
|
3
|
+
This is a Omniauth strategy for Delivery.com. I know that there is another omniauth strategy, except that it doesn't work (as of 3/4/14 getting the raw_info throws a ssl error), and I believe this is more organized. Nicer commits, more instructions, etc. Nicer person too :)
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'omniauth-delivery-food'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install omniauth-delivery-food
|
18
|
+
|
19
|
+
## Notes
|
20
|
+
|
21
|
+
So as far as I can tell, there is no clear-cut way of getting info about a user. So what is returned as the `name` and `uid` is just the token. I've tried hitting the Laundry API endpoint and it throws an SSL error. If anyone knows how to fix that, make a pull request fixing it.
|
22
|
+
|
23
|
+
I know that there is a sandboxed version of Delivery, but I haven't used it, so I didn't include it this time around. Feel free to make a pull request adding that in.
|
24
|
+
|
25
|
+
Delivery.com requires a client key and a secret key, which can be obtained by [signing up](http://developers.delivery.com/sign-up/).
|
26
|
+
|
27
|
+
## Contributing
|
28
|
+
|
29
|
+
1. Fork it
|
30
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
31
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
32
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
33
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require "omniauth-oauth2"
|
2
|
+
|
3
|
+
module OmniAuth
|
4
|
+
module Strategies
|
5
|
+
class Delivery < OmniAuth::Strategies::OAuth2
|
6
|
+
option :name, 'delivery'
|
7
|
+
|
8
|
+
# option :fields, [:name, :email]
|
9
|
+
|
10
|
+
option :client_options, {
|
11
|
+
:site => "https://api.delivery.com",
|
12
|
+
:authorize_url => "https://api.delivery.com/third_party/authorize",
|
13
|
+
:token_url => "https://api.delivery.com/third_party/access_token"
|
14
|
+
}
|
15
|
+
|
16
|
+
option :authorize_params, {
|
17
|
+
:scope => 'global'
|
18
|
+
}
|
19
|
+
|
20
|
+
uid { credentials['token'] }
|
21
|
+
|
22
|
+
info do
|
23
|
+
{
|
24
|
+
:name => raw_info['token']
|
25
|
+
}
|
26
|
+
end
|
27
|
+
|
28
|
+
def request_phase
|
29
|
+
super
|
30
|
+
end
|
31
|
+
|
32
|
+
def build_access_token
|
33
|
+
super
|
34
|
+
end
|
35
|
+
|
36
|
+
def raw_info
|
37
|
+
@raw_info ||= credentials
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'omniauth/delivery/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "omniauth-delivery-food"
|
8
|
+
spec.version = Omniauth::Delivery::VERSION
|
9
|
+
spec.authors = ["Isaac Rosenberg"]
|
10
|
+
spec.email = ["irosenb7@gmail.com"]
|
11
|
+
spec.description = %q{Omniauth authorization for Delivery.com API}
|
12
|
+
spec.summary = spec.description
|
13
|
+
spec.homepage = "https://github.com/irosenb/omniauth-delivery"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_dependency "omniauth"
|
22
|
+
spec.add_dependency "omniauth-oauth2"
|
23
|
+
spec.add_development_dependency 'rspec'
|
24
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
25
|
+
spec.add_development_dependency "rake"
|
26
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe OmniAuth::Strategies::Delivery do
|
4
|
+
subject do
|
5
|
+
OmniAuth::Strategies::Delivery.new(nil, @options || {})
|
6
|
+
end
|
7
|
+
|
8
|
+
context "endpoints" do
|
9
|
+
it 'should have the correct delivery site' do
|
10
|
+
expect(subject.client.site).to eq("https://api.delivery.com")
|
11
|
+
end
|
12
|
+
|
13
|
+
it "should have the correct delivery authorization url" do
|
14
|
+
expect(subject.client.authorize_url).to eq("https://api.delivery.com/third_party/authorize")
|
15
|
+
end
|
16
|
+
|
17
|
+
it "should have the correct delivery token url" do
|
18
|
+
expect(subject.client.token_url).to eq("https://api.delivery.com/third_party/access_token")
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
describe "#callback_path" do
|
23
|
+
it "should have the correct callback path" do
|
24
|
+
expect(subject.callback_path).to eq("/auth/delivery/callback")
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
describe "#name" do
|
29
|
+
it "should be named delivery" do
|
30
|
+
expect(subject.name).to eq("delivery")
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
describe "#credentials" do
|
35
|
+
it "returns the token from credentials" do
|
36
|
+
subject.stub(:credentials) { { :token => '12345' } }
|
37
|
+
expect(subject.credentials[:token]).to eq('12345')
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,128 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: omniauth-delivery-food
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Isaac Rosenberg
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-03-06 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: omniauth
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: omniauth-oauth2
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: bundler
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '1.3'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ~>
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '1.3'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rake
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - '>='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - '>='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
description: Omniauth authorization for Delivery.com API
|
84
|
+
email:
|
85
|
+
- irosenb7@gmail.com
|
86
|
+
executables: []
|
87
|
+
extensions: []
|
88
|
+
extra_rdoc_files: []
|
89
|
+
files:
|
90
|
+
- .gitignore
|
91
|
+
- Gemfile
|
92
|
+
- LICENSE.txt
|
93
|
+
- README.md
|
94
|
+
- Rakefile
|
95
|
+
- lib/omniauth/delivery/food.rb
|
96
|
+
- lib/omniauth/delivery/version.rb
|
97
|
+
- lib/omniauth/strategies/delivery.rb
|
98
|
+
- omniauth-delivery.gemspec
|
99
|
+
- spec/omniauth/strategies/omniauth_spec.rb
|
100
|
+
- spec/spec_helper.rb
|
101
|
+
homepage: https://github.com/irosenb/omniauth-delivery
|
102
|
+
licenses:
|
103
|
+
- MIT
|
104
|
+
metadata: {}
|
105
|
+
post_install_message:
|
106
|
+
rdoc_options: []
|
107
|
+
require_paths:
|
108
|
+
- lib
|
109
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
110
|
+
requirements:
|
111
|
+
- - '>='
|
112
|
+
- !ruby/object:Gem::Version
|
113
|
+
version: '0'
|
114
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
115
|
+
requirements:
|
116
|
+
- - '>='
|
117
|
+
- !ruby/object:Gem::Version
|
118
|
+
version: '0'
|
119
|
+
requirements: []
|
120
|
+
rubyforge_project:
|
121
|
+
rubygems_version: 2.0.6
|
122
|
+
signing_key:
|
123
|
+
specification_version: 4
|
124
|
+
summary: Omniauth authorization for Delivery.com API
|
125
|
+
test_files:
|
126
|
+
- spec/omniauth/strategies/omniauth_spec.rb
|
127
|
+
- spec/spec_helper.rb
|
128
|
+
has_rdoc:
|