Sha256: 758c68ca768a005ec1f49288d12151ca226e1d2211043c56731bb7ece0741230

Contents?: true

Size: 778 Bytes

Versions: 5

Compression:

Stored size: 778 Bytes

Contents

require 'tessellator/fetcher'

module HowIs
  # This entire class is a monstrous hack, because GitHub doesn't provide a good
  # API for Pulse.
  class Pulse
    def initialize(repository)
      @repository = repository
      @pulse_page_response = fetch_pulse!(repository)
    end

    def text_summary
      raise NotImplementedError
    end

    def html_summary
      @pulse_page_response.body
        .split('<div class="section diffstat-summary">').last
        .split('</div>').first
        .gsub('<a href="/', '<a href="https://github.com/')
        .strip
    end

  private
    def fetch_pulse!(repository, period='monthly')
      Tessellator::Fetcher.new.call('get', "https://github.com/#{repository}/pulse/#{period}")
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
how_is-8.0.0 lib/how_is/pulse.rb
how_is-7.0.0 lib/how_is/pulse.rb
how_is-6.0.0 lib/how_is/pulse.rb
how_is-5.0.0 lib/how_is/pulse.rb
how_is-4.0.0 lib/how_is/pulse.rb