e_plat 0.9.2 → 0.9.4

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: 11486ca4e2fa5fb088c3db3ba83cbe6084743d680433930434a396c72d5c9171
4
- data.tar.gz: 18f2edac7726f48202c5190efa90d6fc8a460f9582df92cbb382897fa160b450
3
+ metadata.gz: f15115fcac710ac144cf20a7c2bd2d717e1d347a7f69064b4e2d4f212c7fbdc4
4
+ data.tar.gz: 61f4bfa040d4d0d5f084f895f31830399d9bdf1a29ed4bd4f12c17cfbf21baf2
5
5
  SHA512:
6
- metadata.gz: 435b1d3159de9901f5ef5861a2531d44291d817ada8916e4a15fb7bd7047359734ed3a28055699281c10044f762b2a4b407ceddcc72ae139f8dc42bc2b3c8a19
7
- data.tar.gz: fa6904dee0a4bc822219af558319fac7c4849862765b36f56009fe19f631a2d632f40dc0c6ee34753ebfc5167c8afbee7c47c7f9ac56518094f355c244e59926
6
+ metadata.gz: 6a8d3cea218141e171e0e55737c7ed0ff89f7cb6493646b3762339c8b4a2492c22b07f240c20ceefb2033121464aa775b61426186b0d03aa9e7cd2b2ddd9a551
7
+ data.tar.gz: 55108b4a03da42c031dffe2a2e6b656a59d5b0a17692e572b2b4d712dd6768aef167a6003f270cdbef1360c6e305894696d0bb869eadefaafd1aef48b5c7aa76
@@ -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)
@@ -19,7 +19,6 @@ class EPlat::Shopify::Product::Variant < EPlat::Product::Variant
19
19
  position
20
20
  inventoryPolicy
21
21
  compareAtPrice
22
- inventoryManagement
23
22
  selectedOptions {
24
23
  #{ OptionValue.graphql_fields }
25
24
  }
@@ -27,7 +26,6 @@ class EPlat::Shopify::Product::Variant < EPlat::Product::Variant
27
26
  updatedAt
28
27
  taxable
29
28
  barcode
30
- weight
31
29
  image {
32
30
  #{ EPlat::Shopify::Product::Image.graphql_fields }
33
31
  }
@@ -1,3 +1,3 @@
1
1
  module EPlat
2
- VERSION = "0.9.2"
2
+ VERSION = "0.9.4"
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.2
4
+ version: 0.9.4
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-09 00:00:00.000000000 Z
11
+ date: 2024-06-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler