Class: PuppetX::Relay::Agent::Model::PlanRun
- Inherits:
-
Object
- Object
- PuppetX::Relay::Agent::Model::PlanRun
show all
- Includes:
- Stateful
- Defined in:
- lib/puppet_x/relay/agent/model/plan_run.rb
Defined Under Namespace
Classes: MissingNameError
Instance Attribute Summary collapse
Attributes included from Stateful
#id, #state
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from Stateful
#with_state
Constructor Details
#initialize(opts) ⇒ PlanRun
Returns a new instance of PlanRun.
34
35
36
37
38
39
40
|
# File 'lib/puppet_x/relay/agent/model/plan_run.rb', line 34
def initialize(opts)
opts = defaults.merge(opts)
raise MissingNameError unless opts.key? 'name'
opts.each { |key, value| instance_variable_set("@#{key}", value) }
end
|
Instance Attribute Details
#environment ⇒ String
25
26
27
|
# File 'lib/puppet_x/relay/agent/model/plan_run.rb', line 25
def environment
@environment
end
|
#name ⇒ String
28
29
30
|
# File 'lib/puppet_x/relay/agent/model/plan_run.rb', line 28
def name
@name
end
|
#params ⇒ Hash
31
32
33
|
# File 'lib/puppet_x/relay/agent/model/plan_run.rb', line 31
def params
@params
end
|
Class Method Details
.from_h(hsh) ⇒ Object
17
18
19
20
21
|
# File 'lib/puppet_x/relay/agent/model/plan_run.rb', line 17
def from_h(hsh)
hsh = hsh.dup
hsh['state'] = State.from_h(hsh['state']) if hsh.key? 'state'
new(hsh)
end
|
Instance Method Details
#to_json(*args) ⇒ String
43
44
45
46
47
48
49
50
51
|
# File 'lib/puppet_x/relay/agent/model/plan_run.rb', line 43
def to_json(*args)
{
id: id,
environment: environment,
name: name,
params: params,
state: state,
}.to_json(*args)
end
|