smoothcode 0.0.2 → 1.0.0

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/smoothcode/auth.rb +11 -2
  3. metadata +6 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ff4a0cff790cc8b04fbed289e2de6390bd2d2267632ea746b9c1ce6cd2b4cd5b
4
- data.tar.gz: b8278888957fa47f498550a2405ca4c43a5d61dda48b222086ca04bd260e536a
3
+ metadata.gz: 4ba846674770db9e7109cf5ce90aa262c34528d85183bf841f7b665702cbba81
4
+ data.tar.gz: 610f09f311f76cc97198baaa4ef95cabc0a1d5fc901e8f215baab509575673b5
5
5
  SHA512:
6
- metadata.gz: 406f2b2d3086bf52f42e12ff18a91e6dda5a29b303ba853b870f4af5e78c49a30accd9e0d2b7fe37ceabe233b8259895effbe85ef0e8891f9970474ff651e372
7
- data.tar.gz: 1f6efec678605a23ed554bc435237cceb302ff6dc0a6e40a1ea7119d56ca37f00cf893b618a118a4ae4d0b991c4a76a4475207f2cc0e0647d1af5de31194aa7d
6
+ metadata.gz: 8f5a0160a247e1e12d12f717430445a3a0bd3e5fdd113d133d751021418443955af8b5cf33f741503d2086d9da1c86030bdc0846b1180fcff802623bb8e74fae
7
+ data.tar.gz: a09ebdb2cad9a4d01fc4c14192a830b6fc2fbd01af2da4cda33bb954a4402b71d8a95b640b5a94d5e77c7f340d56f7cc3ad04943d85cc956238d4c60b03ce14f
@@ -1,5 +1,4 @@
1
1
  require_relative 'utils'
2
- require 'json'
3
2
 
4
3
  class SmoothCodeAuth
5
4
  def initialize(request_hmac, client_secret)
@@ -12,6 +11,16 @@ class SmoothCodeAuth
12
11
  end
13
12
 
14
13
  def webhook_request?(webhook_data)
15
- generate_hmac(@client_secret, webhook_data.to_json) == @request_hmac
14
+ webhook_data = webhook_data.transform_keys(&:to_sym)
15
+ webhook_id = webhook_data[:shopify_webhook_uuid]
16
+
17
+ generate_hmac(@client_secret, webhook_id.to_s) == @request_hmac
18
+ end
19
+
20
+ def gdpr_webhook_request?(webhook_data)
21
+ webhook_data = webhook_data.transform_keys(&:to_sym)
22
+ shop_id = webhook_data[:shop_id]
23
+
24
+ generate_hmac(@client_secret, shop_id.to_s) == @request_hmac
16
25
  end
17
26
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: smoothcode
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - SmoothCode
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-01-24 00:00:00.000000000 Z
11
+ date: 2022-10-14 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Ruby client to interact with SmoothCode
14
14
  email: hello@smoothcode.io
@@ -23,7 +23,7 @@ homepage: https://github.com/Smooth-Code-IO/smoothcode-client-ruby
23
23
  licenses:
24
24
  - MIT
25
25
  metadata: {}
26
- post_install_message:
26
+ post_install_message:
27
27
  rdoc_options: []
28
28
  require_paths:
29
29
  - lib
@@ -38,8 +38,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
38
38
  - !ruby/object:Gem::Version
39
39
  version: '0'
40
40
  requirements: []
41
- rubygems_version: 3.0.3.1
42
- signing_key:
41
+ rubygems_version: 3.0.9
42
+ signing_key:
43
43
  specification_version: 4
44
44
  summary: Ruby client to interact with SmoothCode
45
45
  test_files: []