class Omie::Middleware::Authentication

Attributes

app[R]
app_key[R]
app_secret[R]

Public Class Methods

new(app, options = {}) click to toggle source
# File lib/omie/middleware/authentication.rb, line 8
def initialize(app, options = {})
  @app = app
  @app_key = options.fetch(:app_key)
  @app_secret = options.fetch(:app_secret)
end

Public Instance Methods

call(env) click to toggle source
# File lib/omie/middleware/authentication.rb, line 14
def call(env)
  env[:body] = body_with_authentication(env[:body])

  app.call(env)
end

Private Instance Methods

body_with_authentication(body) click to toggle source
# File lib/omie/middleware/authentication.rb, line 22
def body_with_authentication(body)
  return body unless body.respond_to?(:merge)

  body.merge(
    app_key: app_key,
    app_secret: app_secret
  )
end