Class: XcodeServer::Server

Inherits:
Object
  • Object
show all
Includes:
Networking
Defined in:
lib/xcode_server/server.rb,
lib/xcode_server/server/networking.rb

Defined Under Namespace

Modules: Networking

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Networking

#delete, #get, #get_json

Constructor Details

#initialize(host, scheme = 'https') ⇒ Server

Returns a new instance of Server.



10
11
12
13
# File 'lib/xcode_server/server.rb', line 10

def initialize(host, scheme = 'https')
  @host = host
  @scheme = scheme
end

Instance Attribute Details

#hostObject (readonly)

Returns the value of attribute host.



8
9
10
# File 'lib/xcode_server/server.rb', line 8

def host
  @host
end

#schemeObject (readonly)

Returns the value of attribute scheme.



7
8
9
# File 'lib/xcode_server/server.rb', line 7

def scheme
  @scheme
end

Instance Method Details

#botsObject



15
16
17
# File 'lib/xcode_server/server.rb', line 15

def bots
  get_json('bots')['results'].map { |result| Bot.new(self, result) }
end

#destroy_bot(id, rev = nil) ⇒ Object



19
20
21
22
# File 'lib/xcode_server/server.rb', line 19

def destroy_bot(id, rev = nil)
  rev ||= get_json("bots/#{id}")['_rev']
  delete("bots/#{id}/#{rev}").code.to_i == 204
end