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.
7 8 9 10 11 12 13 |
# File 'lib/gitlab/triage/api_query_builders/base_query_param_builder.rb', line 7 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.
5 6 7 |
# File 'lib/gitlab/triage/api_query_builders/base_query_param_builder.rb', line 5 def allowed_values @allowed_values end |
#param_contents ⇒ Object (readonly)
Returns the value of attribute param_contents.
5 6 7 |
# File 'lib/gitlab/triage/api_query_builders/base_query_param_builder.rb', line 5 def param_contents @param_contents end |
#param_name ⇒ Object (readonly)
Returns the value of attribute param_name.
5 6 7 |
# File 'lib/gitlab/triage/api_query_builders/base_query_param_builder.rb', line 5 def param_name @param_name end |
Instance Method Details
#build_param ⇒ Object
15 16 17 |
# File 'lib/gitlab/triage/api_query_builders/base_query_param_builder.rb', line 15 def build_param "&#{param_name}=#{param_content.strip}" end |
#validate_allowed_values! ⇒ Object (private)
21 22 23 |
# File 'lib/gitlab/triage/api_query_builders/base_query_param_builder.rb', line 21 def validate_allowed_values! ParamsValidator.new([{ name: param_name, type: String, values: allowed_values }], { param_name => param_contents }).validate! end |