Class: BambooApi

Inherits:
Object
  • Object
show all
Defined in:
lib/bamboo_api.rb,
lib/bamboo_api/version.rb

Direct Known Subclasses

Plan

Defined Under Namespace

Classes: Build, Plan, Project, Stage

Constant Summary collapse

VERSION =
"0.0.3"

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ BambooApi

Returns a new instance of BambooApi.



13
14
15
16
17
# File 'lib/bamboo_api.rb', line 13

def initialize options={}
  @@end_point = options[ :end_point ]
  @@username = options[ :username ]
  @@password = options[ :password ]
end

Class Method Details

.compose_url(action, expand = nil) ⇒ Object



19
20
21
22
23
# File 'lib/bamboo_api.rb', line 19

def self.compose_url action, expand=nil
  url = "https://#{@@end_point}/builds/rest/api/latest/#{action}.json?os_authType=basic&os_username=#{URI::encode( @@username )}&os_password=#{URI::encode( @@password )}"
  url += "&expand=#{expand}"
  url
end

.request(action, expand = nil) ⇒ Object



25
26
27
# File 'lib/bamboo_api.rb', line 25

def self.request action, expand=nil
  JSON.parse( RestClient.get( BambooApi.compose_url( action, expand ) ) )
end