Class: Nimbu::Request::SiteHeader

Inherits:
Faraday::Middleware
  • Object
show all
Includes:
Utils::Constants
Defined in:
lib/nimbu-api/request/site_header.rb

Constant Summary

Constants included from Utils::Constants

Utils::Constants::ACCEPT, Utils::Constants::ACCEPTED_OAUTH_SCOPES, Utils::Constants::ACCEPT_CHARSET, Utils::Constants::CACHE_CONTROL, Utils::Constants::CONTENT_LENGTH, Utils::Constants::CONTENT_TYPE, Utils::Constants::DATE, Utils::Constants::ETAG, Utils::Constants::HEADER_LAST, Utils::Constants::HEADER_LINK, Utils::Constants::HEADER_NEXT, Utils::Constants::LOCATION, Utils::Constants::META_FIRST, Utils::Constants::META_LAST, Utils::Constants::META_NEXT, Utils::Constants::META_PREV, Utils::Constants::META_REL, Utils::Constants::NIMBU_SITE, Utils::Constants::OAUTH_SCOPES, Utils::Constants::PARAM_PAGE, Utils::Constants::PARAM_PER_PAGE, Utils::Constants::PARAM_START_PAGE, Utils::Constants::RATELIMIT_LIMIT, Utils::Constants::RATELIMIT_REMAINING, Utils::Constants::SERVER, Utils::Constants::USER_AGENT

Instance Method Summary collapse

Constructor Details

#initialize(app, *args) ⇒ SiteHeader

Returns a new instance of SiteHeader.



14
15
16
17
18
# File 'lib/nimbu-api/request/site_header.rb', line 14

def initialize(app, *args)
  super app
  @app = app
  @subdomain = args.shift
end

Instance Method Details

#call(env) ⇒ Object



9
10
11
12
# File 'lib/nimbu-api/request/site_header.rb', line 9

def call(env)
  env[:request_headers].merge!(NIMBU_SITE => @subdomain) if @subdomain
  @app.call env
end