omniauth-shopify-oauth2 1.1.2 → 1.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile.lock +19 -17
- data/README.md +1 -1
- data/lib/omniauth/shopify/version.rb +1 -1
- data/lib/omniauth/strategies/shopify.rb +14 -2
- data/spec/omniauth/strategies/shopify_spec.rb +14 -0
- metadata +14 -22
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: f24fe6681c6f7153279737aa891bb2a400e8ae9c
|
4
|
+
data.tar.gz: fb0c659e1ed149565bfde4ec52018b2d65f84f28
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 1a2ac60edb571aabc8551c922298eacf213ff39906172c5bcfbde361896cb78ca757e2bccb1f826d84c143d68103417509dde3533d310e78ea35e1ff7c044921
|
7
|
+
data.tar.gz: 2aec89d6c7778ecc9bdbf71cf9a44afd325b02ef6d65231a4d6a9facb80c5da94e03ddbe615de3a9541f42fc78f6b4ec92abdc5ab2c4df559ee7e01fc08b67dd
|
data/Gemfile.lock
CHANGED
@@ -1,33 +1,35 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
omniauth-shopify-oauth2 (1.1.
|
4
|
+
omniauth-shopify-oauth2 (1.1.3)
|
5
5
|
omniauth-oauth2 (~> 1.1.1)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
10
|
diff-lcs (1.1.3)
|
11
|
-
faraday (0.
|
12
|
-
multipart-post (
|
11
|
+
faraday (0.9.0)
|
12
|
+
multipart-post (>= 1.2, < 3)
|
13
13
|
hashie (2.0.5)
|
14
|
-
|
15
|
-
jwt (0.1.8)
|
14
|
+
jwt (0.1.11)
|
16
15
|
multi_json (>= 1.5)
|
17
|
-
multi_json (1.
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
jwt (~> 0.1.
|
23
|
-
multi_json (~> 1.
|
16
|
+
multi_json (1.9.0)
|
17
|
+
multi_xml (0.5.5)
|
18
|
+
multipart-post (2.0.0)
|
19
|
+
oauth2 (0.9.3)
|
20
|
+
faraday (>= 0.8, < 0.10)
|
21
|
+
jwt (~> 0.1.8)
|
22
|
+
multi_json (~> 1.3)
|
23
|
+
multi_xml (~> 0.5)
|
24
24
|
rack (~> 1.2)
|
25
|
-
omniauth (1.1
|
25
|
+
omniauth (1.2.1)
|
26
26
|
hashie (>= 1.2, < 3)
|
27
|
-
rack
|
28
|
-
omniauth-oauth2 (1.1.
|
29
|
-
|
30
|
-
|
27
|
+
rack (~> 1.0)
|
28
|
+
omniauth-oauth2 (1.1.2)
|
29
|
+
faraday (>= 0.8, < 0.10)
|
30
|
+
multi_json (~> 1.3)
|
31
|
+
oauth2 (~> 0.9.3)
|
32
|
+
omniauth (~> 1.2)
|
31
33
|
rack (1.5.2)
|
32
34
|
rake (0.9.2.2)
|
33
35
|
rspec (2.7.0)
|
data/README.md
CHANGED
@@ -39,7 +39,7 @@ Rails.application.config.middleware.use OmniAuth::Builder do
|
|
39
39
|
provider :shopify, ENV['SHOPIFY_API_KEY'], ENV['SHOPIFY_SHARED_SECRET'],
|
40
40
|
:scope => 'read_products,read_orders,write_content',
|
41
41
|
:setup => lambda { |env| params = Rack::Utils.parse_query(env['QUERY_STRING'])
|
42
|
-
env['omniauth.strategy'].options[:client_options][:site] = "
|
42
|
+
env['omniauth.strategy'].options[:client_options][:site] = "https://#{params['shop']}" }
|
43
43
|
end
|
44
44
|
```
|
45
45
|
|
@@ -19,12 +19,24 @@ module OmniAuth
|
|
19
19
|
uid { URI.parse(options[:client_options][:site]).host }
|
20
20
|
|
21
21
|
def valid_site?
|
22
|
-
return
|
22
|
+
return /\A(https|http)\:\/\/[a-zA-Z0-9][a-zA-Z0-9\-]*\.myshopify\.com[\/]?\z/ =~ options[:client_options][:site]
|
23
|
+
end
|
24
|
+
|
25
|
+
def fix_https
|
26
|
+
options[:client_options][:site].gsub!(/\Ahttp\:/, 'https:')
|
23
27
|
end
|
24
28
|
|
25
29
|
def setup_phase
|
26
30
|
super
|
27
|
-
|
31
|
+
fix_https
|
32
|
+
end
|
33
|
+
|
34
|
+
def request_phase
|
35
|
+
if valid_site?
|
36
|
+
super
|
37
|
+
else
|
38
|
+
fail!(:invalid_site)
|
39
|
+
end
|
28
40
|
end
|
29
41
|
|
30
42
|
def authorize_params
|
@@ -22,6 +22,20 @@ describe OmniAuth::Strategies::Shopify do
|
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
|
+
describe '#fix_https' do
|
26
|
+
it 'replaces http scheme by https' do
|
27
|
+
@options = {:client_options => {:site => 'http://foo.bar/'}}
|
28
|
+
subject.fix_https
|
29
|
+
subject.options[:client_options][:site].should eq('https://foo.bar/')
|
30
|
+
end
|
31
|
+
|
32
|
+
it 'does not replace https scheme' do
|
33
|
+
@options = {:client_options => {:site => 'https://foo.bar/'}}
|
34
|
+
subject.fix_https
|
35
|
+
subject.options[:client_options][:site].should eq('https://foo.bar/')
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
25
39
|
describe '#client' do
|
26
40
|
it 'has correct shopify site' do
|
27
41
|
subject.client.site.should eq('https://example.myshopify.com')
|
metadata
CHANGED
@@ -1,62 +1,55 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omniauth-shopify-oauth2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
5
|
-
prerelease:
|
4
|
+
version: 1.1.3
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Denis Odorcic
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2014-03-11 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: omniauth-oauth2
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- - ~>
|
17
|
+
- - "~>"
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: 1.1.1
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- - ~>
|
24
|
+
- - "~>"
|
28
25
|
- !ruby/object:Gem::Version
|
29
26
|
version: 1.1.1
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: rspec
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
|
-
- - ~>
|
31
|
+
- - "~>"
|
36
32
|
- !ruby/object:Gem::Version
|
37
33
|
version: 2.7.0
|
38
34
|
type: :development
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
|
-
- - ~>
|
38
|
+
- - "~>"
|
44
39
|
- !ruby/object:Gem::Version
|
45
40
|
version: 2.7.0
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
42
|
name: rake
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
|
-
- -
|
45
|
+
- - ">="
|
52
46
|
- !ruby/object:Gem::Version
|
53
47
|
version: '0'
|
54
48
|
type: :development
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
51
|
requirements:
|
59
|
-
- -
|
52
|
+
- - ">="
|
60
53
|
- !ruby/object:Gem::Version
|
61
54
|
version: '0'
|
62
55
|
description:
|
@@ -66,7 +59,7 @@ executables: []
|
|
66
59
|
extensions: []
|
67
60
|
extra_rdoc_files: []
|
68
61
|
files:
|
69
|
-
- .gitignore
|
62
|
+
- ".gitignore"
|
70
63
|
- Gemfile
|
71
64
|
- Gemfile.lock
|
72
65
|
- README.md
|
@@ -85,27 +78,26 @@ files:
|
|
85
78
|
homepage: https://github.com/Shopify/omniauth-shopify-oauth2
|
86
79
|
licenses:
|
87
80
|
- MIT
|
81
|
+
metadata: {}
|
88
82
|
post_install_message:
|
89
83
|
rdoc_options: []
|
90
84
|
require_paths:
|
91
85
|
- lib
|
92
86
|
required_ruby_version: !ruby/object:Gem::Requirement
|
93
|
-
none: false
|
94
87
|
requirements:
|
95
|
-
- -
|
88
|
+
- - ">="
|
96
89
|
- !ruby/object:Gem::Version
|
97
90
|
version: '0'
|
98
91
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
99
|
-
none: false
|
100
92
|
requirements:
|
101
|
-
- -
|
93
|
+
- - ">="
|
102
94
|
- !ruby/object:Gem::Version
|
103
95
|
version: '0'
|
104
96
|
requirements: []
|
105
97
|
rubyforge_project:
|
106
|
-
rubygems_version:
|
98
|
+
rubygems_version: 2.2.0
|
107
99
|
signing_key:
|
108
|
-
specification_version:
|
100
|
+
specification_version: 4
|
109
101
|
summary: Shopify strategy for OmniAuth
|
110
102
|
test_files:
|
111
103
|
- spec/omniauth/strategies/shopify_spec.rb
|