Class: Client
- Inherits:
-
Object
- Object
- Client
- Defined in:
- lib/gripst/client.rb
Constant Summary collapse
- PATH =
ENV['HOME'] + '/.gripst'
Instance Attribute Summary collapse
-
#password ⇒ Object
readonly
Returns the value of attribute password.
-
#username ⇒ Object
readonly
Returns the value of attribute username.
Class Method Summary collapse
Instance Method Summary collapse
- #authorize ⇒ Object
-
#initialize ⇒ Client
constructor
A new instance of Client.
Constructor Details
#initialize ⇒ Client
Returns a new instance of Client.
24 25 26 27 |
# File 'lib/gripst/client.rb', line 24 def initialize @username = get_username @password = get_password end |
Instance Attribute Details
#password ⇒ Object (readonly)
Returns the value of attribute password.
21 22 23 |
# File 'lib/gripst/client.rb', line 21 def password @password end |
#username ⇒ Object (readonly)
Returns the value of attribute username.
21 22 23 |
# File 'lib/gripst/client.rb', line 21 def username @username end |
Class Method Details
.get_auth_token ⇒ Object
8 9 10 11 12 |
# File 'lib/gripst/client.rb', line 8 def get_auth_token return oauth_from_file if oauth_from_file = Client.new . end |
Instance Method Details
#authorize ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/gripst/client.rb', line 29 def begin auth_token = client. :scopes => ['gists'], :note => 'gripst' rescue Octokit::OneTimePasswordRequired otp = get_otp auth_token = otp end write_auth_token auth_token login_with_oauth auth_token end |