Class: ColumnApi::Object
- Inherits:
-
OpenStruct
- Object
- OpenStruct
- ColumnApi::Object
- Defined in:
- lib/column_api/object.rb
Direct Known Subclasses
AccountNumber, AchReturn, AchTransfer, BankAccount, BusinessEntity, PersonEntity, WireTransfer
Instance Method Summary collapse
-
#initialize(attributes) ⇒ Object
constructor
A new instance of Object.
- #to_ostruct(obj) ⇒ Object
Constructor Details
#initialize(attributes) ⇒ Object
Returns a new instance of Object.
8 9 10 |
# File 'lib/column_api/object.rb', line 8 def initialize(attributes) super(to_ostruct(attributes)) end |
Instance Method Details
#to_ostruct(obj) ⇒ Object
12 13 14 15 16 17 18 19 20 |
# File 'lib/column_api/object.rb', line 12 def to_ostruct(obj) if obj.is_a?(Hash) OpenStruct.new(obj.transform_values { |val| to_ostruct(val) }) elsif obj.is_a?(Array) obj.map { |o| to_ostruct(o) } else # Assumed to be a primitive value obj end end |