Class: RubyOmx::Node
Overview
Base class for request and response classes, which implement XML mapping via ROXML
Direct Known Subclasses
Address, AttributeGroup, CIAIResponseItem, CancellationHistoryLineItem, CancellationHistoryOrder, CustomField, CustomItemAttribute, Error, Flag, Item, ItemUpdateItem, LineItem, LineStatus, PricePoint, Response, ReturnHistoryItem, ReturnHistoryLineItem, ReturnHistoryOrder, UDIParameter
Instance Method Summary collapse
- #accessors ⇒ Object
-
#as_hash ⇒ Object
render a ROXML node as a normal hash, eliminating the @ and some unneeded admin fields.
-
#initialize(attrs = {}) ⇒ Node
constructor
A new instance of Node.
Constructor Details
#initialize(attrs = {}) ⇒ Node
Returns a new instance of Node.
8 9 10 |
# File 'lib/ruby_omx/node.rb', line 8 def initialize(attrs={}) attrs.map { |(k, v)| send("#{k}=", v) } if attrs.present? end |
Instance Method Details
#accessors ⇒ Object
12 13 14 |
# File 'lib/ruby_omx/node.rb', line 12 def accessors roxml_references.map {|r| r.accessor} end |
#as_hash ⇒ Object
render a ROXML node as a normal hash, eliminating the @ and some unneeded admin fields
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/ruby_omx/node.rb', line 17 def as_hash obj_hash = {} self.instance_variables.each do |v| m = v.to_s.sub('@','') if m != 'roxml_references' && m!= 'promotion_ids' obj_hash[m.to_sym] = self.instance_variable_get(v) end end return obj_hash end |