class LearnTest::GithubInteractor

Attributes

user_id[R]
username[R]

Public Class Methods

get_user_id_for(username) click to toggle source
# File lib/learn_test/github_interactor.rb, line 9
def self.get_user_id_for(username)
  new(username).get_user_id
end
new(username) click to toggle source
# File lib/learn_test/github_interactor.rb, line 13
def initialize(username)
  @username = username
end

Public Instance Methods

get_user_id() click to toggle source
# File lib/learn_test/github_interactor.rb, line 17
def get_user_id
  @user_id ||= Oj.load(
    open("https://api.github.com/users/#{username}").read,
    symbol_keys: true
  )[:id]
end