omniauth-lightspeed-pos 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +2 -0
- data/.rubocop.yml +66 -0
- data/Gemfile +12 -0
- data/Gemfile.lock +79 -0
- data/README.md +35 -0
- data/Rakefile +1 -0
- data/lib/omniauth-lightspeed.rb +2 -0
- data/lib/omniauth-lightspeed/version.rb +5 -0
- data/lib/omniauth/strategies/lightspeed.rb +17 -0
- data/omniauth-lightspeed.gemspec +22 -0
- data/spec/omniauth/strategies/lightspeed_spec.rb +21 -0
- data/spec/spec_helper.rb +15 -0
- metadata +86 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 386add1ff58b666297a9efa0800454cbd281b97a
|
4
|
+
data.tar.gz: fa524e6460e28cc5ae3115637c6773d81d5596b8
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 18952176cb8fe493feea9511d7c20ba2b76c28cb308b1b0179b2193de9790f0f517f53f53f0551cfd6b57fdc858726e85fbdb0bd89493d33e8eb01773f3813a0
|
7
|
+
data.tar.gz: 93db7c76983dee36dab357dbf3cde153e52cea3fd0f72f4bad4d4457265c48fb866e001194af7a6ecc54ba6e83956ab7a9a13bc518ac9e45bbbabf9da2c46c4d
|
data/.gitignore
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,66 @@
|
|
1
|
+
inherit_from: .rubocop_todo.yml
|
2
|
+
AllCops:
|
3
|
+
Include:
|
4
|
+
- "**/Rakefile"
|
5
|
+
- "**/config.ru"
|
6
|
+
Exclude:
|
7
|
+
- "db/**/*"
|
8
|
+
- "config/**/*"
|
9
|
+
- "script/**/*"
|
10
|
+
- "bin/**/*"
|
11
|
+
- "vendor/**/*"
|
12
|
+
- "node_modules/**/*"
|
13
|
+
- "Gemfile"
|
14
|
+
TargetRubyVersion: 2.3
|
15
|
+
|
16
|
+
Metrics/LineLength:
|
17
|
+
Enabled: false
|
18
|
+
|
19
|
+
Layout/AlignParameters:
|
20
|
+
EnforcedStyle: with_fixed_indentation
|
21
|
+
|
22
|
+
Style/ClassAndModuleChildren:
|
23
|
+
Enabled: false
|
24
|
+
|
25
|
+
Style/Documentation:
|
26
|
+
Enabled: false
|
27
|
+
|
28
|
+
Layout/DotPosition:
|
29
|
+
EnforcedStyle: trailing
|
30
|
+
|
31
|
+
Style/IfUnlessModifier:
|
32
|
+
Enabled: false
|
33
|
+
|
34
|
+
Style/PredicateName:
|
35
|
+
NamePrefixBlacklist:
|
36
|
+
- is_
|
37
|
+
- have_
|
38
|
+
|
39
|
+
Style/StringLiterals:
|
40
|
+
EnforcedStyle: double_quotes
|
41
|
+
|
42
|
+
Style/NumericLiterals:
|
43
|
+
Enabled: false
|
44
|
+
|
45
|
+
Style/SingleLineBlockParams:
|
46
|
+
Enabled: false
|
47
|
+
|
48
|
+
Layout/MultilineOperationIndentation:
|
49
|
+
EnforcedStyle: indented
|
50
|
+
|
51
|
+
Layout/MultilineMethodCallIndentation:
|
52
|
+
EnforcedStyle: indented
|
53
|
+
|
54
|
+
Style/TrailingCommaInArguments:
|
55
|
+
EnforcedStyleForMultiline: comma
|
56
|
+
|
57
|
+
Style/TrailingCommaInLiteral:
|
58
|
+
EnforcedStyleForMultiline: comma
|
59
|
+
|
60
|
+
Style/FrozenStringLiteralComment:
|
61
|
+
Enabled: false
|
62
|
+
|
63
|
+
Metrics/BlockLength:
|
64
|
+
Exclude:
|
65
|
+
- spec/**/*.rb
|
66
|
+
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,79 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
omniauth-lightspeed (0.0.1)
|
5
|
+
omniauth-oauth2 (~> 1.4)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
addressable (2.5.1)
|
11
|
+
public_suffix (~> 2.0, >= 2.0.2)
|
12
|
+
crack (0.4.3)
|
13
|
+
safe_yaml (~> 1.0.0)
|
14
|
+
diff-lcs (1.3)
|
15
|
+
docile (1.1.5)
|
16
|
+
faraday (0.10.1)
|
17
|
+
multipart-post (>= 1.2, < 3)
|
18
|
+
hashdiff (0.3.4)
|
19
|
+
hashie (3.5.6)
|
20
|
+
json (2.1.0)
|
21
|
+
jwt (1.5.6)
|
22
|
+
multi_json (1.12.1)
|
23
|
+
multi_xml (0.6.0)
|
24
|
+
multipart-post (2.0.0)
|
25
|
+
oauth2 (1.3.0)
|
26
|
+
faraday (>= 0.8, < 0.11)
|
27
|
+
jwt (~> 1.0)
|
28
|
+
multi_json (~> 1.3)
|
29
|
+
multi_xml (~> 0.5)
|
30
|
+
rack (>= 1.2, < 3)
|
31
|
+
omniauth (1.6.1)
|
32
|
+
hashie (>= 3.4.6, < 3.6.0)
|
33
|
+
rack (>= 1.6.2, < 3)
|
34
|
+
omniauth-oauth2 (1.4.0)
|
35
|
+
oauth2 (~> 1.0)
|
36
|
+
omniauth (~> 1.2)
|
37
|
+
public_suffix (2.0.5)
|
38
|
+
rack (2.0.3)
|
39
|
+
rack-test (0.7.0)
|
40
|
+
rack (>= 1.0, < 3)
|
41
|
+
rake (12.0.0)
|
42
|
+
rspec (3.6.0)
|
43
|
+
rspec-core (~> 3.6.0)
|
44
|
+
rspec-expectations (~> 3.6.0)
|
45
|
+
rspec-mocks (~> 3.6.0)
|
46
|
+
rspec-core (3.6.0)
|
47
|
+
rspec-support (~> 3.6.0)
|
48
|
+
rspec-expectations (3.6.0)
|
49
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
50
|
+
rspec-support (~> 3.6.0)
|
51
|
+
rspec-mocks (3.6.0)
|
52
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
53
|
+
rspec-support (~> 3.6.0)
|
54
|
+
rspec-support (3.6.0)
|
55
|
+
safe_yaml (1.0.4)
|
56
|
+
simplecov (0.14.1)
|
57
|
+
docile (~> 1.1.0)
|
58
|
+
json (>= 1.8, < 3)
|
59
|
+
simplecov-html (~> 0.10.0)
|
60
|
+
simplecov-html (0.10.1)
|
61
|
+
webmock (3.0.1)
|
62
|
+
addressable (>= 2.3.6)
|
63
|
+
crack (>= 0.3.2)
|
64
|
+
hashdiff
|
65
|
+
|
66
|
+
PLATFORMS
|
67
|
+
ruby
|
68
|
+
|
69
|
+
DEPENDENCIES
|
70
|
+
bundler (~> 1.0)
|
71
|
+
omniauth-lightspeed!
|
72
|
+
rack-test
|
73
|
+
rake
|
74
|
+
rspec (~> 3.2)
|
75
|
+
simplecov
|
76
|
+
webmock
|
77
|
+
|
78
|
+
BUNDLED WITH
|
79
|
+
1.14.6
|
data/README.md
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
# OmniAuth Lightspeed
|
2
|
+
|
3
|
+
This is the unofficial OmniAuth strategy for authenticating to Lightspeed
|
4
|
+
Retail. To use it, you'll need to sign up for an OAuth2 Application ID and Secret
|
5
|
+
on the [Lightspeed Retail Client Signup Page](https://cloud.merchantos.com/oauth/register.php).
|
6
|
+
|
7
|
+
## Basic Usage
|
8
|
+
|
9
|
+
use OmniAuth::Builder do
|
10
|
+
provider :lightspedd, ENV['LIGHTSPEED_CLIENT_ID'], ENV['LIGHTSPEED_CLIENT_SECRET'], scope: 'employee:all'
|
11
|
+
end
|
12
|
+
|
13
|
+
## Notes:
|
14
|
+
- For more information on scopes: http://developers.lightspeedhq.com/retail/authentication/scopes/
|
15
|
+
|
16
|
+
## License
|
17
|
+
|
18
|
+
Copyright (c) 2017 Luis Ferreira and Zinc Platform, Inc.
|
19
|
+
|
20
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
21
|
+
this software and associated documentation files (the "Software"), to deal in
|
22
|
+
the Software without restriction, including without limitation the rights to
|
23
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
24
|
+
the Software, and to permit persons to whom the Software is furnished to do so,
|
25
|
+
subject to the following conditions:
|
26
|
+
|
27
|
+
The above copyright notice and this permission notice shall be included in all
|
28
|
+
copies or substantial portions of the Software.
|
29
|
+
|
30
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
31
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
32
|
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
33
|
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
34
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
35
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require "omniauth-oauth2"
|
2
|
+
|
3
|
+
module OmniAuth
|
4
|
+
module Strategies
|
5
|
+
class Lightspeed < OmniAuth::Strategies::OAuth2
|
6
|
+
option :name, :lightspeed
|
7
|
+
option :client_options, site: "https://api.merchantos.com/API",
|
8
|
+
authorize_url: "https://cloud.merchantos.com/oauth/authorize.php",
|
9
|
+
token_url: "https://cloud.merchantos.com/oauth/access_token.php"
|
10
|
+
|
11
|
+
def request_phase
|
12
|
+
options[:scope] ||= "employee:all"
|
13
|
+
super
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "omniauth-lightspeed/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "omniauth-lightspeed-pos"
|
7
|
+
s.version = OmniAuth::Lightspeed::VERSION
|
8
|
+
s.authors = ["Zamith"]
|
9
|
+
s.email = ["zamith@subvisual.co"]
|
10
|
+
s.homepage = "https://github.com/ZincPlatform/omniauth-lightspeed"
|
11
|
+
s.description = %q{OmniAuth strategy for Lightspeed POS}
|
12
|
+
s.summary = s.description
|
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
|
+
s.required_ruby_version = Gem::Requirement.new(">= 2.1.0")
|
20
|
+
s.add_dependency "omniauth-oauth2", "~> 1.4"
|
21
|
+
s.add_development_dependency "bundler", "~> 1.0"
|
22
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
RSpec.describe OmniAuth::Strategies::Lightspeed do
|
4
|
+
context "client options" do
|
5
|
+
subject do
|
6
|
+
OmniAuth::Strategies::Lightspeed.new({})
|
7
|
+
end
|
8
|
+
|
9
|
+
it "has the correct site" do
|
10
|
+
expect(subject.options.client_options.site).to eq("https://api.merchantos.com/API")
|
11
|
+
end
|
12
|
+
|
13
|
+
it "has the correct authorize url" do
|
14
|
+
expect(subject.options.client_options.authorize_url).to eq("https://cloud.merchantos.com/oauth/authorize.php")
|
15
|
+
end
|
16
|
+
|
17
|
+
it "has the correct token url" do
|
18
|
+
expect(subject.options.client_options.token_url).to eq("https://cloud.merchantos.com/oauth/access_token.php")
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
$LOAD_PATH.unshift File.expand_path("..", __FILE__)
|
2
|
+
$LOAD_PATH.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-lightspeed-pos"
|
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
|
metadata
ADDED
@@ -0,0 +1,86 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: omniauth-lightspeed-pos
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Zamith
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-07-17 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.4'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.4'
|
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.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.0'
|
41
|
+
description: OmniAuth strategy for Lightspeed POS
|
42
|
+
email:
|
43
|
+
- zamith@subvisual.co
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- ".gitignore"
|
49
|
+
- ".rubocop.yml"
|
50
|
+
- Gemfile
|
51
|
+
- Gemfile.lock
|
52
|
+
- README.md
|
53
|
+
- Rakefile
|
54
|
+
- lib/omniauth-lightspeed.rb
|
55
|
+
- lib/omniauth-lightspeed/version.rb
|
56
|
+
- lib/omniauth/strategies/lightspeed.rb
|
57
|
+
- omniauth-lightspeed.gemspec
|
58
|
+
- spec/omniauth/strategies/lightspeed_spec.rb
|
59
|
+
- spec/spec_helper.rb
|
60
|
+
homepage: https://github.com/ZincPlatform/omniauth-lightspeed
|
61
|
+
licenses:
|
62
|
+
- MIT
|
63
|
+
metadata: {}
|
64
|
+
post_install_message:
|
65
|
+
rdoc_options: []
|
66
|
+
require_paths:
|
67
|
+
- lib
|
68
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
69
|
+
requirements:
|
70
|
+
- - ">="
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: 2.1.0
|
73
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
74
|
+
requirements:
|
75
|
+
- - ">="
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
requirements: []
|
79
|
+
rubyforge_project:
|
80
|
+
rubygems_version: 2.5.1
|
81
|
+
signing_key:
|
82
|
+
specification_version: 4
|
83
|
+
summary: OmniAuth strategy for Lightspeed POS
|
84
|
+
test_files:
|
85
|
+
- spec/omniauth/strategies/lightspeed_spec.rb
|
86
|
+
- spec/spec_helper.rb
|