Sha256: 30f37e4dc355c56e218b1b87a806a4711fc6e1aa6066f82e9f1b6535cd37cbc0

Contents?: true

Size: 1.51 KB

Versions: 10

Compression:

Stored size: 1.51 KB

Contents

# encoding: utf-8

module Hyperdrive
  module Values
    module_function

    def definable_request_methods
      [:get, :post, :put, :patch, :delete].freeze
    end

    def supported_request_methods
      %w(GET HEAD OPTIONS POST PUT PATCH DELETE).freeze
    end

    def request_methods
      {
        get:     'GET',
        head:    'HEAD',
        options: 'OPTIONS',
        post:    'POST',
        put:     'PUT',
        patch:   'PATCH',
        delete:  'DELETE'
      }.freeze
    end

    def http_request_methods
      {
        'GET'     => :get,
        'HEAD'    => :head,
        'OPTIONS' => :options,
        'POST'    => :post,
        'PUT'     => :put,
        'PATCH'   => :patch,
        'DELETE'  => :delete
      }.freeze
    end

    def default_cors_options
      {
          origins: '*',
          allow_headers: 'Content-Type, Accept, Accept-Encoding, Authorization, If-None-Match',
          credentials: 'false',
          expose_headers: 'Allow, Cache-Control, Content-Language, Content-Type, ETag',
          max_age: 86400
      }.freeze
    end

    def default_config
      {
        cors: default_cors_options,
        name: 'Hyperdrive API',
        description: "v#{Hyperdrive::VERSION}",
        vendor: 'hyperdrive',
        media_types: %w(hal+json json),
        per_page: 20,
        ssl: false,
        instrumenter: Hyperdrive::Instrumenters::Noop
      }.freeze
    end

    def default_headers
      {
        'X-Powered-By' => "Hyperdrive (v#{Hyperdrive::VERSION})"
      }
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
hyperdrive-0.0.25 lib/hyperdrive/values.rb
hyperdrive-0.0.24 lib/hyperdrive/values.rb
hyperdrive-0.0.23 lib/hyperdrive/values.rb
hyperdrive-0.0.22 lib/hyperdrive/values.rb
hyperdrive-0.0.21 lib/hyperdrive/values.rb
hyperdrive-0.0.20 lib/hyperdrive/values.rb
hyperdrive-0.0.19 lib/hyperdrive/values.rb
hyperdrive-0.0.18 lib/hyperdrive/values.rb
hyperdrive-0.0.17 lib/hyperdrive/values.rb
hyperdrive-0.0.16 lib/hyperdrive/values.rb