class PivotalTracker::API::Client
Public Class Methods
new(token, adapter=::Faraday)
click to toggle source
# File lib/pivotaltracker/api/client.rb, line 4 def initialize(token, adapter=::Faraday) @adapter = adapter @token = token end
Public Instance Methods
get(endpoint, id, options={})
click to toggle source
# File lib/pivotaltracker/api/client.rb, line 9 def get(endpoint, id, options={}) endpoint_url = build_url(endpoint, id, options) connection = @adapter.new(url: ::PivotalTracker::API::HOST) response = connection.get(endpoint_url) { |req| req.headers['X-TrackerToken'] = @token } response end
Private Instance Methods
build_url(endpoint, id, options={})
click to toggle source
# File lib/pivotaltracker/api/client.rb, line 18 def build_url(endpoint, id, options={}) parsed_endpoint = endpoint.gsub(/:project_id/, id.to_s) "services/v5/#{parsed_endpoint}" end