Skip to content

Instantly share code, notes, and snippets.

@kinsomicrote
Created February 21, 2017 16:19
Show Gist options
  • Save kinsomicrote/ba10f92c201c0f101172fd6abd1507bd to your computer and use it in GitHub Desktop.
Save kinsomicrote/ba10f92c201c0f101172fd6abd1507bd to your computer and use it in GitHub Desktop.
require 'faraday'
require 'json'
require 'pry'
class RepoIssue
def initialize(username)
@username = username
end
def github_url
"https://api.github.com/users/#{@username}/repos"
end
def fetch_repo_description
data = get_api_data
collect_repo_description(data)
#binding.pry
end
private
def collect_repo_description(data)
data.map do |repo|
repo['description']
end
end
def get_api_data
response = Faraday.get(github_url)
JSON.parse(response.body)
end
end
u = RepoIssue.new("iMacTia")
puts u.fetch_repo_description
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment