Created
February 21, 2017 16:19
-
-
Save kinsomicrote/ba10f92c201c0f101172fd6abd1507bd to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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