omniauth-shopify-oauth2 1.1.3 → 1.1.4
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 +4 -4
- data/Gemfile.lock +3 -3
- data/README.md +3 -3
- data/lib/omniauth/shopify/version.rb +1 -1
- data/lib/omniauth/strategies/shopify.rb +2 -1
- data/spec/omniauth/strategies/shopify_spec.rb +22 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c392a50f6fa891ac174ac7c7e7958ecdf5ee0d01
|
4
|
+
data.tar.gz: df0450c540e19b197281921adae1a073ac1b5d3e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bf6d6f10356702d2aecf8e79ea67ff7a59d64deb4ed71b62e88051c6d0f9579ad01438ab1eb4077e859a7b3cf6c6d578eabe35eaffd11a9e75140cd06d1a8855
|
7
|
+
data.tar.gz: 3faf0377495c9abf3bb35164127800cbbe3cdc28e64d9aeb12c32436ad80fe888c8789d2f1c92ef5bf5245594817214b0114d5eb0c28b47008baa7bcb84310af
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
omniauth-shopify-oauth2 (1.1.
|
4
|
+
omniauth-shopify-oauth2 (1.1.4)
|
5
5
|
omniauth-oauth2 (~> 1.1.1)
|
6
6
|
|
7
7
|
GEM
|
@@ -10,10 +10,10 @@ GEM
|
|
10
10
|
diff-lcs (1.1.3)
|
11
11
|
faraday (0.9.0)
|
12
12
|
multipart-post (>= 1.2, < 3)
|
13
|
-
hashie (2.
|
13
|
+
hashie (2.1.1)
|
14
14
|
jwt (0.1.11)
|
15
15
|
multi_json (>= 1.5)
|
16
|
-
multi_json (1.9.
|
16
|
+
multi_json (1.9.2)
|
17
17
|
multi_xml (0.5.5)
|
18
18
|
multipart-post (2.0.0)
|
19
19
|
oauth2 (0.9.3)
|
data/README.md
CHANGED
@@ -14,7 +14,7 @@ Then `bundle install`.
|
|
14
14
|
|
15
15
|
## Usage
|
16
16
|
|
17
|
-
`OmniAuth::Strategies::Shopify` is simply a Rack middleware. Read the OmniAuth 1.0 docs
|
17
|
+
`OmniAuth::Strategies::Shopify` is simply a Rack middleware. Read [the OmniAuth 1.0 docs](https://github.com/intridea/omniauth) for detailed instructions.
|
18
18
|
|
19
19
|
Here's a quick example, adding the middleware to a Rails app in `config/initializers/omniauth.rb`:
|
20
20
|
|
@@ -28,9 +28,9 @@ end
|
|
28
28
|
|
29
29
|
You can configure the scope, which you pass in to the `provider` method via a `Hash`:
|
30
30
|
|
31
|
-
* `scope`: A comma-separated list of permissions you want to request from the user. See the Shopify API docs for a full list of available permissions
|
31
|
+
* `scope`: A comma-separated list of permissions you want to request from the user. See [the Shopify API docs](http://docs.shopify.com/api/tutorials/oauth) for a full list of available permissions.
|
32
32
|
|
33
|
-
* `setup`: A lambda which dynamically sets the `site`. You must initiate the
|
33
|
+
* `setup`: A lambda which dynamically sets the `site`. You must initiate the OmniAuth process by passing in a `shop` query parameter of the shop you're requesting permissions for. Ex. http://myapp.com/auth/shopify?shop=example.myshopify.com
|
34
34
|
|
35
35
|
For example, to request `read_products`, `read_orders` and `write_content` permissions and display the authentication page:
|
36
36
|
|
@@ -15,11 +15,12 @@ module OmniAuth
|
|
15
15
|
option :callback_url
|
16
16
|
|
17
17
|
option :provider_ignores_state, true
|
18
|
+
option :myshopify_domain, 'myshopify.com'
|
18
19
|
|
19
20
|
uid { URI.parse(options[:client_options][:site]).host }
|
20
21
|
|
21
22
|
def valid_site?
|
22
|
-
|
23
|
+
!!(/\A(https|http)\:\/\/[a-zA-Z0-9][a-zA-Z0-9\-]*\.#{Regexp.quote(options[:myshopify_domain])}[\/]?\z/ =~ options[:client_options][:site])
|
23
24
|
end
|
24
25
|
|
25
26
|
def fix_https
|
@@ -112,4 +112,26 @@ describe OmniAuth::Strategies::Shopify do
|
|
112
112
|
end
|
113
113
|
|
114
114
|
end
|
115
|
+
|
116
|
+
describe '#valid_site?' do
|
117
|
+
it 'returns true if the site contains .myshopify.com' do
|
118
|
+
@options = {:client_options => {:site => 'http://foo.myshopify.com/'}}
|
119
|
+
subject.valid_site?.should eq(true)
|
120
|
+
end
|
121
|
+
|
122
|
+
it 'returns false if the site does not contain .myshopify.com' do
|
123
|
+
@options = {:client_options => {:site => 'http://foo.example.com/'}}
|
124
|
+
subject.valid_site?.should eq(false)
|
125
|
+
end
|
126
|
+
|
127
|
+
it 'uses configurable option for myshopify_domain' do
|
128
|
+
@options = {:client_options => {:site => 'http://foo.example.com/'}, :myshopify_domain => 'example.com'}
|
129
|
+
subject.valid_site?.should eq(true)
|
130
|
+
end
|
131
|
+
|
132
|
+
it 'allows custom port for myshopify_domain' do
|
133
|
+
@options = {:client_options => {:site => 'http://foo.example.com:3456/'}, :myshopify_domain => 'example.com:3456'}
|
134
|
+
subject.valid_site?.should eq(true)
|
135
|
+
end
|
136
|
+
end
|
115
137
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omniauth-shopify-oauth2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Denis Odorcic
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-04-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: omniauth-oauth2
|
@@ -95,7 +95,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
95
95
|
version: '0'
|
96
96
|
requirements: []
|
97
97
|
rubyforge_project:
|
98
|
-
rubygems_version: 2.2.
|
98
|
+
rubygems_version: 2.2.2
|
99
99
|
signing_key:
|
100
100
|
specification_version: 4
|
101
101
|
summary: Shopify strategy for OmniAuth
|