discourse_subscription_client 0.1.0.pre8 → 0.1.0.pre10

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: 9f0f41208625ee7dae4b1fac9ca417face2e5315022bcfee6a2cb833c95d6a71
4
- data.tar.gz: 57e366e12e511c7b9645b8bcd8477086746271f8ed5de32bde240b9042f5aa28
3
+ metadata.gz: 7be1c54ac40f2c0221c35038e20c1daa1fac8f39c0736d11a858f805a6220791
4
+ data.tar.gz: d8a564f4d2c9bc8ef052a47719c42dcc36df45ba42d8848d32fd6a8d03b0c8cb
5
5
  SHA512:
6
- metadata.gz: 332fbf8b9062de3f2b3a2363ea8986b8f95cd4365920822f55c8820dba8c3ff12aa66b384ff340cd2f80697469a3fbfc3bd9ff604d9ba5d7f1ed7bb0e3eb41ae
7
- data.tar.gz: 8fde036341f92aa573c9a646963afe5ee1c7f3f520a3692fd4ad5c80e9d840829e831debfd9ca42806284f5386e440e31c759bd823133aae318fc55ec414fa59
6
+ metadata.gz: f401dbabaa835f14619e4aa3263cee2df00048ae43c8fabd9fdae16e5c99806b6caf09896d4470c32923be77fe0a6b73d0efcd97589394d601647e3614e18d6a
7
+ data.tar.gz: 0f10faf5cd3ed514bee5ef10555846c3c66f278e3adc8360a04d4ce8e5f56a12122aa86ed763b8c1988ca4815b39432d06219a1f981f4b0919244d387c4091e5
@@ -24,8 +24,12 @@ class SubscriptionClientSupplier < ActiveRecord::Base
24
24
  end
25
25
 
26
26
  def product_slugs
27
- @product_slugs ||= products.each_with_object({}) do |product, result|
28
- result[product["product_id"]] = product["product_slug"]
27
+ if products.present?
28
+ products.each_with_object({}) do |product, result|
29
+ result[product["product_id"]] = product["product_slug"]
30
+ end
31
+ else
32
+ {}
29
33
  end
30
34
  end
31
35
 
@@ -95,6 +95,7 @@ module DiscourseSubscriptionClient
95
95
  end
96
96
 
97
97
  def valid_supplier_data?(data)
98
+ return false unless data.present? && data.is_a?(Hash)
98
99
  return false unless %i[supplier products].all? { |key| data.key?(key) }
99
100
  return false unless data[:supplier].is_a?(String)
100
101
  return false unless data[:products].is_a?(Array)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DiscourseSubscriptionClient
4
- VERSION = "0.1.0.pre8"
4
+ VERSION = "0.1.0.pre10"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: discourse_subscription_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0.pre8
4
+ version: 0.1.0.pre10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Angus McLeod