Class: ActiveZuora::ObjectField
- Defined in:
- lib/active_zuora/fields/object_field.rb
Instance Attribute Summary collapse
-
#class_name ⇒ Object
A field that is itself another Zuora complex type.
Attributes inherited from Field
#default, #name, #namespace, #zuora_name
Instance Method Summary collapse
- #build_xml(xml, soap, value, options = {}) ⇒ Object
- #clear_changed_attributes(value) ⇒ Object
-
#initialize(name, namespace, class_name, options = {}) ⇒ ObjectField
constructor
A new instance of ObjectField.
- #type_cast(value) ⇒ Object
Methods inherited from Field
Constructor Details
#initialize(name, namespace, class_name, options = {}) ⇒ ObjectField
Returns a new instance of ObjectField.
9 10 11 12 |
# File 'lib/active_zuora/fields/object_field.rb', line 9 def initialize(name, namespace, class_name, ={}) @class_name = class_name super(name, namespace, ) end |
Instance Attribute Details
#class_name ⇒ Object
A field that is itself another Zuora complex type. Hashes will automatically be converted to an instance of the given class.
7 8 9 |
# File 'lib/active_zuora/fields/object_field.rb', line 7 def class_name @class_name end |
Instance Method Details
#build_xml(xml, soap, value, options = {}) ⇒ Object
21 22 23 24 |
# File 'lib/active_zuora/fields/object_field.rb', line 21 def build_xml(xml, soap, value, ={}) # For complex types, simply omit it if it's nil. value.build_xml(xml, soap, :namespace => namespace, :element_name => zuora_name) if value end |
#clear_changed_attributes(value) ⇒ Object
26 27 28 |
# File 'lib/active_zuora/fields/object_field.rb', line 26 def clear_changed_attributes(value) value.clear_changed_attributes if value end |
#type_cast(value) ⇒ Object
14 15 16 17 18 19 |
# File 'lib/active_zuora/fields/object_field.rb', line 14 def type_cast(value) if value.is_a?(Hash) value = class_name.constantize.new(value) end value end |