Class: GOCD::Agent

Inherits:
Object
  • Object
show all
Defined in:
lib/gocd/agents/agent.rb

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ Agent

Returns a new instance of Agent.



3
4
5
# File 'lib/gocd/agents/agent.rb', line 3

def initialize(response)
  @response = response
end

Instance Method Details

#building?Boolean

Returns:

  • (Boolean)


39
40
41
# File 'lib/gocd/agents/agent.rb', line 39

def building?
  @response['agent_state'] == 'Building'
end

#disabled?Boolean

Returns:

  • (Boolean)


31
32
33
# File 'lib/gocd/agents/agent.rb', line 31

def disabled?
  @response['agent_config_state'] == 'Disabled'
end

#environmentsObject



55
56
57
# File 'lib/gocd/agents/agent.rb', line 55

def environments
  @response['environments']
end

#free_spaceObject



23
24
25
# File 'lib/gocd/agents/agent.rb', line 23

def free_space
  @response['free_space']
end

#has_environment(env) ⇒ Object



59
60
61
# File 'lib/gocd/agents/agent.rb', line 59

def has_environment(env)
  environments.include? env
end

#has_resource(resource) ⇒ Object



51
52
53
# File 'lib/gocd/agents/agent.rb', line 51

def has_resource(resource)
  resources.include? resource
end

#idle?Boolean

Returns:

  • (Boolean)


35
36
37
# File 'lib/gocd/agents/agent.rb', line 35

def idle?
  @response['agent_state'] == 'Idle'
end

#ip_addressObject



15
16
17
# File 'lib/gocd/agents/agent.rb', line 15

def ip_address
  @response['ip_address']
end

#locationObject



63
64
65
# File 'lib/gocd/agents/agent.rb', line 63

def location
  @response['sandbox']
end

#missing?Boolean

Returns:

  • (Boolean)


43
44
45
# File 'lib/gocd/agents/agent.rb', line 43

def missing?
  @response['agent_state'] == 'Missing'
end

#nameObject



7
8
9
# File 'lib/gocd/agents/agent.rb', line 7

def name
  @response['hostname']
end

#osObject



19
20
21
# File 'lib/gocd/agents/agent.rb', line 19

def os
  @response['operating_system']
end

#resourcesObject



47
48
49
# File 'lib/gocd/agents/agent.rb', line 47

def resources
  @response['resources']
end

#stateObject



27
28
29
# File 'lib/gocd/agents/agent.rb', line 27

def state
  @response['agent_state']
end

#uuidObject



11
12
13
# File 'lib/gocd/agents/agent.rb', line 11

def uuid
  @response['uuid']
end