pack_api 1.0.10 → 1.0.12

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: 490e387a433947e755a6a1fcad3a58efa3cb5f561c4a9510bcc0ab1eebe3e653
4
- data.tar.gz: 4848692f1bbdc5ae4972c262dcd850f9e5805487e55bc152affd37eb5bc527b2
3
+ metadata.gz: c66fe371350245afa91cfa038ffc0ab62ef59455a8251dbb7ff1461211299f9f
4
+ data.tar.gz: 89ebb63e52330e78f940bf5c8104793f8b5ceadb317ed67fb4a43c8b3f781626
5
5
  SHA512:
6
- metadata.gz: 703ac469f2bb2b940bced8496f1159b4c0567d079a8433c15c59b549dbbbf015f6bf9f8679afc3f7a14b968a1666755f8da31677d89eda4623857f19289ddc96
7
- data.tar.gz: 01c2a1f54bf5a2763487e5ab4b203e796e4bba34dc187aefea25db685ce8c4e32ea2944f0479d535098fbbf8b8c287570a4cb54c736bda9e34fb6a7c1ca7f002
6
+ metadata.gz: 53a7ea4535c32a9047d77d85399eb1e30b44d1d3f3bd4b31b8ecdd5ca9829d0892785bb35b47f60f45251b6f475175583492225eda8c76c46325681b22982979
7
+ data.tar.gz: c10c5ffeded718d3cfad0ad9835d2630be7936b8ac0569bbbe014ef5bdf66696ef4ea0c70947e3126b07d9f5d1f517a86ddbd838699822a26149f7abc7ae6ecb
@@ -2,12 +2,15 @@
2
2
 
3
3
  module PackAPI::Querying
4
4
  class ComposableQuery
5
- def initialize(initial_query)
5
+ attr_reader :composer
6
+
7
+ def initialize(initial_query, composer: :merge)
6
8
  @query = initial_query
9
+ @composer = composer
7
10
  end
8
11
 
9
12
  def add(query_clause)
10
- @query = @query.merge(query_clause)
13
+ @query = @query.send(composer, query_clause)
11
14
  self
12
15
  end
13
16
 
@@ -6,12 +6,17 @@ module PackAPI::Querying
6
6
  class_methods do
7
7
  def type = :dynamic_enum
8
8
 
9
- def can_exclude? = false
10
-
11
- def search_for_options(relation:, search:) = raise NotImplementedError
9
+ ###
10
+ # Retrieve options for this filter based on user input.
11
+ # @param relation [ActiveRecord::Relation] The base relation to query against for options.
12
+ # @param search [String, nil] An optional search term to filter options by (using wildcard matching)
13
+ # @param value [String, Array<String>, nil] An optional value or array of values to filter options by (exact match)
14
+ def dynamic_options(relation:, search: nil, value: nil) = raise NotImplementedError
12
15
 
13
16
  private
14
17
 
18
+ ###
19
+ # Static filter options is an empty array.
15
20
  def filter_options(**) = PackAPI::FrozenEmpty::ARRAY
16
21
  end
17
22
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PackAPI
4
- VERSION = "1.0.10"
4
+ VERSION = "1.0.12"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pack_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.10
4
+ version: 1.0.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Flytedesk