Class: FetchUser

Inherits:
Object
  • Object
show all
Includes:
Interactor
Defined in:
lib/fetch_user.rb

Overview

Instance Method Summary collapse

Instance Method Details

#callObject



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

def call
  client = GithubApiClient.new
  user = client.user(context.username)

  if user.response.code == "200"
    user = user.parsed_response
    return context.user = user
  else
    context.error = user.response.message
    context.fail!
  end
end