class AmpelExtase::JenkinsClient
Attributes
url[R]
Public Class Methods
new(url)
click to toggle source
# File lib/ampel_extase/jenkins_client.rb, line 8 def initialize(url) url = URI.parse(url.to_s) unless URI::HTTP === url @url = url end
Public Instance Methods
api_url(*path)
click to toggle source
# File lib/ampel_extase/jenkins_client.rb, line 15 def api_url(*path) [ @url, *path, 'api', 'json' ].compact * '/' end
fetch(url = api_url)
click to toggle source
# File lib/ampel_extase/jenkins_client.rb, line 19 def fetch(url = api_url) puts "Fetching #{url.to_s.inspect}." JSON open(url).read rescue => e e.message << " for #{url.inspect}" raise end
fetch_build(type)
click to toggle source
# File lib/ampel_extase/jenkins_client.rb, line 27 def fetch_build(type) url = if sym = type.ask_and_send(:to_sym) key = sym.to_s.camelize(:lower) key[0, 1] = key[0, 1].downcase api_url(key) else api_url(type) end fetch url end