hub_link 0.10.0 → 0.11.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d19f7bf5e1a7a9b210f5bdba1602b4a1347ebfae
4
- data.tar.gz: 2812a6707c069e10209960bf692a88c0d8bae43c
3
+ metadata.gz: 55820ffa015f5004c8f88f16f18a55a617926a95
4
+ data.tar.gz: 89d401fa82ab3d62a7c78df1f2dd8a45ceae2e2a
5
5
  SHA512:
6
- metadata.gz: 4ec6e0c6f7b9b0894aba97cc5f868d9652fc55e0b2d4513a810d78e7596a595e1f8180c7ecd83f1daa3263ff3752ffeac803404d0a513ad417da666c719fdf15
7
- data.tar.gz: f8096c9fac8c9b9b8df2285d6cb5ed9ef0cd5ad659adea63577d170431154e44d99e3a64d72850d0aed12c043936141d97bf44e92d31e360e6389370ba0368a6
6
+ metadata.gz: 6c213375c41d32eeeebd6f0867ce64eadcfa0e47b19664603c3f584e64093f645fc9f6408f321765a3dd271dd1e71c3de05d2f9fd30a5a264ede25b9737786b8
7
+ data.tar.gz: 171461c43bb35bc5b2db94ccde9c971094bc6d255cfd37c5b73502ece8b0b2c31fb45dee039cf03108b9a21a9c666e1ef6b9a5b6d6f4db99619024e27b024cd2
data/README.md CHANGED
@@ -8,7 +8,7 @@ When you just want the loop through all the raw pull request and review data fro
8
8
  Add this line to your application's Gemfile:
9
9
 
10
10
  ```ruby
11
- gem "hub_store"
11
+ gem "hub_link"
12
12
  ```
13
13
 
14
14
  Then you can do:
@@ -19,7 +19,7 @@ stream = HubLink::Stream.new("balvig/hub_link", start_date: 3.months.ago)
19
19
  stream.in_batches do |batch|
20
20
  batch.prs # => [{ id: 34, merge_time: 6400, ... }]
21
21
  batch.reviews # => [{ id: 54, reviewer: "balvig", approval: true, ... }]
22
- batch.review_requests # => [{ id: 74, reviewer: "balvig", ... }]
22
+ batch.review_requests # => [{ digest: "a45bfa...", reviewer: "balvig", ... }]
23
23
  end
24
24
  ```
25
25
 
@@ -6,6 +6,10 @@ module HubLink
6
6
  @query = query
7
7
  end
8
8
 
9
+ def fetch(resource)
10
+ public_send(resource)
11
+ end
12
+
9
13
  def pull_requests
10
14
  results.map(&:to_h)
11
15
  end
@@ -3,11 +3,10 @@ require "hub_link/batch"
3
3
 
4
4
  module HubLink
5
5
  class Stream
6
- GITHUB_BATCH_SIZE = 7 # Days
7
-
8
- def initialize(repo, start_date: nil)
6
+ def initialize(repo, start_date: nil, batch_size: 7)
9
7
  @repo = repo
10
8
  @start_date = (start_date || date_of_first_pr).to_date
9
+ @batch_size = batch_size
11
10
  end
12
11
 
13
12
  def in_batches(&block)
@@ -18,15 +17,15 @@ module HubLink
18
17
 
19
18
  private
20
19
 
21
- attr_accessor :repo, :start_date
20
+ attr_accessor :repo, :start_date, :batch_size
22
21
 
23
22
  def date_of_first_pr
24
23
  Api::PullRequest.oldest(repo: repo)&.updated_at
25
24
  end
26
25
 
27
26
  def queries
28
- start_date.step(end_date, GITHUB_BATCH_SIZE).map do |date|
29
- "type:pr updated:#{date}..#{date + (GITHUB_BATCH_SIZE - 1)} repo:#{repo}"
27
+ start_date.step(end_date, batch_size).map do |date|
28
+ "type:pr updated:#{date}..#{date + (batch_size - 1)} repo:#{repo}"
30
29
  end
31
30
  end
32
31
 
@@ -1,3 +1,3 @@
1
1
  module HubLink
2
- VERSION = "0.10.0"
2
+ VERSION = "0.11.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hub_link
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.0
4
+ version: 0.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jens Balvig
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-04-26 00:00:00.000000000 Z
11
+ date: 2019-05-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport