Class: WunderMarkdown::Auth

Inherits:
Object
  • Object
show all
Defined in:
lib/wunder_markdown/auth.rb

Instance Method Summary collapse

Constructor Details

#initializeAuth

Returns a new instance of Auth.



6
7
8
# File 'lib/wunder_markdown/auth.rb', line 6

def initialize
  @netrc = Netrc.read
end

Instance Method Details

#getObject



16
17
18
19
# File 'lib/wunder_markdown/auth.rb', line 16

def get
  _, token = @netrc[API_ENDPOINT]
  token
end

#save(user, password) ⇒ Object



10
11
12
13
14
# File 'lib/wunder_markdown/auth.rb', line 10

def save(user, password)
  @netrc[API_ENDPOINT] = user, password
  @netrc.save
  password
end