Sha256: 695436d34e9bfeda04eccb07150e6e75a2e3c062de8fc99d4cceb3b8ce1d0300

Contents?: true

Size: 577 Bytes

Versions: 1

Compression:

Stored size: 577 Bytes

Contents

require 'benchmark'
require 'colorize'

module GitWakaTime
  # Integrates the nested hash from mapper with heartbeats api
  class Request
    def initialize(args)
      @args = args
      @heartbeats = []
      @session     = Wakatime::Session.new(api_key: GitWakaTime.config.api_key)
      @client      = Wakatime::Client.new(@session)
    end

    def call
      Log.new "Gettting heartbeats #{@args[:date]}".red
      time = Benchmark.realtime do
        @result = @client.heartbeats(@args) || []
      end
      Log.new "API took #{time}s"

      @result
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
gitwakatime-0.4.0 lib/gitwakatime/request.rb