e_plat 0.9.3 → 0.9.5

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: 43a137020cfcc88dc95a9d4b32fdcb0150d3474125a2a17796c7c874ae1aa0f8
4
- data.tar.gz: 7b163665da1e8e5143ba20c8e454e7ad3fdc627ee26203e322881c21b79db9ce
3
+ metadata.gz: be649894d10289f2e819cf9ceae86f35234e552b6c457ba3e356ec064d70a3bd
4
+ data.tar.gz: 8dbb27b6fa5d3467db671b327363556042cf5c8752299a09543a036347ad3b3d
5
5
  SHA512:
6
- metadata.gz: d149e128db87402478a073adfbd1ea10ba843c0bbeaa1c4c030b684b0ed4193424175f73d80ca2ff355065a1eb3ff58383ecea87e7e4318a1ea8f3f12807e08d
7
- data.tar.gz: 006d387ac4e3e41f2e2bcdcfe39555a334aa8c0a8372005b7c34152e285e5d9c184c49d2cee63e8a44e7b2aa125eb03c8536eb4cb68c62d284d00feacb48c4f2
6
+ metadata.gz: 151af389bf7b8afa5fa8ba9c838904f3ca9af0f03811fb1da7cfdb50a0115253ae25a19fb157042a58cc61bc2ece75c07d0aabb5d435002b5a20389751a1bdbe
7
+ data.tar.gz: 04b97b60a1ea1b42f839c00f413431b934ec6697c4ee1652bc502c2f83da2ad520b52d9e3b98c8dda1c8b754a8c7b2b242cce3ba9f2d4f2295680c4b1e7fc80b
@@ -147,6 +147,8 @@ module EPlat
147
147
  "gid://shopify/ProductVariant/#{id}"
148
148
  when "image"
149
149
  "gid://shopify/ProductImage/#{id}"
150
+ when "order"
151
+ "gid://shopify/Order/#{id}"
150
152
  else
151
153
  raise EPlat::Errors.new("Unsupported element name")
152
154
  end
@@ -8,7 +8,7 @@ module EPlat
8
8
  class_attribute :before_graphql_callbacks, default: {}
9
9
  end
10
10
 
11
- FILTER_ARGS = [:id, :after, :before, :last, :first].freeze
11
+ FILTER_ARGS = [:id, :after, :before, :last, :first, :sort_key, :reverse].freeze
12
12
  QUERY_ARG_ARGS = [:available_for_sale, :created_at, :product_type, :product_id, :tag, :tag_not, :title, :updated_at, :vendor].freeze
13
13
 
14
14
  class_methods do
@@ -104,17 +104,18 @@ module EPlat
104
104
  end
105
105
 
106
106
  def graphql_query_with_args(graphql, args)
107
- params = filter_graphql_args(**args).merge(
108
- query: graphql_query_arg(**args)
109
- ).compact_blank
107
+ params = filter_graphql_args(**args)
108
+ .merge(query: graphql_query_arg(**args))
109
+ .compact_blank
110
+ .deep_transform_keys{ _1.to_s.camelize(:lower) }
110
111
 
111
- graphql.call(params.to_graphql_args)
112
+ graphql.call params.to_graphql_args(enum_friendly: true)
112
113
  end
113
114
 
114
115
  def filter_graphql_args(**args)
115
116
  arguments = sanitize_filter_args args.with_indifferent_access
116
117
 
117
- arguments.slice(*FILTER_ARGS).deep_stringify_keys
118
+ arguments.slice(*FILTER_ARGS)
118
119
  end
119
120
 
120
121
  def sanitize_filter_args(args)
@@ -202,6 +203,8 @@ module EPlat
202
203
  "gid://shopify/ProductVariant/#{id}"
203
204
  when "image"
204
205
  "gid://shopify/ProductImage/#{id}"
206
+ when "order"
207
+ "gid://shopify/Order/#{id}"
205
208
  else
206
209
  raise EPlat::Errors.new("Unsupported element name")
207
210
  end
@@ -1,3 +1,3 @@
1
1
  module EPlat
2
- VERSION = "0.9.3"
2
+ VERSION = "0.9.5"
3
3
  end
data/lib/hash.rb CHANGED
@@ -1,10 +1,15 @@
1
1
  class Hash
2
- def to_graphql_args
2
+ def to_graphql_args(enum_friendly: false)
3
3
  map do |key, value|
4
4
  formatted_value =
5
5
  case value
6
6
  when String
7
- "\"#{value}\""
7
+ if enum_friendly
8
+ # uppercase strings wont be wrapped in quotes
9
+ value.match?(/\A[A-Z_]+\z/) ? value : "\"#{value}\""
10
+ else
11
+ "\"#{value}\""
12
+ end
8
13
  when Hash
9
14
  value.to_graphql_args
10
15
  else
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.9.3
4
+ version: 0.9.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - oliwoodsuk
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-06-13 00:00:00.000000000 Z
11
+ date: 2024-06-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler