shopapp 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3fd35ca9cc34524542e7f1737944d03780e2548e
4
- data.tar.gz: b20ac78460821d5a62073c53d48a22b16573291b
3
+ metadata.gz: 11d8a7b899e944cfb00f6f4185f20d0813d443fd
4
+ data.tar.gz: 952204164e72577170ad84ffe6a1a3f69b911caa
5
5
  SHA512:
6
- metadata.gz: 1535e764828d7a99d6c58d66785994dd00843582d83d93ba29f7013d7b702e3b23194eb689a53b0c3fae0154a0878a4cde1161b8e7a0f65d547fcb0409de00c5
7
- data.tar.gz: '0878f67ceb98639ed4da44a1ec908ce82fa16a4f0ef496292a1d136d3c62229c3ba1e14d44aded49f1a7c3c359f1b7e6f7678132d3c637d276766a77d219c217'
6
+ metadata.gz: 79b023e030673c89a256c11f73ff43a2b9b3405f2f72e6693b0808faf433e0f2b0cab4dc97e5942e8ed4f01ef78118985aa74ab654aa631445ccf427eac2eb65
7
+ data.tar.gz: 5b800820ded0a09c9f054067352a70dd7d89a80ff18a26f29882bafb6c2e893744f55f06189878c265a1f97b4b5b2d33b7d533b97d84b48f4da1dc673744f251
@@ -83,7 +83,12 @@ module ShopliftClient
83
83
  redirect_unauthorized unless authenticate_user
84
84
  end
85
85
 
86
- def authenticate_company!
86
+ def authenticate_user_or_api!
87
+ redirect_unauthorized unless authenticate_company!(true)
88
+ end
89
+
90
+
91
+ def authenticate_company!(soft = false)
87
92
  return if authenticate_user
88
93
 
89
94
  @api_key = if params['key'].present?
@@ -94,7 +99,10 @@ module ShopliftClient
94
99
  Rails.configuration.settings['authlift_default_app_key']
95
100
  end
96
101
 
97
- fail ActionController::RoutingError, 'Authentication token missing' if @api_key.blank?
102
+ if @api_key.blank?
103
+ return false if soft
104
+ fail ActionController::RoutingError, 'Authentication token missing'
105
+ end
98
106
 
99
107
  response = srv.post 'auth/api_key',
100
108
  body: {
@@ -102,7 +110,10 @@ module ShopliftClient
102
110
  requested_action: "#{self.controller_name}##{self.action_name}"
103
111
  }
104
112
 
105
- fail ActionController::RoutingError, 'Request not authorized' if response.blank?
113
+ if response.blank?
114
+ return false if soft
115
+ fail ActionController::RoutingError, 'Request not authorized'
116
+ end
106
117
 
107
118
  @authentication = JSON.parse response.body
108
119
  find_company_by_code authentication['company']
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.5'
3
+ s.version = '0.0.6'
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.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zeljko