active_shopify_graphql 0.2.0 → 0.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.
@@ -27,6 +27,8 @@ module ActiveShopifyGraphQL
27
27
  # @return [String] The formatted query condition
28
28
  def format_condition(key, value)
29
29
  case value
30
+ when Array
31
+ format_array_condition(key, value)
30
32
  when String
31
33
  format_string_condition(key, value)
32
34
  when Numeric, true, false
@@ -38,6 +40,36 @@ module ActiveShopifyGraphQL
38
40
  end
39
41
  end
40
42
 
43
+ # Formats an array condition with OR clauses
44
+ # @param key [String] The attribute name
45
+ # @param values [Array] The array of values
46
+ # @return [String] The formatted query with OR clauses wrapped in parentheses
47
+ def format_array_condition(key, values)
48
+ return "" if values.empty?
49
+ return format_condition(key, values.first) if values.size == 1
50
+
51
+ or_parts = values.map do |value|
52
+ format_single_value(key, value)
53
+ end
54
+
55
+ "(#{or_parts.join(' OR ')})"
56
+ end
57
+
58
+ # Formats a single value for use in array OR clauses
59
+ # @param key [String] The attribute name
60
+ # @param value [Object] The attribute value
61
+ # @return [String] The formatted key:value pair
62
+ def format_single_value(key, value)
63
+ case value
64
+ when String
65
+ format_string_condition(key, value)
66
+ when Numeric, true, false
67
+ "#{key}:#{value}"
68
+ else
69
+ "#{key}:#{value}"
70
+ end
71
+ end
72
+
41
73
  # Formats a string condition with proper quoting
42
74
  def format_string_condition(key, value)
43
75
  # Handle special string values and escape quotes
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ActiveShopifyGraphQL
4
- VERSION = "0.2.0"
4
+ VERSION = "0.4.0"
5
5
  end
@@ -23,6 +23,8 @@ require_relative "active_shopify_graphql/loaders/customer_account_api_loader"
23
23
  require_relative "active_shopify_graphql/loader_switchable"
24
24
  require_relative "active_shopify_graphql/finder_methods"
25
25
  require_relative "active_shopify_graphql/associations"
26
+ require_relative "active_shopify_graphql/graphql_associations"
27
+ require_relative "active_shopify_graphql/includes_scope"
26
28
  require_relative "active_shopify_graphql/connections"
27
29
  require_relative "active_shopify_graphql/attributes"
28
30
  require_relative "active_shopify_graphql/metafield_attributes"
@@ -31,4 +33,5 @@ require_relative "active_shopify_graphql/base"
31
33
 
32
34
  module ActiveShopifyGraphQL
33
35
  class Error < StandardError; end
36
+ class ObjectNotFoundError < Error; end
34
37
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_shopify_graphql
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nicolò Rebughini
@@ -52,34 +52,6 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '1.3'
55
- - !ruby/object:Gem::Dependency
56
- name: rspec
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - "~>"
60
- - !ruby/object:Gem::Version
61
- version: '3.0'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - "~>"
67
- - !ruby/object:Gem::Version
68
- version: '3.0'
69
- - !ruby/object:Gem::Dependency
70
- name: rubocop
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - "~>"
74
- - !ruby/object:Gem::Version
75
- version: '1.0'
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - "~>"
81
- - !ruby/object:Gem::Version
82
- version: '1.0'
83
55
  description: ActiveShopifyGraphQL provides an ActiveRecord-like interface for interacting
84
56
  with Shopify's GraphQL APIs, supporting both Admin API and Customer Account API
85
57
  with automatic query building and response mapping.
@@ -107,7 +79,9 @@ files:
107
79
  - lib/active_shopify_graphql/finder_methods.rb
108
80
  - lib/active_shopify_graphql/fragment_builder.rb
109
81
  - lib/active_shopify_graphql/gid_helper.rb
82
+ - lib/active_shopify_graphql/graphql_associations.rb
110
83
  - lib/active_shopify_graphql/graphql_type_resolver.rb
84
+ - lib/active_shopify_graphql/includes_scope.rb
111
85
  - lib/active_shopify_graphql/loader.rb
112
86
  - lib/active_shopify_graphql/loader_context.rb
113
87
  - lib/active_shopify_graphql/loader_switchable.rb
@@ -125,6 +99,7 @@ licenses:
125
99
  metadata:
126
100
  homepage_uri: https://github.com/nebulab/active_shopify_graphql
127
101
  source_code_uri: https://github.com/nebulab/active_shopify_graphql
102
+ rubygems_mfa_required: 'true'
128
103
  post_install_message:
129
104
  rdoc_options: []
130
105
  require_paths: