Class: Checkoff::Internal::SearchUrl::CustomFieldVariant::CustomFieldVariant
- Inherits:
-
Object
- Object
- Checkoff::Internal::SearchUrl::CustomFieldVariant::CustomFieldVariant
- Defined in:
- lib/checkoff/internal/search_url/custom_field_variant.rb,
sig/checkoff.rbs
Overview
base class for handling different custom_field_##gid.variant params
Direct Known Subclasses
AnyValue, ContainsAll, ContainsAny, DoesntContainAny, Equals, GreaterThan, Is, IsNot, LessThan, NoValue
Instance Attribute Summary collapse
- #gid ⇒ String readonly
- #remaining_params ⇒ Hash{String => Array<String>} readonly
Instance Method Summary collapse
-
#convert ⇒ [::Hash[String, String], ::Array[(Symbol | ::Array[untyped])]]
Implemented by every subclass.
- #ensure_no_remaining_params! ⇒ void
-
#fetch_solo_param(param_name) ⇒ String
@param
param_name. -
#initialize(gid, remaining_params) ⇒ CustomFieldVariant
constructor
@param
gid.
Constructor Details
#initialize(gid, remaining_params) ⇒ CustomFieldVariant
@param gid
@param remaining_params
13 14 15 16 |
# File 'lib/checkoff/internal/search_url/custom_field_variant.rb', line 13 def initialize(gid, remaining_params) @gid = T.let(gid, String) @remaining_params = T.let(remaining_params, T::Hash[String, T::Array[String]]) end |
Instance Attribute Details
#gid ⇒ String (readonly)
28 29 30 |
# File 'lib/checkoff/internal/search_url/custom_field_variant.rb', line 28 def gid @gid end |
#remaining_params ⇒ Hash{String => Array<String>} (readonly)
31 32 33 |
# File 'lib/checkoff/internal/search_url/custom_field_variant.rb', line 31 def remaining_params @remaining_params end |
Instance Method Details
#convert ⇒ [::Hash[String, String], ::Array[(Symbol | ::Array[untyped])]]
Implemented by every subclass.
21 22 23 |
# File 'lib/checkoff/internal/search_url/custom_field_variant.rb', line 21 def convert raise NotImplementedError end |
#ensure_no_remaining_params! ⇒ void
This method returns an undefined value.
34 35 36 37 38 |
# File 'lib/checkoff/internal/search_url/custom_field_variant.rb', line 34 def ensure_no_remaining_params! return if remaining_params.empty? raise "Teach me how to handle these remaining keys: #{remaining_params}" end |
#fetch_solo_param(param_name) ⇒ String
@param param_name
43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/checkoff/internal/search_url/custom_field_variant.rb', line 43 def fetch_solo_param(param_name) case remaining_params.keys when [param_name] # @type param_values [Array<String>] param_values = remaining_params.fetch(param_name) unless param_values.length == 1 raise "Teach me how to handle these remaining keys for #{param_name}: #{remaining_params}" end param_values.fetch(0) else raise "Teach me how to handle #{remaining_params}" end end |