Class: Gista::TokenRequest

Inherits:
ApiRequest show all
Defined in:
lib/gista/token_request.rb

Overview

Request to the Github API to authorize with a username and password and acquire an OAuth token, which can be stored and re-used for password-less authorization.

Examples:

Request a token

credentials = OpenStruct.new(username: 'foo', password: 'bar')
TokenRequest.new(credentials).fetch('token')

See Also:

Constant Summary

Constants inherited from ApiRequest

ApiRequest::CONTENT_TYPE, ApiRequest::OPEN_TIMEOUT, ApiRequest::PORT, ApiRequest::READ_TIMEOUT, ApiRequest::URL

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from ApiRequest

#fetch

Constructor Details

#initialize(credentials) ⇒ TokenRequest

Returns a new instance of TokenRequest.



18
19
20
# File 'lib/gista/token_request.rb', line 18

def initialize(credentials)
  @credentials = credentials
end

Instance Attribute Details

#credentials#username, #password (readonly)

An object that contains a username and password

Returns:

  • (#username, #password)

See Also:



16
17
18
# File 'lib/gista/token_request.rb', line 16

def credentials
  @credentials
end