Class: Committee::SchemaValidator::Option
- Inherits:
-
Object
- Object
- Committee::SchemaValidator::Option
- Defined in:
- lib/committee/schema_validator/option.rb
Instance Attribute Summary collapse
-
#allow_blank_structures ⇒ Object
readonly
Boolean Options.
-
#allow_form_params ⇒ Object
readonly
Boolean Options.
-
#allow_get_body ⇒ Object
readonly
Boolean Options.
-
#allow_query_params ⇒ Object
readonly
Boolean Options.
-
#check_content_type ⇒ Object
readonly
Boolean Options.
-
#check_header ⇒ Object
readonly
Boolean Options.
-
#coerce_date_times ⇒ Object
readonly
Boolean Options.
-
#coerce_form_params ⇒ Object
readonly
Boolean Options.
-
#coerce_path_params ⇒ Object
readonly
Boolean Options.
-
#coerce_query_params ⇒ Object
readonly
Boolean Options.
-
#coerce_recursive ⇒ Object
readonly
Boolean Options.
-
#headers_key ⇒ Object
readonly
Non-boolean options:.
-
#optimistic_json ⇒ Object
readonly
Boolean Options.
-
#parameter_overwrite_by_rails_rule ⇒ Object
readonly
Boolean Options.
-
#params_key ⇒ Object
readonly
Non-boolean options:.
-
#parse_response_by_content_type ⇒ Object
readonly
Boolean Options.
-
#path_hash_key ⇒ Object
readonly
Non-boolean options:.
-
#prefix ⇒ Object
readonly
Non-boolean options:.
-
#query_hash_key ⇒ Object
readonly
Non-boolean options:.
-
#request_body_hash_key ⇒ Object
readonly
Non-boolean options:.
-
#validate_success_only ⇒ Object
readonly
Boolean Options.
Instance Method Summary collapse
-
#initialize(options, schema, schema_type) ⇒ Option
constructor
A new instance of Option.
Constructor Details
#initialize(options, schema, schema_type) ⇒ Option
Returns a new instance of Option.
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/committee/schema_validator/option.rb', line 31 def initialize(, schema, schema_type) # Non-boolean options @headers_key = [:headers_key] || "committee.headers" @params_key = [:params_key] || "committee.params" @query_hash_key = [:query_hash_key] || "committee.query_hash" @path_hash_key = [:path_hash_key] || "committee.path_hash" @request_body_hash_key = [:request_body_hash_key] || "committee.request_body_hash" @prefix = [:prefix] # Boolean options and have a common value by default @allow_blank_structures = .fetch(:allow_blank_structures, false) @allow_form_params = .fetch(:allow_form_params, true) @allow_query_params = .fetch(:allow_query_params, true) @check_content_type = .fetch(:check_content_type, true) @check_header = .fetch(:check_header, true) @coerce_recursive = .fetch(:coerce_recursive, true) @optimistic_json = .fetch(:optimistic_json, false) @parse_response_by_content_type = .fetch(:parse_response_by_content_type, true) @parameter_overwrite_by_rails_rule = if .key?(:parameter_overwite_by_rails_rule) Committee.warn_deprecated_until_6(true, "The option `parameter_overwite_by_rails_rule` is deprecated. Use `parameter_overwrite_by_rails_rule` instead.") [:parameter_overwite_by_rails_rule] else .fetch(:parameter_overwrite_by_rails_rule, true) end # Boolean options and have a different value by default @allow_get_body = .fetch(:allow_get_body, schema.driver.default_allow_get_body) @coerce_date_times = .fetch(:coerce_date_times, schema.driver.default_coerce_date_times) @coerce_form_params = .fetch(:coerce_form_params, schema.driver.default_coerce_form_params) @coerce_path_params = .fetch(:coerce_path_params, schema.driver.default_path_params) @coerce_query_params = .fetch(:coerce_query_params, schema.driver.default_query_params) @validate_success_only = .fetch(:validate_success_only, schema.driver.default_validate_success_only) end |
Instance Attribute Details
#allow_blank_structures ⇒ Object (readonly)
Boolean Options
7 8 9 |
# File 'lib/committee/schema_validator/option.rb', line 7 def allow_blank_structures @allow_blank_structures end |
#allow_form_params ⇒ Object (readonly)
Boolean Options
7 8 9 |
# File 'lib/committee/schema_validator/option.rb', line 7 def allow_form_params @allow_form_params end |
#allow_get_body ⇒ Object (readonly)
Boolean Options
7 8 9 |
# File 'lib/committee/schema_validator/option.rb', line 7 def allow_get_body @allow_get_body end |
#allow_query_params ⇒ Object (readonly)
Boolean Options
7 8 9 |
# File 'lib/committee/schema_validator/option.rb', line 7 def allow_query_params @allow_query_params end |
#check_content_type ⇒ Object (readonly)
Boolean Options
7 8 9 |
# File 'lib/committee/schema_validator/option.rb', line 7 def check_content_type @check_content_type end |
#check_header ⇒ Object (readonly)
Boolean Options
7 8 9 |
# File 'lib/committee/schema_validator/option.rb', line 7 def check_header @check_header end |
#coerce_date_times ⇒ Object (readonly)
Boolean Options
7 8 9 |
# File 'lib/committee/schema_validator/option.rb', line 7 def coerce_date_times @coerce_date_times end |
#coerce_form_params ⇒ Object (readonly)
Boolean Options
7 8 9 |
# File 'lib/committee/schema_validator/option.rb', line 7 def coerce_form_params @coerce_form_params end |
#coerce_path_params ⇒ Object (readonly)
Boolean Options
7 8 9 |
# File 'lib/committee/schema_validator/option.rb', line 7 def coerce_path_params @coerce_path_params end |
#coerce_query_params ⇒ Object (readonly)
Boolean Options
7 8 9 |
# File 'lib/committee/schema_validator/option.rb', line 7 def coerce_query_params @coerce_query_params end |
#coerce_recursive ⇒ Object (readonly)
Boolean Options
7 8 9 |
# File 'lib/committee/schema_validator/option.rb', line 7 def coerce_recursive @coerce_recursive end |
#headers_key ⇒ Object (readonly)
Non-boolean options:
24 25 26 |
# File 'lib/committee/schema_validator/option.rb', line 24 def headers_key @headers_key end |
#optimistic_json ⇒ Object (readonly)
Boolean Options
7 8 9 |
# File 'lib/committee/schema_validator/option.rb', line 7 def optimistic_json @optimistic_json end |
#parameter_overwrite_by_rails_rule ⇒ Object (readonly)
Boolean Options
7 8 9 |
# File 'lib/committee/schema_validator/option.rb', line 7 def parameter_overwrite_by_rails_rule @parameter_overwrite_by_rails_rule end |
#params_key ⇒ Object (readonly)
Non-boolean options:
24 25 26 |
# File 'lib/committee/schema_validator/option.rb', line 24 def params_key @params_key end |
#parse_response_by_content_type ⇒ Object (readonly)
Boolean Options
7 8 9 |
# File 'lib/committee/schema_validator/option.rb', line 7 def parse_response_by_content_type @parse_response_by_content_type end |
#path_hash_key ⇒ Object (readonly)
Non-boolean options:
24 25 26 |
# File 'lib/committee/schema_validator/option.rb', line 24 def path_hash_key @path_hash_key end |
#prefix ⇒ Object (readonly)
Non-boolean options:
24 25 26 |
# File 'lib/committee/schema_validator/option.rb', line 24 def prefix @prefix end |
#query_hash_key ⇒ Object (readonly)
Non-boolean options:
24 25 26 |
# File 'lib/committee/schema_validator/option.rb', line 24 def query_hash_key @query_hash_key end |
#request_body_hash_key ⇒ Object (readonly)
Non-boolean options:
24 25 26 |
# File 'lib/committee/schema_validator/option.rb', line 24 def request_body_hash_key @request_body_hash_key end |
#validate_success_only ⇒ Object (readonly)
Boolean Options
7 8 9 |
# File 'lib/committee/schema_validator/option.rb', line 7 def validate_success_only @validate_success_only end |