e_plat 0.4.2 → 0.4.4

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
  SHA256:
3
- metadata.gz: 21cc14088c5f2804d52659aab7cfedb0ec808d42a1beb5a8a29ad4525f670d36
4
- data.tar.gz: 24f4aba2574e129d4b8f00b7a4ddbefe71ddf3465cd2b5336348c94870685be8
3
+ metadata.gz: e1f621f479c0a566e9fafdc11e156345ad172ba623a3049b5f64fb67db915f04
4
+ data.tar.gz: 67b1a319ed52a56d5004c6cf5e164eafb602003db6c1855e2eb57e6e6ba3f8bb
5
5
  SHA512:
6
- metadata.gz: 3b95cf6b98b113934622fd3a093469646749e51c92dd268626419ca3da8ec0573461908087bb99a3a91c43e895e77c702ed7f6c6149df4c40a2f7632b73ea1a0
7
- data.tar.gz: e42d9978e0dcecea62c891a907527a050dbbe89b0a1e7d72cb4c490f633eb21a4dad71ea1d0d0898f905637cc4984175c680309a20b8677cc453b42cb3584230
6
+ metadata.gz: e1fe8a237089d3528670cdc40f107e994a32f4bf10f3877af0758f7365a80a39bfe96e7f61c3fb464ed19b0f9a0e280e1c304f56e5e06c9ac5476577e02f18f1
7
+ data.tar.gz: 4964a6ab6ef2fcec16cefd24ed792db0e717f1baea0db72b3a8f687d9e1705fe6c9d89b6f07664395563a80f66dfc3660eb9fb6d7ec872fa2a494cb551f2aef5
data/README.md CHANGED
@@ -44,6 +44,9 @@ You can configure which platform APIs are used by updating the EPlat config: <br
44
44
  EPlat.config.shopify_api_version = "2024-01"
45
45
  EPlat.config.bigcommerce_api_version = "v3"
46
46
  EPlat.config.woocommerce_api_version = "v3"
47
+
48
+ # EPlat.api_display_name.shopify #=> "2024-01" # presents as the platform would display in URL paths
49
+ # EPlat.config.shopify_api_version #=> "2024_01" # coerced interally for creating constants
47
50
  ```
48
51
  <br>
49
52
 
@@ -17,7 +17,7 @@ module EPlat
17
17
 
18
18
  if type.nil?
19
19
  return value
20
- elsif value.nil?
20
+ elsif value.nil? or value == "null"
21
21
  return unless type == "array" or type == "hash"
22
22
  end
23
23
 
@@ -1,3 +1,3 @@
1
1
  module EPlat
2
- VERSION = "0.4.2"
2
+ VERSION = "0.4.4"
3
3
  end
data/lib/e_plat.rb CHANGED
@@ -32,7 +32,16 @@ module EPlat
32
32
  SUPPORTED_BIGCOMMERCE_API_VERSIONS.include?(v) ? v : raise(ArgumentError, "Bigcommerce API version #{value} is not supported")
33
33
  end)
34
34
 
35
- setting(:woocommerce_api_version, default: "v3", constructor: ->(value) { value.downcase.gsub("v", "") })
35
+ setting(:woocommerce_api_version, default: "v3", constructor: ->(value) { value.downcase.gsub("v", "") })
36
+
37
+ def self.api_display_name
38
+ apis = Struct.new(:shopify, :bigcommerce, :woocommerce)
39
+ apis.new(
40
+ shopify: config.shopify_api_version&.dasherize, # "2024-01"
41
+ bigcommerce: "v#{config.bigcommerce_api_version}", # "v3"
42
+ woocommerce: "v#{config.woocommerce_api_version}" # "v3"
43
+ )
44
+ end
36
45
 
37
46
  class Error < StandardError; end
38
47
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: e_plat
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.4.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - oliwoodsuk
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-12-08 00:00:00.000000000 Z
11
+ date: 2023-12-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler