Class: HowIs::Pulse

Inherits:
Object
  • Object
show all
Defined in:
lib/how_is/pulse.rb

Overview

This entire class is a monstrous hack, because GitHub doesn’t provide a good API for Pulse.

TODO: Use GitHub’s Statistics API to replace this garbage.

See https://github.com/how-is/how_is/issues/122

Instance Method Summary collapse

Constructor Details

#initialize(repository) ⇒ Pulse



12
13
14
15
# File 'lib/how_is/pulse.rb', line 12

def initialize(repository)
  @repository = repository
  @pulse_page_response = fetch_pulse!(repository)
end

Instance Method Details

#html_summaryObject

Gets the HTML Pulse summary.



18
19
20
21
22
23
24
# File 'lib/how_is/pulse.rb', line 18

def html_summary
  if stats_section?
    stats_html_fragment.gsub('<a href="/', '<a href="https://github.com/')
  else
    "There hasn't been any activity on #{@repository} in the last month."
  end
end