Class: PivotalTracker::Client

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

Defined Under Namespace

Classes: NoToken

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

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



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

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



9
10
11
# File 'lib/pivotal-tracker/client.rb', line 9

def use_ssl
  @use_ssl || false
end

Class Method Details

.connection(options = {}) ⇒ Object

this is your connection for the entire module

Raises:



24
25
26
27
28
29
30
# File 'lib/pivotal-tracker/client.rb', line 24

def connection(options={})
  raise NoToken if @token.to_s.empty?

  @connections ||= {}

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