Module: MiqAeMethodService::MiqAeServiceObjectCommon

Included in:
MiqAeServiceModelBase, MiqAeServiceObject
Defined in:
lib/miq_automation_engine/engine/miq_ae_method_service/miq_ae_service_object_common.rb

Instance Method Summary collapse

Instance Method Details

#[](attr) ⇒ Object


13
14
15
16
17
# File 'lib/miq_automation_engine/engine/miq_ae_method_service/miq_ae_service_object_common.rb', line 13

def [](attr)
  value = @object[attr.downcase]
  value = value.to_s if value.kind_of?(MiqAePassword)
  value
end

#[]=(attr, value) ⇒ Object


19
20
21
# File 'lib/miq_automation_engine/engine/miq_ae_method_service/miq_ae_service_object_common.rb', line 19

def []=(attr, value)
  @object[attr.downcase] = value
end

#attributesObject


3
4
5
6
7
# File 'lib/miq_automation_engine/engine/miq_ae_method_service/miq_ae_service_object_common.rb', line 3

def attributes
  @object.attributes.each_with_object({}) do |(key, value), hash|
    hash[key] = value.kind_of?(MiqAePassword) ? value.to_s : value
  end
end

#attributes=(hash) ⇒ Object


9
10
11
# File 'lib/miq_automation_engine/engine/miq_ae_method_service/miq_ae_service_object_common.rb', line 9

def attributes=(hash)
  @object.attributes = hash
end

#class_nameObject


48
49
50
# File 'lib/miq_automation_engine/engine/miq_ae_method_service/miq_ae_service_object_common.rb', line 48

def class_name
  @object.klass
end

#current_field_nameObject


32
33
34
# File 'lib/miq_automation_engine/engine/miq_ae_method_service/miq_ae_service_object_common.rb', line 32

def current_field_name
  @object.current_field_name
end

#current_field_typeObject


36
37
38
# File 'lib/miq_automation_engine/engine/miq_ae_method_service/miq_ae_service_object_common.rb', line 36

def current_field_type
  @object.current_field_type
end

#current_messageObject


40
41
42
# File 'lib/miq_automation_engine/engine/miq_ae_method_service/miq_ae_service_object_common.rb', line 40

def current_message
  @object.current_message
end

#decrypt(attr) ⇒ Object


28
29
30
# File 'lib/miq_automation_engine/engine/miq_ae_method_service/miq_ae_service_object_common.rb', line 28

def decrypt(attr)
  MiqAePassword.decrypt_if_password(@object[attr.downcase])
end

#idObject

To explicitly override Object#id method, which is spewing deprecation warnings to use Object#object_id


24
25
26
# File 'lib/miq_automation_engine/engine/miq_ae_method_service/miq_ae_service_object_common.rb', line 24

def id
  @object.try(:id)
end

#instance_nameObject


52
53
54
# File 'lib/miq_automation_engine/engine/miq_ae_method_service/miq_ae_service_object_common.rb', line 52

def instance_name
  @object.instance
end

#nameObject


56
57
58
# File 'lib/miq_automation_engine/engine/miq_ae_method_service/miq_ae_service_object_common.rb', line 56

def name
  @object.object_name
end

#namespaceObject


44
45
46
# File 'lib/miq_automation_engine/engine/miq_ae_method_service/miq_ae_service_object_common.rb', line 44

def namespace
  @object.namespace
end

#parentObject


60
61
62
# File 'lib/miq_automation_engine/engine/miq_ae_method_service/miq_ae_service_object_common.rb', line 60

def parent
  @object.node_parent ? MiqAeServiceObject.new(@object.node_parent, @service) : nil
end