Class: FirstGithubCommit
- Inherits:
-
Object
- Object
- FirstGithubCommit
- Defined in:
- lib/first_github_commit.rb
Defined Under Namespace
Classes: TooManyRequests
Constant Summary collapse
- DEBUG =
false
- MAX_REQUESTS =
30
Instance Attribute Summary collapse
-
#page ⇒ Object
readonly
Returns the value of attribute page.
-
#repo ⇒ Object
readonly
Returns the value of attribute repo.
-
#requests_made ⇒ Object
readonly
Returns the value of attribute requests_made.
-
#user ⇒ Object
readonly
Returns the value of attribute user.
Class Method Summary collapse
Instance Method Summary collapse
- #github_url ⇒ Object
-
#initialize(user, repo) ⇒ FirstGithubCommit
constructor
A new instance of FirstGithubCommit.
- #yaml ⇒ Object
Constructor Details
#initialize(user, repo) ⇒ FirstGithubCommit
Returns a new instance of FirstGithubCommit.
15 16 17 18 19 20 21 |
# File 'lib/first_github_commit.rb', line 15 def initialize(user, repo) @user, @repo = user, repo @requests_made = 0 @range = (1..130) find_upper_limit find_page_number end |
Instance Attribute Details
#page ⇒ Object (readonly)
Returns the value of attribute page.
10 11 12 |
# File 'lib/first_github_commit.rb', line 10 def page @page end |
#repo ⇒ Object (readonly)
Returns the value of attribute repo.
10 11 12 |
# File 'lib/first_github_commit.rb', line 10 def repo @repo end |
#requests_made ⇒ Object (readonly)
Returns the value of attribute requests_made.
10 11 12 |
# File 'lib/first_github_commit.rb', line 10 def requests_made @requests_made end |
#user ⇒ Object (readonly)
Returns the value of attribute user.
10 11 12 |
# File 'lib/first_github_commit.rb', line 10 def user @user end |
Class Method Details
.find(user, repo) ⇒ Object
31 32 33 |
# File 'lib/first_github_commit.rb', line 31 def self.find(user, repo) FirstGithubCommit.new(user, repo).yaml end |
Instance Method Details
#github_url ⇒ Object
27 28 29 |
# File 'lib/first_github_commit.rb', line 27 def github_url @github_url ||= "http://github.com/#{user}/#{repo}/commits/master?page=#{page}" end |
#yaml ⇒ Object
23 24 25 |
# File 'lib/first_github_commit.rb', line 23 def yaml @yaml ||= YAML.load(last_response.body)["commits"].last end |