Class: JSONAPI::Configuration
- Inherits:
-
Object
- Object
- JSONAPI::Configuration
- Defined in:
- lib/json_api/configuration.rb
Instance Attribute Summary collapse
-
#authorization_handler ⇒ Object
Returns the value of attribute authorization_handler.
-
#authorization_scope ⇒ Object
Returns the value of attribute authorization_scope.
-
#default_page_size ⇒ Object
Returns the value of attribute default_page_size.
-
#document_meta_resolver ⇒ Object
Returns the value of attribute document_meta_resolver.
-
#jsonapi_meta ⇒ Object
Returns the value of attribute jsonapi_meta.
-
#max_page_size ⇒ Object
Returns the value of attribute max_page_size.
-
#n1_query_threshold ⇒ Object
Returns the value of attribute n1_query_threshold.
-
#n1_warning_enabled ⇒ Object
Returns the value of attribute n1_warning_enabled.
-
#namespace_fallback ⇒ Object
Returns the value of attribute namespace_fallback.
-
#namespace_model_mapping ⇒ Object
Returns the value of attribute namespace_model_mapping.
-
#namespace_type_format ⇒ Object
Returns the value of attribute namespace_type_format.
Instance Method Summary collapse
- #base_controller_class ⇒ Object
- #base_controller_class=(value) ⇒ Object
- #base_controller_overridden? ⇒ Boolean
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #resolved_base_controller_class ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
10 11 12 |
# File 'lib/json_api/configuration.rb', line 10 def initialize set_defaults end |
Instance Attribute Details
#authorization_handler ⇒ Object
Returns the value of attribute authorization_handler.
5 6 7 |
# File 'lib/json_api/configuration.rb', line 5 def @authorization_handler end |
#authorization_scope ⇒ Object
Returns the value of attribute authorization_scope.
5 6 7 |
# File 'lib/json_api/configuration.rb', line 5 def @authorization_scope end |
#default_page_size ⇒ Object
Returns the value of attribute default_page_size.
5 6 7 |
# File 'lib/json_api/configuration.rb', line 5 def default_page_size @default_page_size end |
#document_meta_resolver ⇒ Object
Returns the value of attribute document_meta_resolver.
5 6 7 |
# File 'lib/json_api/configuration.rb', line 5 def @document_meta_resolver end |
#jsonapi_meta ⇒ Object
Returns the value of attribute jsonapi_meta.
5 6 7 |
# File 'lib/json_api/configuration.rb', line 5 def @jsonapi_meta end |
#max_page_size ⇒ Object
Returns the value of attribute max_page_size.
5 6 7 |
# File 'lib/json_api/configuration.rb', line 5 def max_page_size @max_page_size end |
#n1_query_threshold ⇒ Object
Returns the value of attribute n1_query_threshold.
5 6 7 |
# File 'lib/json_api/configuration.rb', line 5 def n1_query_threshold @n1_query_threshold end |
#n1_warning_enabled ⇒ Object
Returns the value of attribute n1_warning_enabled.
5 6 7 |
# File 'lib/json_api/configuration.rb', line 5 def n1_warning_enabled @n1_warning_enabled end |
#namespace_fallback ⇒ Object
Returns the value of attribute namespace_fallback.
5 6 7 |
# File 'lib/json_api/configuration.rb', line 5 def namespace_fallback @namespace_fallback end |
#namespace_model_mapping ⇒ Object
Returns the value of attribute namespace_model_mapping.
5 6 7 |
# File 'lib/json_api/configuration.rb', line 5 def namespace_model_mapping @namespace_model_mapping end |
#namespace_type_format ⇒ Object
Returns the value of attribute namespace_type_format.
5 6 7 |
# File 'lib/json_api/configuration.rb', line 5 def namespace_type_format @namespace_type_format end |
Instance Method Details
#base_controller_class ⇒ Object
30 31 32 |
# File 'lib/json_api/configuration.rb', line 30 def base_controller_class @base_controller_class.constantize end |
#base_controller_class=(value) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/json_api/configuration.rb', line 14 def base_controller_class=(value) if value.is_a?(Class) @base_controller_class = value.name elsif value.is_a?(String) raise ArgumentError, "base_controller_class cannot be blank" if value.nil? || value.strip.empty? @base_controller_class = value else raise ArgumentError, "base_controller_class must be a string or class" end return unless Rails.application&.initialized? JSONAPI.rebuild_base_controllers! end |
#base_controller_overridden? ⇒ Boolean
41 42 43 |
# File 'lib/json_api/configuration.rb', line 41 def base_controller_overridden? @base_controller_class != "ActionController::API" end |
#resolved_base_controller_class ⇒ Object
34 35 36 37 38 39 |
# File 'lib/json_api/configuration.rb', line 34 def resolved_base_controller_class class_name = @base_controller_class raise ArgumentError, "base_controller_class cannot be blank" if class_name.nil? || class_name.empty? class_name.constantize end |