Sha256: 1ff1e3914b8c8906ee254fc85479ce1f904c6531104267219d680bb08adead8e

Contents?: true

Size: 700 Bytes

Versions: 136

Compression:

Stored size: 700 Bytes

Contents

module Services
  module Authorization
    module Tokens
      class Generate < Tokens::Base
        def initialize(code:, request:)
          @code = code
          @request = request
        end

        def call
          default_api = ::Hubspot::OAuth::DefaultApi.new
          tokens = default_api.create_token(
            grant_type: :authorization_code,
            code: @code,
            redirect_uri: redirect_uri,
            client_id: ENV['HUBSPOT_CLIENT_ID'],
            client_secret: ENV['HUBSPOT_CLIENT_SECRET'],
            return_type: 'Object'
          )
          tokens[:expires_at] = expires_at(tokens[:expires_in])
          tokens
        end
      end
    end
  end
end

Version data entries

136 entries across 20 versions & 1 rubygems

Version Path
hubspot-api-client-9.0.0 sample-apps/imports-contacts-app/app/lib/services/authorization/tokens/generate.rb
hubspot-api-client-9.0.0 sample-apps/contacts-app/app/lib/services/authorization/tokens/generate.rb
hubspot-api-client-9.0.0 sample-apps/rate-limits-redis-sample-app/app/lib/services/authorization/tokens/generate.rb
hubspot-api-client-9.0.0 sample-apps/timeline-events-app/app/lib/services/authorization/tokens/generate.rb
hubspot-api-client-9.0.0 sample-apps/leaky-bucket-app/app/lib/services/authorization/tokens/generate.rb
hubspot-api-client-9.0.0 sample-apps/companies-app/app/lib/services/authorization/tokens/generate.rb
hubspot-api-client-9.0.0 sample-apps/retry-middleware-sample-app/app/lib/services/authorization/tokens/generate.rb
hubspot-api-client-9.0.0 sample-apps/oauth-app/app/lib/services/authorization/tokens/generate.rb
hubspot-api-client-8.0.1 sample-apps/imports-contacts-app/app/lib/services/authorization/tokens/generate.rb
hubspot-api-client-8.0.1 sample-apps/retry-middleware-sample-app/app/lib/services/authorization/tokens/generate.rb
hubspot-api-client-8.0.1 sample-apps/companies-app/app/lib/services/authorization/tokens/generate.rb
hubspot-api-client-8.0.1 sample-apps/timeline-events-app/app/lib/services/authorization/tokens/generate.rb
hubspot-api-client-8.0.1 sample-apps/oauth-app/app/lib/services/authorization/tokens/generate.rb
hubspot-api-client-8.0.1 sample-apps/contacts-app/app/lib/services/authorization/tokens/generate.rb
hubspot-api-client-8.0.1 sample-apps/leaky-bucket-app/app/lib/services/authorization/tokens/generate.rb
hubspot-api-client-8.0.1 sample-apps/rate-limits-redis-sample-app/app/lib/services/authorization/tokens/generate.rb
hubspot-api-client-8.0.0 sample-apps/contacts-app/app/lib/services/authorization/tokens/generate.rb
hubspot-api-client-8.0.0 sample-apps/imports-contacts-app/app/lib/services/authorization/tokens/generate.rb
hubspot-api-client-8.0.0 sample-apps/leaky-bucket-app/app/lib/services/authorization/tokens/generate.rb
hubspot-api-client-8.0.0 sample-apps/companies-app/app/lib/services/authorization/tokens/generate.rb