Class: GithubStats::GithubClient::Response
- Inherits:
-
Object
- Object
- GithubStats::GithubClient::Response
- Defined in:
- lib/github_stats/github_client.rb
Overview
Auto-paginate!
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
Instance Method Summary collapse
- #each(&block) ⇒ Object
-
#initialize(client) ⇒ Response
constructor
A new instance of Response.
Constructor Details
#initialize(client) ⇒ Response
Returns a new instance of Response.
24 25 26 |
# File 'lib/github_stats/github_client.rb', line 24 def initialize(client) @client = client end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
23 24 25 |
# File 'lib/github_stats/github_client.rb', line 23 def client @client end |
Instance Method Details
#each(&block) ⇒ Object
28 29 30 31 32 33 34 35 |
# File 'lib/github_stats/github_client.rb', line 28 def each(&block) last_response = client.last_response loop do last_response.data.items.each(&block) last_response = last_response.rels[:next].get break if last_response.rels[:next].nil? end end |