Class: JSONAPI::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/jsonapi/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/jsonapi/configuration.rb', line 21

def initialize
  #:underscored_key, :camelized_key, :dasherized_key, or custom
  self.json_key_format = :dasherized_key

  #:underscored_route, :camelized_route, :dasherized_route, or custom
  self.route_format = :dasherized_route

  #:basic, :active_record, or custom
  self.operations_processor = :active_record

  self.allowed_request_params = [:include, :fields, :format, :controller, :action, :sort, :page]

  # :none, :offset, :paged, or a custom paginator name
  self.default_paginator = :none

  # Output pagination links at top level
  self.top_level_links_include_pagination = true

  self.default_page_size = 10
  self.maximum_page_size = 20

  # Metadata
  # Output record count in top level meta for find operation
  self.top_level_meta_include_record_count = false
  self.top_level_meta_record_count_key = :record_count

  self.use_text_errors = false
end

Instance Attribute Details

#allowed_request_paramsObject

Returns the value of attribute allowed_request_params.



7
8
9
# File 'lib/jsonapi/configuration.rb', line 7

def allowed_request_params
  @allowed_request_params
end

#default_page_sizeObject

Returns the value of attribute default_page_size.



7
8
9
# File 'lib/jsonapi/configuration.rb', line 7

def default_page_size
  @default_page_size
end

#default_paginatorObject

Returns the value of attribute default_paginator.



7
8
9
# File 'lib/jsonapi/configuration.rb', line 7

def default_paginator
  @default_paginator
end

#json_key_formatObject

Returns the value of attribute json_key_format.



7
8
9
# File 'lib/jsonapi/configuration.rb', line 7

def json_key_format
  @json_key_format
end

#key_formatterObject (readonly)

Returns the value of attribute key_formatter.



7
8
9
# File 'lib/jsonapi/configuration.rb', line 7

def key_formatter
  @key_formatter
end

#maximum_page_sizeObject

Returns the value of attribute maximum_page_size.



7
8
9
# File 'lib/jsonapi/configuration.rb', line 7

def maximum_page_size
  @maximum_page_size
end

#operations_processorObject

Returns the value of attribute operations_processor.



7
8
9
# File 'lib/jsonapi/configuration.rb', line 7

def operations_processor
  @operations_processor
end

#route_formatObject

Returns the value of attribute route_format.



7
8
9
# File 'lib/jsonapi/configuration.rb', line 7

def route_format
  @route_format
end

#route_formatterObject (readonly)

Returns the value of attribute route_formatter.



7
8
9
# File 'lib/jsonapi/configuration.rb', line 7

def route_formatter
  @route_formatter
end

Returns the value of attribute top_level_links_include_pagination.



7
8
9
# File 'lib/jsonapi/configuration.rb', line 7

def top_level_links_include_pagination
  @top_level_links_include_pagination
end

#top_level_meta_include_record_countObject

Returns the value of attribute top_level_meta_include_record_count.



7
8
9
# File 'lib/jsonapi/configuration.rb', line 7

def top_level_meta_include_record_count
  @top_level_meta_include_record_count
end

#top_level_meta_record_count_keyObject

Returns the value of attribute top_level_meta_record_count_key.



7
8
9
# File 'lib/jsonapi/configuration.rb', line 7

def top_level_meta_record_count_key
  @top_level_meta_record_count_key
end

#use_text_errorsObject

Returns the value of attribute use_text_errors.



7
8
9
# File 'lib/jsonapi/configuration.rb', line 7

def use_text_errors
  @use_text_errors
end