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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2f2ff7ed3e26035911f5f0fce39ecc5fe8340a83
4
- data.tar.gz: 64443afca6259a57d5d596e5b2994f4a91781ec2
3
+ metadata.gz: 3fd35ca9cc34524542e7f1737944d03780e2548e
4
+ data.tar.gz: b20ac78460821d5a62073c53d48a22b16573291b
5
5
  SHA512:
6
- metadata.gz: 763b77ac3e47a72680f23a7f8d062592a1805a672d822e27587ec63d42d73c87a4cdb4724a5aa66f3798e4768017957d3575afd9310e34b7efe45b071144704c
7
- data.tar.gz: e3113536c70095780f3356ba2d9bd30c13e0501c1a14f1ec468fcce5060c165922c5f41aeae2ded62157180e1935dfb9eb6cb80b4544431fad276f70d78f8e83
6
+ metadata.gz: 1535e764828d7a99d6c58d66785994dd00843582d83d93ba29f7013d7b702e3b23194eb689a53b0c3fae0154a0878a4cde1161b8e7a0f65d547fcb0409de00c5
7
+ data.tar.gz: '0878f67ceb98639ed4da44a1ec908ce82fa16a4f0ef496292a1d136d3c62229c3ba1e14d44aded49f1a7c3c359f1b7e6f7678132d3c637d276766a77d219c217'
data/README.md CHANGED
@@ -1,2 +1,4 @@
1
1
  Shopapp gem - this is meant as a client gem for the Shoplift project which is
2
2
  not public yet.
3
+
4
+
@@ -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
- redirect_unauthorized
74
+ return false
75
75
  end
76
76
  else
77
- redirect_unauthorized
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
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'shopapp'
3
- s.version = '0.0.4'
3
+ s.version = '0.0.5'
4
4
  s.date = '2018-01-09'
5
5
  s.summary = 'Do a shoplift.'
6
6
  s.description = 'Ha! Art thou Bedlam? Dost thou thirst base Trojan, to have me fold up Parca\'s fatal web? Hence!\
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shopapp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zeljko