lib/tracker_api/client.rb in tracker_api-0.2.6 vs lib/tracker_api/client.rb in tracker_api-0.2.7
- old
+ new
@@ -23,11 +23,11 @@
def initialize(options={})
url = options.fetch(:url, 'https://www.pivotaltracker.com')
@url = Addressable::URI.parse(url).to_s
@api_version = options.fetch(:api_version, '/services/v5')
@logger = options.fetch(:logger, ::Logger.new(nil))
- adapter = options.fetch(:adapter, :net_http)
+ adapter = options.fetch(:adapter, :excon)
connection_options = options.fetch(:connection_options, { ssl: { verify: true } })
@auto_paginate = options.fetch(:auto_paginate, true)
@token = options[:token]
raise 'Missing required options: :token' unless @token
@@ -61,10 +61,19 @@
# @return [Faraday::Response]
def post(path, options = {})
request(:post, parse_query_and_convenience_headers(path, options))
end
+ # Make a HTTP PUT request
+ #
+ # @param path [String] The path, relative to api endpoint
+ # @param options [Hash] Query and header params for request
+ # @return [Faraday::Response]
+ def put(path, options = {})
+ request(:put, parse_query_and_convenience_headers(path, options))
+ end
+
# Make one or more HTTP GET requests, optionally fetching
# the next page of results from information passed back in headers
# based on value in {#auto_paginate}.
#
# @param path [String] The path, relative to {#api_endpoint}
@@ -127,9 +136,25 @@
#
# @param [String] story_id
# @return [TrackerApi::Resources::Story]
def story(story_id)
Endpoints::Story.new(self).get_story(story_id)
+ end
+
+ # Get notifications for the authenticated person
+ #
+ # @param [Hash] params
+ # @return [Array[TrackerApi::Resources::Notification]]
+ def notifications(params={})
+ Endpoints::Notifications.new(self).get(params)
+ end
+
+ # Provides a list of all the activity performed the authenticated person.
+ #
+ # @param [Hash] params
+ # @return [Array[TrackerApi::Resources::Activity]]
+ def activity(params={})
+ Endpoints::Activity.new(self).get(params)
end
private
def parse_query_and_convenience_headers(path, options)