Class: Devinfo::WhoIs

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

Class Method Summary collapse

Class Method Details

.github(username) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/devinfo.rb', line 6

def self.github(username)
  if username != ""
    response = HTTParty.get('https://api.github.com/users/'+username)
    if response.code != 200
      return "error"
    end
    response["followers"]
  else
    ""
  end
end

.stackoverflow(user_id) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
# File 'lib/devinfo.rb', line 18

def self.stackoverflow(user_id)
  if user_id != ""
    response = HTTParty.get('https://api.stackexchange.com/users/'+user_id+'?site=stackoverflow')
    if response.code != 200
        return "error"
    end
    response["items"][0]["reputation"]
  else
    ""
  end
end