class ActiveZuora::ObjectField

Attributes

class_name[RW]

A field that is itself another Zuora complex type. Hashes will automatically be converted to an instance of the given class.

Public Class Methods

new(name, namespace, class_name, options={}) click to toggle source
Calls superclass method ActiveZuora::Field::new
# File lib/active_zuora/fields/object_field.rb, line 9
def initialize(name, namespace, class_name, options={})
  @class_name = class_name
  super(name, namespace, options)
end

Public Instance Methods

build_xml(xml, soap, value, options={}) click to toggle source
# File lib/active_zuora/fields/object_field.rb, line 21
def build_xml(xml, soap, value, options={})
  # 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) click to toggle source
# 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) click to toggle source
# 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