shopify_graphql 2.2.0 → 2.4.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 676b35a53c5124709bcb8760437d53e16678bfae111ddb757036df4c07d01fa0
4
- data.tar.gz: a32e7e86b6bb543e27d234098225a399e6f38e49e330f7d871f51547943a9eeb
3
+ metadata.gz: 5038269045bca2f01a4e7d1861ce592c3a862a58d3369a2ca69e8dc5b7beb0d8
4
+ data.tar.gz: 477823c3f50646817ac472f5ff4fe71bfb287078b75101fd6c8d6a669e6bb0b0
5
5
  SHA512:
6
- metadata.gz: c0f3ee5179384954a776d2afecc37a5377c123aecc99b352deb02fb71493792d911356c8a2a950ff9279cfaca0e39c2122d4f002e72ed43dee2e6e0e6e10de0b
7
- data.tar.gz: ef42df04753e9acd8b3f7b37cddb4c35195dc443fd67300ff5fdbc69487602e3f7dcbda0f5b49f92af52272ac7e56a3db070b9dcff9914753639f3f4d9c07fc9
6
+ metadata.gz: cff7fe23d0a706dc8bf49ccba92e8ee2b75caa6eaff3f69ede31a6bf95b37e96e8d60aa43f5c69867810019bf88671c8cf36c795f03254dc450a04faf783e023
7
+ data.tar.gz: 56bdd0133ec23c3b447d76375e6bcc9628f5db8b0217da885cf719047f521a0d456015bac41e9406de7115f2d6e33fd954bae89d807110445334a0f31ca36194
@@ -52,6 +52,7 @@ module ShopifyGraphql
52
52
  maxProductOptions
53
53
  maxProductVariants
54
54
  }
55
+ #FEATURES#
55
56
  }
56
57
  #LOCALES_SUBQUERY#
57
58
  }
@@ -62,11 +63,16 @@ module ShopifyGraphql
62
63
  primary
63
64
  }
64
65
  GRAPHQL
66
+ FEATURES_SUBQUERY = <<~GRAPHQL
67
+ features {
68
+ unifiedMarkets
69
+ }
70
+ GRAPHQL
65
71
 
66
72
  def call(with_locales: false)
67
73
  query = prepare_query(QUERY, with_locales: with_locales)
68
74
  response = execute(query)
69
- parse_data(response.data, with_locales: with_locales)
75
+ parse_data(response, with_locales: with_locales)
70
76
  end
71
77
 
72
78
  private
@@ -87,13 +93,19 @@ module ShopifyGraphql
87
93
  query.gsub!("#UPDATED_AT#", "updatedAt")
88
94
  query.gsub!("#SMS_CONSENT#", "marketingSmsConsentEnabledAtCheckout")
89
95
  end
96
+ if ShopifyAPI::Context.api_version.in?(%w[2024-01 2024-04 2024-07 2024-10 2025-01])
97
+ query.gsub!("#FEATURES#", "")
98
+ else
99
+ query.gsub!("#FEATURES#", FEATURES_SUBQUERY)
100
+ end
90
101
  query
91
102
  end
92
103
 
93
- def parse_data(data, with_locales: false)
104
+ def parse_data(response, with_locales: false)
105
+ data = response.data
94
106
  plan_display_name = ShopifyGraphql.normalize_plan_display_name(data.shop.plan.displayName)
95
107
  plan_name = ShopifyGraphql::DISPLAY_NAME_TO_PLAN[plan_display_name]
96
- response = OpenStruct.new(
108
+ shop_data = OpenStruct.new(
97
109
  id: data.shop.id.split("/").last.to_i,
98
110
  name: data.shop.name,
99
111
  email: data.shop.email,
@@ -133,13 +145,15 @@ module ShopifyGraphql
133
145
  enabled_presentment_currencies: data.shop.enabledPresentmentCurrencies,
134
146
  marketing_sms_consent_enabled_at_checkout: data.shop.marketingSmsConsentEnabledAtCheckout,
135
147
  max_product_options: data.shop.resourceLimits.maxProductOptions,
136
- max_product_variants: data.shop.resourceLimits.maxProductVariants
148
+ max_product_variants: data.shop.resourceLimits.maxProductVariants,
149
+ unified_markets: !!data.shop&.features&.unifiedMarkets,
150
+ graphql_points_limit: response.points_limit
137
151
  )
138
152
  if with_locales
139
- response.primary_locale = data.shopLocales.find(&:primary).locale
140
- response.shop_locales = data.shopLocales.map(&:locale)
153
+ shop_data.primary_locale = data.shopLocales.find(&:primary).locale
154
+ shop_data.shop_locales = data.shopLocales.map(&:locale)
141
155
  end
142
- response
156
+ shop_data
143
157
  end
144
158
  end
145
159
  end
@@ -1,3 +1,3 @@
1
1
  module ShopifyGraphql
2
- VERSION = "2.2.0"
2
+ VERSION = "2.4.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shopify_graphql
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.0
4
+ version: 2.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kirill Platonov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-05-18 00:00:00.000000000 Z
11
+ date: 2025-07-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails