Class: Hummer::Client::API

Inherits:
Object
  • Object
show all
Defined in:
lib/hummer/client/api.rb

Class Method Summary collapse

Class Method Details

.configure(options) ⇒ Object



7
8
9
10
11
12
13
14
15
# File 'lib/hummer/client/api.rb', line 7

def self.configure(options)
  @server = RestClient::Resource.new(options[:server],
    :headers => {
      "X-User-ID" => options[:user],
      "X-User-Token" => options[:token],
      "Accept" => "application/json"
    }
  )
end

.get(options = {}) ⇒ Object



16
17
18
19
20
21
22
23
24
# File 'lib/hummer/client/api.rb', line 16

def self.get(options = {})
  if options.has_key?(:project) and options.has_key?(:suite)
    JSON @server['projects'][options[:project]]['suites'][options[:suite]].get
  elsif options.has_key?(:project)
    JSON @server['projects'][options[:project]]['suites'].get
  else
    JSON @server['projects'].get
  end
end

.post(project, file, build, feature_list) ⇒ Object



25
26
27
# File 'lib/hummer/client/api.rb', line 25

def self.post(project,file,build,feature_list)
  JSON @server['projects'][project]['suites'].post :tempest => File.open(file), :build => build, :feature_list => feature_list
end