Class: Gitlab::Triage::APIQueryBuilders::BaseQueryParamBuilder
- Inherits:
-
Object
- Object
- Gitlab::Triage::APIQueryBuilders::BaseQueryParamBuilder
- Defined in:
- lib/gitlab/triage/api_query_builders/base_query_param_builder.rb
Direct Known Subclasses
DateQueryParamBuilder, MultiQueryParamBuilder, SingleQueryParamBuilder
Instance Attribute Summary collapse
-
#allowed_values ⇒ Object
readonly
Returns the value of attribute allowed_values.
-
#param_contents ⇒ Object
readonly
Returns the value of attribute param_contents.
-
#param_name ⇒ Object
readonly
Returns the value of attribute param_name.
Instance Method Summary collapse
- #build_param ⇒ Object
-
#initialize(param_name, param_contents, allowed_values: nil) ⇒ BaseQueryParamBuilder
constructor
A new instance of BaseQueryParamBuilder.
- #validate_allowed_values! ⇒ Object private
Constructor Details
#initialize(param_name, param_contents, allowed_values: nil) ⇒ BaseQueryParamBuilder
Returns a new instance of BaseQueryParamBuilder.
9 10 11 12 13 14 15 |
# File 'lib/gitlab/triage/api_query_builders/base_query_param_builder.rb', line 9 def initialize(param_name, param_contents, allowed_values: nil) @param_name = param_name @param_contents = param_contents @allowed_values = allowed_values validate_allowed_values! if allowed_values end |
Instance Attribute Details
#allowed_values ⇒ Object (readonly)
Returns the value of attribute allowed_values.
7 8 9 |
# File 'lib/gitlab/triage/api_query_builders/base_query_param_builder.rb', line 7 def allowed_values @allowed_values end |
#param_contents ⇒ Object (readonly)
Returns the value of attribute param_contents.
7 8 9 |
# File 'lib/gitlab/triage/api_query_builders/base_query_param_builder.rb', line 7 def param_contents @param_contents end |
#param_name ⇒ Object (readonly)
Returns the value of attribute param_name.
7 8 9 |
# File 'lib/gitlab/triage/api_query_builders/base_query_param_builder.rb', line 7 def param_name @param_name end |
Instance Method Details
#build_param ⇒ Object
17 18 19 |
# File 'lib/gitlab/triage/api_query_builders/base_query_param_builder.rb', line 17 def build_param "&#{param_name}=#{param_content.strip}" end |
#validate_allowed_values! ⇒ Object (private)
23 24 25 |
# File 'lib/gitlab/triage/api_query_builders/base_query_param_builder.rb', line 23 def validate_allowed_values! ParamsValidator.new([{ name: param_name, type: String, values: allowed_values }], { param_name => param_contents }).validate! end |