Sha256: 0130047fb64e2f09a631ae3166f5525fc4b5db03024e3334861f614a8229b97b

Contents?: true

Size: 701 Bytes

Versions: 4

Compression:

Stored size: 701 Bytes

Contents

module BambooId
  module Urls
    module BaseOauthTokenUrl
      def to_s
        base_url
      end

      def params
        {
          client_id:     client_id,
          client_secret: client_secret,
          grant_type:    grant_type,
          redirect_uri:  redirect_uri,
          scope:         scope
        }.tap do |parameters|
          parameters[refresh? ? :refresh_token : :code] = temporary_code
        end.select do |_key, value|
          value != nil && value != ''
        end
      end

      private

      attr_accessor :temporary_code, :grant_type

      def scope
        nil
      end

      def refresh?
        grant_type == 'refresh_token'
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
bamboo-id-0.1.3 lib/bamboo_id/urls/base_oauth_token_url.rb
bamboo-id-0.1.2 lib/bamboo_id/urls/base_oauth_token_url.rb
bamboo-id-0.1.1 lib/bamboo_id/urls/base_oauth_token_url.rb
bamboo-id-0.1.0 lib/bamboo_id/urls/base_oauth_token_url.rb