Class: CoderWally::API

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

Overview

API Class

Instance Method Summary collapse

Instance Method Details

#fetch(username) ⇒ Object

Fetch data from CoderWall



8
9
10
11
12
13
14
15
16
17
# File 'lib/coder_wally/api.rb', line 8

def fetch(username)
  uri = uri_for_user(username)
  json = send_request(uri)

  begin
    JSON.parse(json.read)
  rescue JSON::ParserError
    raise InvalidJson, 'Received invalid json in response'
  end
end