Skip to content
This repository was archived by the owner on Apr 13, 2025. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion lib/tracker_api/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class Client
#
# @example Creating a Client
# Client.new token: 'my-super-special-token'
def initialize(options={})
def initialize(options={}, &block)
url = options.fetch(:url, 'https://www.pivotaltracker.com')
@url = Addressable::URI.parse(url).to_s
@api_version = options.fetch(:api_version, '/services/v5')
Expand All @@ -31,6 +31,8 @@ def initialize(options={})
@token = options[:token]
raise 'Missing required options: :token' unless @token

@faraday_block = block if block_given?

@connection = Faraday.new({ url: @url }.merge(connection_options)) do |builder|
# response
builder.use Faraday::Response::RaiseError
Expand All @@ -41,6 +43,7 @@ def initialize(options={})
builder.request :json

builder.use TrackerApi::Logger, @logger
@faraday_block.call(builder) if @faraday_block
builder.adapter adapter
end
end
Expand Down