Sha256: ca436ee06cd86ae1f9713531488c88f43e657badb6d90e1d90448ff351a0f16b

Contents?: true

Size: 540 Bytes

Versions: 1

Compression:

Stored size: 540 Bytes

Contents

require 'faraday'

module WebhookStopwatch
  class Client
    attr_reader :base_url

    def initialize(base_url)
      @base_url = base_url
    end

    def start(message_id, timestamp)
      connection.post("/messages/#{message_id}/start", "timestamp" => timestamp).
                 success?
    end

    def stop(message_id, timestamp)
      connection.post("/messages/#{message_id}/stop", "timestamp" => timestamp).
                 success?
    end

  private

    def connection
      Faraday.new(:url => base_url)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
webhook_stopwatch_client-0.0.1 lib/webhook_stopwatch/client.rb