Class: Bamboo::Client::Rest::Plan

Inherits:
Object
  • Object
show all
Defined in:
lib/bamboo-client/rest.rb

Instance Method Summary collapse

Constructor Details

#initialize(data, http) ⇒ Plan

Returns a new instance of Plan.



67
68
69
70
# File 'lib/bamboo-client/rest.rb', line 67

def initialize(data, http)
  @data = data
  @http = http
end

Instance Method Details

#building?Boolean

Returns:

  • (Boolean)


107
108
109
# File 'lib/bamboo-client/rest.rb', line 107

def building?
  @data['isBuilding']
end

#enabled?Boolean

Returns:

  • (Boolean)


72
73
74
# File 'lib/bamboo-client/rest.rb', line 72

def enabled?
  @data['enabled']
end

#keyObject



84
85
86
# File 'lib/bamboo-client/rest.rb', line 84

def key
  @data['key']
end

#nameObject



80
81
82
# File 'lib/bamboo-client/rest.rb', line 80

def name
  @data['name']
end

#queue(params = nil) ⇒ Object



92
93
94
95
96
97
98
99
100
# File 'lib/bamboo-client/rest.rb', line 92

def queue(params = nil)
  path = File.join(SERVICE, "queue/#{URI.escape key}")

  if params
    @http.post_with_query path, params
  else
    @http.post path, {}
  end
end

#results(params = {}) ⇒ Object



102
103
104
105
# File 'lib/bamboo-client/rest.rb', line 102

def results(params = {})
  doc = @http.get File.join(SERVICE, "result/#{URI.escape key}"), params
  doc.auto_expand Result, @http
end

#typeObject



76
77
78
# File 'lib/bamboo-client/rest.rb', line 76

def type
  @data['type'].downcase.to_sym
end

#urlObject



88
89
90
# File 'lib/bamboo-client/rest.rb', line 88

def url
  @data.fetch("link")['href']
end