e_plat 0.9.3 → 0.9.5
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/lib/e_plat/resource/base.rb +2 -0
 - data/lib/e_plat/resource/concerns/graph_q_lable.rb +9 -6
 - data/lib/e_plat/version.rb +1 -1
 - data/lib/hash.rb +7 -2
 - metadata +2 -2
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: be649894d10289f2e819cf9ceae86f35234e552b6c457ba3e356ec064d70a3bd
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 8dbb27b6fa5d3467db671b327363556042cf5c8752299a09543a036347ad3b3d
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 151af389bf7b8afa5fa8ba9c838904f3ca9af0f03811fb1da7cfdb50a0115253ae25a19fb157042a58cc61bc2ece75c07d0aabb5d435002b5a20389751a1bdbe
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 04b97b60a1ea1b42f839c00f413431b934ec6697c4ee1652bc502c2f83da2ad520b52d9e3b98c8dda1c8b754a8c7b2b242cce3ba9f2d4f2295680c4b1e7fc80b
         
     | 
    
        data/lib/e_plat/resource/base.rb
    CHANGED
    
    
| 
         @@ -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) 
     | 
| 
       108 
     | 
    
         
            -
                                query: graphql_query_arg(**args)
         
     | 
| 
       109 
     | 
    
         
            -
             
     | 
| 
      
 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 
     | 
| 
      
 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) 
     | 
| 
      
 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
         
     | 
    
        data/lib/e_plat/version.rb
    CHANGED
    
    
    
        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 
     | 
    
         
            -
                                 
     | 
| 
      
 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. 
     | 
| 
      
 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- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2024-06-26 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: bundler
         
     |