Sha256: e1c031383b81f80d7917cd3faa4bdbc07ae57833cddb94b837ae10b9d337932e

Contents?: true

Size: 472 Bytes

Versions: 22

Compression:

Stored size: 472 Bytes

Contents

class ApplicationController < ActionController::Base
  include ExceptionHandler

  before_action :check_env_variables

  helper_method :authorized?

  private

  def authorized?
    session['tokens'].present?
  end

  def check_env_variables
    missing_vars = %w[HUBSPOT_CLIENT_ID HUBSPOT_CLIENT_SECRET].select { |var| ENV[var].blank? }
    raise(ExceptionHandler::HubspotError.new, "Please specify #{missing_vars.join(', ')} in .env") if missing_vars.present?
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
hubspot-api-client-2.0.0 sample-apps/webhooks-contacts-app/app/controllers/application_controller.rb
hubspot-api-client-1.0.1 sample-apps/webhooks-contacts-app/app/controllers/application_controller.rb