Class: AdfBuilder::Nodes::Finance

Inherits:
Node
  • Object
show all
Defined in:
lib/adf_builder/nodes/vehicle_nodes.rb

Instance Attribute Summary

Attributes inherited from Node

#attributes, #children, #tag_name, #value

Instance Method Summary collapse

Methods inherited from Node

#add_child, #method_missing, #remove_children, #respond_to_missing?, #to_xml

Methods included from Validations

included, #validate!

Constructor Details

#initializeFinance

Returns a new instance of Finance.



127
128
129
130
# File 'lib/adf_builder/nodes/vehicle_nodes.rb', line 127

def initialize
  super
  @tag_name = :finance
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class AdfBuilder::Nodes::Node

Instance Method Details

#amount(value, type: :total, limit: :maximum, currency: nil) ⇒ Object



137
138
139
# File 'lib/adf_builder/nodes/vehicle_nodes.rb', line 137

def amount(value, type: :total, limit: :maximum, currency: nil)
  add_child(Amount.new(value, type: type, limit: limit, currency: currency))
end

#balance(value, type: :finance, currency: nil) ⇒ Object



141
142
143
# File 'lib/adf_builder/nodes/vehicle_nodes.rb', line 141

def balance(value, type: :finance, currency: nil)
  add_child(Balance.new(value, type: type, currency: currency))
end

#method(value) ⇒ Object



132
133
134
135
# File 'lib/adf_builder/nodes/vehicle_nodes.rb', line 132

def method(value)
  remove_children(:method)
  add_child(FinanceMethod.new(value))
end