Class: Vain::Github::User

Inherits:
Hashie::Mash
  • Object
show all
Defined in:
lib/vain/github.rb

Overview

Try to get a user - return nil if they’re not found

Class Method Summary collapse

Class Method Details

.get(user_name) ⇒ Object



13
14
15
16
17
18
19
20
# File 'lib/vain/github.rb', line 13

def self.get(user_name)
  begin
    response = RestClient.get("https://api.github.com/users/#{user_name}", accept: ACCEPT)
    User.new(JSON.parse(response))
  rescue RestClient::ResourceNotFound
    nil
  end
end