Class: HubLink::Batch

Inherits:
Object
  • Object
show all
Defined in:
lib/hub_link/batch.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Batch

Returns a new instance of Batch.



8
9
10
# File 'lib/hub_link/batch.rb', line 8

def initialize(options = {})
  @options = options.compact
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



6
7
8
# File 'lib/hub_link/batch.rb', line 6

def options
  @options
end

Instance Method Details

#empty?Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/hub_link/batch.rb', line 12

def empty?
  results.empty?
end

#fetch(resource) ⇒ Object



16
17
18
# File 'lib/hub_link/batch.rb', line 16

def fetch(resource)
  public_send(resource)
end

#pull_requestsObject



20
21
22
23
24
# File 'lib/hub_link/batch.rb', line 20

def pull_requests
  log "Fetching pull requests" do
    results.map(&:to_h)
  end
end

#review_requestsObject



32
33
34
35
36
# File 'lib/hub_link/batch.rb', line 32

def review_requests
  log "Fetching review requests" do
    results.flat_map(&:review_requests).map(&:to_h)
  end
end

#reviewsObject



26
27
28
29
30
# File 'lib/hub_link/batch.rb', line 26

def reviews
  log "Fetching reviews" do
    results.flat_map(&:reviews).map(&:to_h)
  end
end