class GrapeApiary::Config

Constants

SETTINGS

Public Class Methods

example_id_type() click to toggle source
# File lib/grape-apiary/config.rb, line 47
def example_id_type
  @example_id_type ||= :integer
end
example_id_type=(value) click to toggle source
# File lib/grape-apiary/config.rb, line 37
def example_id_type=(value)
  raise UnsupportedIDType unless supported_id_types.include?(value)

  if value.to_sym == :bson && !Object.const_defined?('BSON')
    raise BSONNotDefinied
  end

  @example_id_type = value
end
generate_id() click to toggle source
# File lib/grape-apiary/config.rb, line 51
def generate_id
  case example_id_type
  when :integer
    SecureRandom.random_number(1000)
  when :uuid
    SecureRandom.uuid
  when :bson
    BSON::ObjectId.new.to_s
  end
end
include_root() click to toggle source
# File lib/grape-apiary/config.rb, line 29
def include_root
  @include_root ||= false
end
request_headers() click to toggle source
# File lib/grape-apiary/config.rb, line 17
def request_headers
  @request_headers ||= []
end
resource_exclusion() click to toggle source
# File lib/grape-apiary/config.rb, line 25
def resource_exclusion
  @resource_exclusion ||= []
end
response_headers() click to toggle source
# File lib/grape-apiary/config.rb, line 21
def response_headers
  @response_headers ||= []
end
supported_id_types() click to toggle source
# File lib/grape-apiary/config.rb, line 33
def supported_id_types
  %i(integer uuid bson)
end