Sha256: 2b52480ece0073338bb119b64b4683711eff1eb1d43d2034648c419fdfd10df8

Contents?: true

Size: 715 Bytes

Versions: 3

Compression:

Stored size: 715 Bytes

Contents

module OAuth2
  class UntappdClient < OAuth2::Client
    def get_token(params, access_token_opts = {}, access_token_class = AccessToken)
      response = request(options[:token_method], token_url, request_token_opts(params))
      access_token_class.new(self, parse_token(response), access_token_opts)
    end

    private

    def parse_token(response)
      access_token = response.parsed.is_a?(Hash) && response.parsed['response']['access_token']
      raise Error.new(response) if options[:raise_errors] && !access_token
      access_token
    end

    def request_token_opts(params)
      { raise_errors: options[:raise_errors],
        parse: params.delete(:parse),
        params: params }
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
omniauth-untappd-0.1.3 lib/oauth2/untappd_client.rb
omniauth-untappd-0.1.1 lib/oauth2/untappd_client.rb
omniauth-untappd-0.1.0 lib/oauth2/untappd_client.rb