shopapp 0.0.4 → 0.0.5
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/README.md +2 -0
- data/app/controllers/concerns/shoplift_client.rb +10 -3
- data/shopapp.gemspec +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3fd35ca9cc34524542e7f1737944d03780e2548e
|
4
|
+
data.tar.gz: b20ac78460821d5a62073c53d48a22b16573291b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1535e764828d7a99d6c58d66785994dd00843582d83d93ba29f7013d7b702e3b23194eb689a53b0c3fae0154a0878a4cde1161b8e7a0f65d547fcb0409de00c5
|
7
|
+
data.tar.gz: '0878f67ceb98639ed4da44a1ec908ce82fa16a4f0ef496292a1d136d3c62229c3ba1e14d44aded49f1a7c3c359f1b7e6f7678132d3c637d276766a77d219c217'
|
data/README.md
CHANGED
@@ -63,7 +63,7 @@ module ShopliftClient
|
|
63
63
|
end
|
64
64
|
end
|
65
65
|
|
66
|
-
def authenticate_user
|
66
|
+
def authenticate_user
|
67
67
|
if session_cookie.present?
|
68
68
|
@token = OAuth2::AccessToken.new client, session_cookie, scope: scope
|
69
69
|
begin
|
@@ -71,14 +71,21 @@ module ShopliftClient
|
|
71
71
|
@current_user = JSON.parse x.response.body
|
72
72
|
find_company_by_code current_user['company']['code']
|
73
73
|
rescue OAuth2::Error
|
74
|
-
|
74
|
+
return false
|
75
75
|
end
|
76
76
|
else
|
77
|
-
|
77
|
+
return false
|
78
78
|
end
|
79
|
+
true
|
80
|
+
end
|
81
|
+
|
82
|
+
def authenticate_user!
|
83
|
+
redirect_unauthorized unless authenticate_user
|
79
84
|
end
|
80
85
|
|
81
86
|
def authenticate_company!
|
87
|
+
return if authenticate_user
|
88
|
+
|
82
89
|
@api_key = if params['key'].present?
|
83
90
|
params['key'].match(/[0-9a-f]+/).to_s
|
84
91
|
elsif request.headers['AUTHORIZATION'].present?
|
data/shopapp.gemspec
CHANGED