Class: Hexabat::Importer

Inherits:
Object
  • Object
show all
Defined in:
lib/hexabat/importer.rb

Instance Method Summary collapse

Constructor Details

#initialize(issue_counter, request_creator) ⇒ Importer

Returns a new instance of Importer.



3
4
5
6
# File 'lib/hexabat/importer.rb', line 3

def initialize(issue_counter, request_creator)
  @issue_counter = issue_counter
  @request_creator = request_creator
end

Instance Method Details

#first_page_retrieved(state) ⇒ Object



13
14
15
16
17
18
# File 'lib/hexabat/importer.rb', line 13

def first_page_retrieved(state)
  ->(page_range, issue_count) do
    notify_counted_page :first, state, page_range, issue_count
    retrieve_last_page_of_issues state, page_range.last if page_range.multiple_pages?
  end
end

#importObject



8
9
10
11
# File 'lib/hexabat/importer.rb', line 8

def import
  retrieve_first_page_of_issues :open
  retrieve_first_page_of_issues :closed
end

#last_page_retrieved(state) ⇒ Object



20
21
22
23
24
25
# File 'lib/hexabat/importer.rb', line 20

def last_page_retrieved(state)
  ->(page_range, issue_count) do
    notify_counted_page :last, state, page_range, issue_count
    retrieve_pages_of_issues state, page_range.middle
  end
end