Class: Yello::Auth

Inherits:
Struct
  • Object
show all
Defined in:
lib/yello/auth.rb,
lib/yello/auth.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#keyObject

Returns the value of attribute key

Returns:

  • (Object)

    the current value of key



5
6
7
# File 'lib/yello/auth.rb', line 5

def key
  @key
end

#tokenObject

Returns the value of attribute token

Returns:

  • (Object)

    the current value of token



5
6
7
# File 'lib/yello/auth.rb', line 5

def token
  @token
end

Class Method Details

.getObject



9
10
11
# File 'lib/yello/auth.rb', line 9

def get
  Auth.new(*(netrc['yello']))
end

.netrcObject



20
21
22
# File 'lib/yello/auth.rb', line 20

def netrc
  Netrc.read
end

.set(key, token) ⇒ Object



13
14
15
16
17
18
# File 'lib/yello/auth.rb', line 13

def set(key, token)
  netrc.tap do |n| 
    n['yello'] = key, token
    n.save
  end
end