omniauth-channel_advisor 1.0.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 +23 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +45 -0
- data/Rakefile +2 -0
- data/lib/omniauth/strategies/channel_advisor.rb +73 -0
- data/lib/omniauth-channel_advisor/version.rb +5 -0
- data/lib/omniauth-channel_advisor.rb +2 -0
- data/omniauth-channel_advisor.gemspec +23 -0
- metadata +95 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: f7096ff9147d2c2ef199b51393cd170be2b90542
|
4
|
+
data.tar.gz: 63d7072cfdb50ce6de73683890d8473ddf1b68da
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: fd40b1fababbd79b1de4d4a15e53d75faef0c23a766bac9b5b73ad5d0d3913fea5f5677a046b8b5db3968fa8d579a787488779e4e9afb2f19e30f57ebaa8a3a2
|
7
|
+
data.tar.gz: ef1e432fd80a6eeb840b0f9b2b0739fb7377a66fcd43daa1b856d413389229762db84e2d3ae0751b01fa3e708c4709c83edf2d48d1689c698a7217cf3d236896
|
data/.gitignore
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
.bundle
|
4
|
+
.config
|
5
|
+
.yardoc
|
6
|
+
Gemfile.lock
|
7
|
+
InstalledFiles
|
8
|
+
_yardoc
|
9
|
+
coverage
|
10
|
+
doc/
|
11
|
+
lib/bundler/man
|
12
|
+
pkg
|
13
|
+
rdoc
|
14
|
+
spec/reports
|
15
|
+
test/tmp
|
16
|
+
test/version_tmp
|
17
|
+
tmp
|
18
|
+
*.bundle
|
19
|
+
*.so
|
20
|
+
*.o
|
21
|
+
*.a
|
22
|
+
mkmf.log
|
23
|
+
/.ruby-*
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2015 ShippingEasy
|
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,45 @@
|
|
1
|
+
# OmniAuth::ChannelAdvisor
|
2
|
+
|
3
|
+
OmniAuth strategy for ChannelAdvisor OAuth2
|
4
|
+
|
5
|
+
## Usage
|
6
|
+
|
7
|
+
Use to retrieve an access token for use with the REST API:
|
8
|
+
http://developers.channeladvisor.com/rest/
|
9
|
+
|
10
|
+
|
11
|
+
You must first register your application in the ChannelAdvisor Developer Console
|
12
|
+
https://api.channeladvisor.com/developerconsole
|
13
|
+
|
14
|
+
When you register the application, you will get an 'application ID' and 'shared secret'.
|
15
|
+
These need to be provided when you configure the strategy
|
16
|
+
(this example assumes the values are available in environment variables):
|
17
|
+
|
18
|
+
```
|
19
|
+
Rails.application.config.middleware.use OmniAuth::Builder do
|
20
|
+
provider :channel_advisor, ENV['APPLICATION_ID'], ENV['SHARED_SECRET']
|
21
|
+
end
|
22
|
+
```
|
23
|
+
|
24
|
+
## Installation
|
25
|
+
|
26
|
+
Add this line to your application's Gemfile:
|
27
|
+
|
28
|
+
gem 'omniauth-channel_advisor'
|
29
|
+
|
30
|
+
And then execute:
|
31
|
+
|
32
|
+
$ bundle
|
33
|
+
|
34
|
+
Or install it yourself as:
|
35
|
+
|
36
|
+
$ gem install omniauth-channel_advisor
|
37
|
+
|
38
|
+
|
39
|
+
## Contributing
|
40
|
+
|
41
|
+
1. Fork it ( https://github.com/ShippingEasy/omniauth-channel_advisor/fork )
|
42
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
43
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
44
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
45
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1,73 @@
|
|
1
|
+
require 'omniauth/strategies/oauth2'
|
2
|
+
|
3
|
+
module OmniAuth
|
4
|
+
module Strategies
|
5
|
+
class ChannelAdvisor < OmniAuth::Strategies::OAuth2
|
6
|
+
option :name, "channel_advisor"
|
7
|
+
option :client_options, {
|
8
|
+
:site => 'https://api.channeladvisor.com',
|
9
|
+
:authorize_url => '/oauth2/authorize',
|
10
|
+
:token_url => '/oauth2/token'
|
11
|
+
}
|
12
|
+
|
13
|
+
# scope: 'orders inventory' - http://developers.channeladvisor.com/rest/#638
|
14
|
+
# access_type: 'offline' - retrieve a refresh token http://developers.channeladvisor.com/rest/#917
|
15
|
+
# approval_prompt: 'force' - always show grant screen http://developers.channeladvisor.com/rest/#917
|
16
|
+
option :authorize_options, [:scope, :access_type, :approval_prompt]
|
17
|
+
|
18
|
+
NAME_KEY = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name".freeze
|
19
|
+
UID_KEY = "urn:ca:claim:profile".freeze
|
20
|
+
|
21
|
+
uid{ info_hash[UID_KEY] }
|
22
|
+
|
23
|
+
info do
|
24
|
+
{
|
25
|
+
:name => info_hash[NAME_KEY]
|
26
|
+
}
|
27
|
+
end
|
28
|
+
|
29
|
+
extra do
|
30
|
+
{
|
31
|
+
'raw_info' => raw_info
|
32
|
+
}
|
33
|
+
end
|
34
|
+
|
35
|
+
def info_hash
|
36
|
+
@info_hash ||= Array(raw_info).each_with_object({}){|item, result|
|
37
|
+
key = item["Type"]
|
38
|
+
val = item["Value"]
|
39
|
+
result[key] = val if (key && val)
|
40
|
+
}
|
41
|
+
end
|
42
|
+
|
43
|
+
def raw_info
|
44
|
+
@raw_info ||= access_token.get('/oauth2/identity').parsed
|
45
|
+
end
|
46
|
+
|
47
|
+
# Example response from identity endpoint
|
48
|
+
#
|
49
|
+
# [
|
50
|
+
# {
|
51
|
+
# "$id": "1",
|
52
|
+
# "Type": "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name",
|
53
|
+
# "Value": "MyStore"
|
54
|
+
# },
|
55
|
+
# {
|
56
|
+
# "$id": "2",
|
57
|
+
# "Type": "urn:ca:claim:scope",
|
58
|
+
# "Value": "orders"
|
59
|
+
# },
|
60
|
+
# {
|
61
|
+
# "$id": "3",
|
62
|
+
# "Type": "urn:ca:claim:scope",
|
63
|
+
# "Value": "inventory"
|
64
|
+
# },
|
65
|
+
# {
|
66
|
+
# "$id": "4",
|
67
|
+
# "Type": "urn:ca:claim:profile",
|
68
|
+
# "Value": "12345678"
|
69
|
+
# }
|
70
|
+
# ]
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'omniauth-channel_advisor/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "omniauth-channel_advisor"
|
8
|
+
spec.version = OmniAuth::ChannelAdvisor::VERSION
|
9
|
+
spec.authors = ["ShippingEasy"]
|
10
|
+
spec.email = ["joshua@shippingeasy.com"]
|
11
|
+
spec.summary = %q{ChannelAdvisor OAuth2 strategy for OmniAuth}
|
12
|
+
spec.homepage = "https://github.com/ShippingEasy/omniauth-channel_advisor"
|
13
|
+
spec.license = "MIT"
|
14
|
+
|
15
|
+
spec.files = `git ls-files -z`.split("\x0")
|
16
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
17
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
18
|
+
spec.require_paths = ["lib"]
|
19
|
+
|
20
|
+
spec.add_runtime_dependency 'omniauth-oauth2', '~> 1.1'
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.6"
|
22
|
+
spec.add_development_dependency "rake"
|
23
|
+
end
|
metadata
ADDED
@@ -0,0 +1,95 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: omniauth-channel_advisor
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- ShippingEasy
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-05-15 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: omniauth-oauth2
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.1'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.1'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.6'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.6'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
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
|
+
description:
|
56
|
+
email:
|
57
|
+
- joshua@shippingeasy.com
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- ".gitignore"
|
63
|
+
- Gemfile
|
64
|
+
- LICENSE.txt
|
65
|
+
- README.md
|
66
|
+
- Rakefile
|
67
|
+
- lib/omniauth-channel_advisor.rb
|
68
|
+
- lib/omniauth-channel_advisor/version.rb
|
69
|
+
- lib/omniauth/strategies/channel_advisor.rb
|
70
|
+
- omniauth-channel_advisor.gemspec
|
71
|
+
homepage: https://github.com/ShippingEasy/omniauth-channel_advisor
|
72
|
+
licenses:
|
73
|
+
- MIT
|
74
|
+
metadata: {}
|
75
|
+
post_install_message:
|
76
|
+
rdoc_options: []
|
77
|
+
require_paths:
|
78
|
+
- lib
|
79
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - ">="
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: '0'
|
84
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - ">="
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '0'
|
89
|
+
requirements: []
|
90
|
+
rubyforge_project:
|
91
|
+
rubygems_version: 2.2.2
|
92
|
+
signing_key:
|
93
|
+
specification_version: 4
|
94
|
+
summary: ChannelAdvisor OAuth2 strategy for OmniAuth
|
95
|
+
test_files: []
|