ninja_van_api 0.2.19 → 0.2.20

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: e99318275edf40b8bb4577ba8cf3fdcfe12f74c890ec8b19c7b1fdab0e5d9a39
4
- data.tar.gz: c3a1ca3eae3aa687bdc7e825ebf5351fba4fdc73f3b7f9239e6200def042f2b3
3
+ metadata.gz: bf98d0353d3840d49fd319e69af2916a1b55562fd3ea0bc0b6213819b1b4197b
4
+ data.tar.gz: 7012d0cbc47bfb80ceba90efb3256ecbe21b8373811e2d1528a56eaf765f1135
5
5
  SHA512:
6
- metadata.gz: 46058f70e565a6ceb2c4346e094f275d4f9b63f3ab8d965b8515e4ceb2bb6190a25ef4b31af89735fff9b22d34d4bfe7c572d386fa91e1639c05fe2768b52f30
7
- data.tar.gz: 245cab12372c1ca615167487feef6088107c5355099adc61b6574af38b533117b9c97ed1827f419596dec704b268f9856d540db11f160a06b50162f9db5e4968
6
+ metadata.gz: 6df589c8bc14176fb7490b1a581aaa7434a8897aa323e9f200ea7605f7f37d758375c89b51d49396dc2d8404f9c07e85f1c252095194bd85687174fd54a83c97
7
+ data.tar.gz: 73bf32a5e80bf9c90b7e11ac46b092802ffcc4c3d1dd19b3a51dd5b78977b58e24fd9ab9c277568dda0186fe4cb8291610b2def277f7277a64ced7cea31f7813
@@ -5,7 +5,14 @@ module NinjaVanApi
5
5
 
6
6
  def create
7
7
  if NinjaVanApi.configuration.webhook_job_class
8
- NinjaVanApi.configuration.webhook_job_class.perform_later(webhook_params.to_h)
8
+ klass =
9
+ begin
10
+ job_class.constantize
11
+ rescue NameError
12
+ raise ArgumentError,
13
+ "webhook_job_class must be an ActiveJob class name or class that responds to perform_later"
14
+ end
15
+ klass.perform_later(webhook_params.to_h)
9
16
  head :ok
10
17
  else
11
18
  head :unprocessable_entity
@@ -6,7 +6,8 @@
6
6
  #
7
7
  module NinjaVanApi
8
8
  class Configuration
9
- attr_reader :webhook_secrets, :webhook_job_class
9
+ attr_reader :webhook_secrets
10
+ attr_accessor :webhook_job_class
10
11
 
11
12
  def webhook_secrets=(secrets)
12
13
  @webhook_secrets = secrets.transform_keys(&:downcase)
@@ -15,20 +16,6 @@ module NinjaVanApi
15
16
  def get_webhook_secret(country_code)
16
17
  @webhook_secrets[country_code.to_s.downcase]
17
18
  end
18
-
19
- def webhook_job_class=(job_class)
20
- return @webhook_job_class = nil if job_class.nil?
21
-
22
- begin
23
- klass = job_class.is_a?(String) ? job_class.constantize : job_class
24
- rescue NameError
25
- raise ArgumentError, "webhook_job_class must be an ActiveJob class name or class that responds to perform_later"
26
- end
27
- unless klass.is_a?(Class) && klass.respond_to?(:perform_later)
28
- raise ArgumentError, "webhook_job_class must be an ActiveJob class name or class that responds to perform_later"
29
- end
30
- @webhook_job_class = klass
31
- end
32
19
  end
33
20
 
34
21
  class << self
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module NinjaVanApi
4
- VERSION = "0.2.19"
4
+ VERSION = "0.2.20"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ninja_van_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.19
4
+ version: 0.2.20
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jane Trang Mai Nguyen