Class: PivotalTracker::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/pivotal-tracker/client.rb

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.token(username, password, method = 'post') ⇒ Object



11
12
13
14
15
16
17
18
19
# File 'lib/pivotal-tracker/client.rb', line 11

def token(username, password, method='post')
  return @token if @token
  response = if method == 'post'
    RestClient.post 'https://www.pivotaltracker.com/services/v3/tokens/active', :username => username, :password => password
  else
    RestClient.get "https://#{username}:#{password}@www.pivotaltracker.com/services/v3/tokens/active"
  end
  @token= Nokogiri::XML(response.body).search('guid').inner_html
end

.use_sslObject



7
8
9
# File 'lib/pivotal-tracker/client.rb', line 7

def use_ssl
  @use_ssl || false
end

Class Method Details

.connection(options = {}) ⇒ Object

this is your connection for the entire module



22
23
24
# File 'lib/pivotal-tracker/client.rb', line 22

def connection(options={})
  @connection ||= RestClient::Resource.new("#{protocol}://www.pivotaltracker.com/services/v3", :headers => {'X-TrackerToken' => @token, 'Content-Type' => 'application/xml'})
end