Class: Committee::SchemaValidator::Option

Inherits:
Object
  • Object
show all
Defined in:
lib/committee/schema_validator/option.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options, schema, schema_type) ⇒ Option

Returns a new instance of Option.



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/committee/schema_validator/option.rb', line 22

def initialize(options, schema, schema_type)
  # Non-boolean options
  @headers_key         = options[:headers_key] || "committee.headers"
  @params_key          = options[:params_key] || "committee.params"
  @prefix              = options[:prefix]

  # Boolean options and have a common value by default
  @allow_form_params   = options.fetch(:allow_form_params, true)
  @allow_query_params  = options.fetch(:allow_query_params, true)
  @check_content_type  = options.fetch(:check_content_type, true)
  @check_header        = options.fetch(:check_header, true)
  @coerce_recursive    = options.fetch(:coerce_recursive, true)
  @optimistic_json     = options.fetch(:optimistic_json, false)

  # Boolean options and have a different value by default
  @allow_get_body      = options.fetch(:allow_get_body, schema.driver.default_allow_get_body)
  @coerce_date_times   = options.fetch(:coerce_date_times, schema.driver.default_coerce_date_times)
  @coerce_form_params  = options.fetch(:coerce_form_params, schema.driver.default_coerce_form_params)
  @coerce_path_params  = options.fetch(:coerce_path_params, schema.driver.default_path_params)
  @coerce_query_params = options.fetch(:coerce_query_params, schema.driver.default_query_params)
  @validate_success_only = options.fetch(:validate_success_only, schema.driver.default_validate_success_only)
end

Instance Attribute Details

#allow_form_paramsObject (readonly)

Boolean Options



4
5
6
# File 'lib/committee/schema_validator/option.rb', line 4

def allow_form_params
  @allow_form_params
end

#allow_get_bodyObject (readonly)

Boolean Options



4
5
6
# File 'lib/committee/schema_validator/option.rb', line 4

def allow_get_body
  @allow_get_body
end

#allow_query_paramsObject (readonly)

Boolean Options



4
5
6
# File 'lib/committee/schema_validator/option.rb', line 4

def allow_query_params
  @allow_query_params
end

#check_content_typeObject (readonly)

Boolean Options



4
5
6
# File 'lib/committee/schema_validator/option.rb', line 4

def check_content_type
  @check_content_type
end

#check_headerObject (readonly)

Boolean Options



4
5
6
# File 'lib/committee/schema_validator/option.rb', line 4

def check_header
  @check_header
end

#coerce_date_timesObject (readonly)

Boolean Options



4
5
6
# File 'lib/committee/schema_validator/option.rb', line 4

def coerce_date_times
  @coerce_date_times
end

#coerce_form_paramsObject (readonly)

Boolean Options



4
5
6
# File 'lib/committee/schema_validator/option.rb', line 4

def coerce_form_params
  @coerce_form_params
end

#coerce_path_paramsObject (readonly)

Boolean Options



4
5
6
# File 'lib/committee/schema_validator/option.rb', line 4

def coerce_path_params
  @coerce_path_params
end

#coerce_query_paramsObject (readonly)

Boolean Options



4
5
6
# File 'lib/committee/schema_validator/option.rb', line 4

def coerce_query_params
  @coerce_query_params
end

#coerce_recursiveObject (readonly)

Boolean Options



4
5
6
# File 'lib/committee/schema_validator/option.rb', line 4

def coerce_recursive
  @coerce_recursive
end

#headers_keyObject (readonly)

Non-boolean options:



18
19
20
# File 'lib/committee/schema_validator/option.rb', line 18

def headers_key
  @headers_key
end

#optimistic_jsonObject (readonly)

Boolean Options



4
5
6
# File 'lib/committee/schema_validator/option.rb', line 4

def optimistic_json
  @optimistic_json
end

#params_keyObject (readonly)

Non-boolean options:



18
19
20
# File 'lib/committee/schema_validator/option.rb', line 18

def params_key
  @params_key
end

#prefixObject (readonly)

Non-boolean options:



18
19
20
# File 'lib/committee/schema_validator/option.rb', line 18

def prefix
  @prefix
end

#validate_success_onlyObject (readonly)

Boolean Options



4
5
6
# File 'lib/committee/schema_validator/option.rb', line 4

def validate_success_only
  @validate_success_only
end