e_plat 0.4.3 → 0.5.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.
- checksums.yaml +4 -4
- data/README.md +5 -2
- data/lib/e_plat/current.rb +9 -0
- data/lib/e_plat/resource/base.rb +2 -2
- data/lib/e_plat/resource/collection.rb +1 -1
- data/lib/e_plat/session.rb +3 -3
- data/lib/e_plat/version.rb +1 -1
- data/lib/e_plat.rb +10 -1
- metadata +3 -3
- data/lib/current.rb +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7940bc3d4b8d6b21b3ac8b36eba083a7cfea37fabd1161bca997c47338038b9b
|
4
|
+
data.tar.gz: 1d8ce726804d61e44f5b1c5e9675309219cfc03619b6bb7be3733cbd1f683e9e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 04c6492c9a0d3d79769e5223c6b16ba1672a088cc5ff7baa9a94e942c555b9e0b6134881c96db1f8f7cb5bc32cff70d97a796e1725a6a6a998d69835a50a6dd6
|
7
|
+
data.tar.gz: 6355bcf307dbe5d0ef1fe660510f142390ee01a7e0a0e45fe1fc2b3379a00b28350b5b5151625dde045e0e73b2ac74ead4e591d6539afffd1d76f0d239a24b12
|
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
|
|
@@ -80,7 +83,7 @@ EPlat is designed to let you mostly use it's universal interface, but then easil
|
|
80
83
|
event: :onload,
|
81
84
|
src: "https://preproduct.io/mini-script.js"
|
82
85
|
)
|
83
|
-
tag.name = "mini script" if Current.e_plat_session.bigcommerce?
|
86
|
+
tag.name = "mini script" if EPlat::Current.e_plat_session.bigcommerce?
|
84
87
|
tag.save
|
85
88
|
|
86
89
|
# ...when session is a Shopify store
|
@@ -579,7 +582,7 @@ Unfortunately it's in a Time Integer format. Haven't yet got dynamic conversion
|
|
579
582
|
# <%= link_to "previous products", "/", page_info: products.previous_page_info %>
|
580
583
|
# <%= link_to "Next products", "/", page_info: products.next_page_info %>
|
581
584
|
|
582
|
-
EPlat::Product.find(:all, params: {limit: 2, Current.e_plat_session.pagination_param => params['page_info'] })
|
585
|
+
EPlat::Product.find(:all, params: {limit: 2, EPlat::Current.e_plat_session.pagination_param => params['page_info'] })
|
583
586
|
```
|
584
587
|
|
585
588
|
|
data/lib/e_plat/resource/base.rb
CHANGED
@@ -30,7 +30,7 @@ module EPlat
|
|
30
30
|
end
|
31
31
|
|
32
32
|
def client
|
33
|
-
Current.e_plat_session
|
33
|
+
EPlat::Current.e_plat_session
|
34
34
|
end
|
35
35
|
|
36
36
|
|
@@ -87,7 +87,7 @@ module EPlat
|
|
87
87
|
end
|
88
88
|
|
89
89
|
def client
|
90
|
-
Current.e_plat_session
|
90
|
+
EPlat::Current.e_plat_session
|
91
91
|
end
|
92
92
|
|
93
93
|
def mapped?(attribute)
|
data/lib/e_plat/session.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
|
2
2
|
module EPlat
|
3
3
|
class Session
|
4
|
-
#the session is an instance of EPlat::Client made available via Rails Current::Attributes
|
4
|
+
#the session is an instance of EPlat::Client made available via Rails EPlat::Current::Attributes
|
5
5
|
|
6
6
|
def initialize(platform:, store_url:, api_token:, store_hash: nil)
|
7
|
-
Current.e_plat_session = EPlat::Client.new(
|
7
|
+
EPlat::Current.e_plat_session = EPlat::Client.new(
|
8
8
|
platform: platform,
|
9
9
|
store_url: store_url,
|
10
10
|
api_token: api_token,
|
@@ -13,7 +13,7 @@ module EPlat
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def self.clear!
|
16
|
-
Current.e_plat_session = nil
|
16
|
+
EPlat::Current.e_plat_session = nil
|
17
17
|
end
|
18
18
|
|
19
19
|
end
|
data/lib/e_plat/version.rb
CHANGED
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",
|
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
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- oliwoodsuk
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-01-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -207,12 +207,12 @@ files:
|
|
207
207
|
- lib/active_resource/connection_error.rb
|
208
208
|
- lib/active_resource/formats.rb
|
209
209
|
- lib/active_resource/schema.rb
|
210
|
-
- lib/current.rb
|
211
210
|
- lib/e_plat.rb
|
212
211
|
- lib/e_plat/client.rb
|
213
212
|
- lib/e_plat/client/default_request_args.rb
|
214
213
|
- lib/e_plat/client/platform_convenience_methods.rb
|
215
214
|
- lib/e_plat/connection.rb
|
215
|
+
- lib/e_plat/current.rb
|
216
216
|
- lib/e_plat/engine.rb
|
217
217
|
- lib/e_plat/errors/incorrect_type_error.rb
|
218
218
|
- lib/e_plat/errors/missing_migration_key_error.rb
|