Sha256: be2c85f398f47f59eb70258adff027265d9910b90851596c4f6579dd49b5de33

Contents?: true

Size: 704 Bytes

Versions: 15

Compression:

Stored size: 704 Bytes

Contents

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

        def call
          tokens_api = ::Hubspot::OAuth::TokensApi.new
          tokens = tokens_api.post_oauth_v1_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

15 entries across 9 versions & 1 rubygems

Version Path
hubspot-api-client-3.2.0 sample-apps/webhooks-contacts-app/app/lib/services/authorization/tokens/generate.rb
hubspot-api-client-3.1.1 sample-apps/webhooks-contacts-app/app/lib/services/authorization/tokens/generate.rb
hubspot-api-client-3.1.0.pre.beta sample-apps/webhooks-contacts-app/app/lib/services/authorization/tokens/generate.rb
hubspot-api-client-3.0.0.pre.beta sample-apps/webhooks-contacts-app/app/lib/services/authorization/tokens/generate.rb
hubspot-api-client-2.3.2 sample-apps/webhooks-contacts-app/app/lib/services/authorization/tokens/generate.rb
hubspot-api-client-2.3.1 sample-apps/webhooks-contacts-app/app/lib/services/authorization/tokens/generate.rb
hubspot-api-client-2.2.0 sample-apps/webhooks-contacts-app/app/lib/services/authorization/tokens/generate.rb
hubspot-api-client-2.1.0 sample-apps/webhooks-contacts-app/app/lib/services/authorization/tokens/generate.rb
hubspot-api-client-2.0.0 sample-apps/companies-app/app/lib/services/authorization/tokens/generate.rb
hubspot-api-client-2.0.0 sample-apps/webhooks-contacts-app/app/lib/services/authorization/tokens/generate.rb
hubspot-api-client-2.0.0 sample-apps/retry-middleware-sample-app/app/lib/services/authorization/tokens/generate.rb
hubspot-api-client-2.0.0 sample-apps/rate-limits-redis-sample-app/app/lib/services/authorization/tokens/generate.rb
hubspot-api-client-2.0.0 sample-apps/oauth-app/app/lib/services/authorization/tokens/generate.rb
hubspot-api-client-2.0.0 sample-apps/leaky-bucket-app/app/lib/services/authorization/tokens/generate.rb
hubspot-api-client-2.0.0 sample-apps/contacts-app/app/lib/services/authorization/tokens/generate.rb