Class: Mints::ContactAPIController

Inherits:
ActionController::API
  • Object
show all
Includes:
AbstractController::Helpers, ActionController::Cookies, ReverseProxy::Controller
Defined in:
lib/mints/controllers/contact_api_controller.rb

Direct Known Subclasses

Api::V1::MintsContactController

Instance Method Summary collapse

Instance Method Details

#indexObject

[View source]

9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/mints/controllers/contact_api_controller.rb', line 9

def index
    headers = {
        'host' => "#{@host.gsub('http://', '').gsub('https://', '')}",
        'ApiKey' => "#{@api_key}", 
        'Content-Type'=> 'application/json', 
        'Accept'=> 'application/json'
    }
    if cookies[:mints_contact_session_token]
        session_token = cookies[:mints_contact_session_token]
        headers["Authorization"] = "Bearer #{session_token}"
    end            
    reverse_proxy "#{@host}", headers: headers, verify_ssl: false do |config|
        # We got a 404!
        config.on_missing do |code, response|
            raise ActionController::RoutingError.new('Not Found')
        end
    end
end