Class: ManageIQ::API::Client::ActionResult
- Inherits:
-
Object
- Object
- ManageIQ::API::Client::ActionResult
show all
- Defined in:
- lib/manageiq/api/client/action_result.rb
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(action_hash) ⇒ ActionResult
Returns a new instance of ActionResult.
7
8
9
10
|
# File 'lib/manageiq/api/client/action_result.rb', line 7
def initialize(action_hash)
raise "Not a valid Action Result specified" unless self.class.an_action_result?(action_hash)
@attributes = action_hash.dup
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(sym, *args, &block) ⇒ Object
24
25
26
|
# File 'lib/manageiq/api/client/action_result.rb', line 24
def method_missing(sym, *args, &block)
attributes && attributes.key?(sym.to_s) ? attributes[sym.to_s] : super(sym, *args, &block)
end
|
Instance Attribute Details
#attributes ⇒ Object
Returns the value of attribute attributes.
5
6
7
|
# File 'lib/manageiq/api/client/action_result.rb', line 5
def attributes
@attributes
end
|
Class Method Details
.an_action_result?(hash) ⇒ Boolean
12
13
14
|
# File 'lib/manageiq/api/client/action_result.rb', line 12
def self.an_action_result?(hash)
hash && hash.key?("success") && hash.key?("message")
end
|
Instance Method Details
#failed? ⇒ Boolean
20
21
22
|
# File 'lib/manageiq/api/client/action_result.rb', line 20
def failed?
!success
end
|
#respond_to_missing?(sym, *args, &block) ⇒ Boolean
28
29
30
|
# File 'lib/manageiq/api/client/action_result.rb', line 28
def respond_to_missing?(sym, *args, &block)
attributes && attributes.key?(sym.to_s) || super(sym, *args, &block)
end
|
#succeeded? ⇒ Boolean
16
17
18
|
# File 'lib/manageiq/api/client/action_result.rb', line 16
def succeeded?
success
end
|