Sha256: f63f1194ad8525bc0702b983f3ac1f060ee58ff0fdd1ff0339fdb87427b48c6b

Contents?: true

Size: 683 Bytes

Versions: 12

Compression:

Stored size: 683 Bytes

Contents

class ImportsController < ApplicationController
  before_action :authorize

  def index
  end

  def create
    Services::Hubspot::Imports::Create.new(uploaded_file: params[:file]).call
    redirect_to :imports, notice: 'Import succesfully created.'
  end

  def download_example
    send_file 'public/examples/example.csv', type: 'application/octet-stream', status: 202
  end

  private

  def authorize
    redirect_to login_path and return if session['tokens'].blank?

    session['tokens'] = Services::Authorization::Tokens::Refresh.new(tokens: session['tokens'], request: request).call
    Services::Authorization::AuthorizeHubspot.new(tokens: session['tokens']).call
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
hubspot-api-client-9.0.0 sample-apps/imports-contacts-app/app/controllers/imports_controller.rb
hubspot-api-client-8.0.1 sample-apps/imports-contacts-app/app/controllers/imports_controller.rb
hubspot-api-client-8.0.0 sample-apps/imports-contacts-app/app/controllers/imports_controller.rb
hubspot-api-client-7.3.0 sample-apps/imports-contacts-app/app/controllers/imports_controller.rb
hubspot-api-client-7.2.0 sample-apps/imports-contacts-app/app/controllers/imports_controller.rb
hubspot-api-client-7.1.1 sample-apps/imports-contacts-app/app/controllers/imports_controller.rb
hubspot-api-client-7.1.0 sample-apps/imports-contacts-app/app/controllers/imports_controller.rb
hubspot-api-client-7.0.0 sample-apps/imports-contacts-app/app/controllers/imports_controller.rb
hubspot-api-client-6.0.0 sample-apps/imports-contacts-app/app/controllers/imports_controller.rb
hubspot-api-client-5.0.0 sample-apps/imports-contacts-app/app/controllers/imports_controller.rb
hubspot-api-client-4.0.0 sample-apps/imports-contacts-app/app/controllers/imports_controller.rb
hubspot-api-client-3.3.0 sample-apps/imports-contacts-app/app/controllers/imports_controller.rb