Module: Octopi::Self

Included in:
Api
Defined in:
lib/octopi/self.rb

Instance Method Summary collapse

Instance Method Details

#emailsObject

Returns a list of Email objects containing the email addresses associated with this user. Requires authentication.



14
15
16
17
# File 'lib/octopi/self.rb', line 14

def emails
  raise AuthenticationRequired, "To view emails, you must be authenticated" if Api.api.read_only?
  get("/user/emails")['emails']
end

#follow!(login) ⇒ Object

Start following a user. Can only be called if you are authenticated.



21
22
23
24
# File 'lib/octopi/self.rb', line 21

def follow!()
  raise AuthenticationRequired, "To begin following someone, you must be authenticated" if Api.api.read_only?
  Api.api.post("/user/follow/#{}")
end

#keysObject

Returns a list of Key objects containing all SSH Public Keys this user currently has. Requires authentication.



5
6
7
8
9
10
# File 'lib/octopi/self.rb', line 5

def keys
  raise AuthenticationRequired, "To view keys, you must be authenticated" if Api.api.read_only?
  result = Api.api.get("/user/keys", { :cache => false })
  return unless result and result["public_keys"]
  KeySet.new(result["public_keys"].inject([]) { |result, element| result << Key.new(element) })
end

#unfollow!(login) ⇒ Object

Stop following a user. Can only be called if you are authenticated.



28
29
30
31
# File 'lib/octopi/self.rb', line 28

def unfollow!()
  raise AuthenticationRequired, "To stop following someone, you must be authenticated" if Api.api.read_only?
  Api.api.post("/user/unfollow/#{}")
end