disco_app 0.10.0 → 0.10.1

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
  SHA256:
3
- metadata.gz: 285d584cb7956611a8b08c8953cf35351d99f016b4e50c92952206bcab8cbfcb
4
- data.tar.gz: 2c5914c7710a458e119c13f974cef9e342c46581711246e61f5a88c656e0aa6e
3
+ metadata.gz: 40cd49bbcbb382cf534d7b92d20b3235d75dfd1d8c0543fcc9829ec3895af6ac
4
+ data.tar.gz: 7b5457cb9d1d4d6ea0880ba979535d326e255d5b992fec7390f83a3c0dbdbbe3
5
5
  SHA512:
6
- metadata.gz: 21019b2b798f8141eaada02664aee5c9cf97aa751f2923afcfb12d7104d525055ee38ea6fb05581b1c440904e870accc6a5ef5f559f7a9139264e46102a5001d
7
- data.tar.gz: 208e54ea47e1e1b7a244f472a83a1a56ad1b7dfa80c86379d1fd1a723db48c1aa0c2610dc917353b44d32346e6ef2b0ba137fa49c6a3cbc1d41716177525d21b
6
+ metadata.gz: 2f18163091ba171e4ef44f0563b7815d70c46ecdd93341aaa1d6a0525ea3face8fb7da2213c481721432d4005c98786e5dc7f25f328e0317c2df4ca0a4eae090
7
+ data.tar.gz: b9f7ebc827d2b16293c2a9ef260ce5c879c19b43f67b429e5e909f09382cb9c85297a04208af62db6b6691de2c8d7bfe900700396cedd8d217894cb059fdcb99
@@ -3,6 +3,8 @@ module DiscoApp::Concerns::CarrierRequestController
3
3
 
4
4
  included do
5
5
  before_action :verify_carrier_request
6
+ before_action :find_shop
7
+ before_action :validate_rate_params
6
8
  end
7
9
 
8
10
  private
@@ -18,4 +20,16 @@ module DiscoApp::Concerns::CarrierRequestController
18
20
  DiscoApp::CarrierRequestService.is_valid_hmac?(request.body.read.to_s, ShopifyApp.configuration.secret, request.headers['HTTP_X_SHOPIFY_HMAC_SHA256'])
19
21
  end
20
22
 
23
+ def find_shop
24
+ unless (@shop = DiscoApp::Shop.find_by_shopify_domain(request.headers['HTTP_X_SHOPIFY_SHOP_DOMAIN']))
25
+ head :unauthorized
26
+ end
27
+ end
28
+
29
+ def validate_rate_params
30
+ unless params[:rate].present? and params[:rate][:origin].present? and params[:rate][:destination].present? and params[:rate][:items].present?
31
+ head :bad_request
32
+ end
33
+ end
34
+
21
35
  end
@@ -1,3 +1,3 @@
1
1
  module DiscoApp
2
- VERSION = '0.10.0'
2
+ VERSION = '0.10.1'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: disco_app
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.0
4
+ version: 0.10.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gavin Ballard