Class: Rentvine::RentvineModel
- Inherits:
-
OpenStruct
- Object
- OpenStruct
- Rentvine::RentvineModel
- Defined in:
- lib/rentvine/model/rentvine_model.rb
Direct Known Subclasses
Account, Application, Association, Balance, Bill, Diagnostic, File, Lease, LeaseStatus, Ledger, Occupant, Owner, OwnerDistribution, Portfolio, Property, RecurringCharge, Tenant, Transaction, TransactionEntry, Unit, Vendor, VendorTrade, WorkOrder, WorkOrderStatus
Instance Method Summary collapse
- #error? ⇒ Boolean
-
#initialize(data = {}) ⇒ RentvineModel
constructor
A new instance of RentvineModel.
- #to_rentvine_hash ⇒ Object
Constructor Details
#initialize(data = {}) ⇒ RentvineModel
Returns a new instance of RentvineModel.
3 4 5 |
# File 'lib/rentvine/model/rentvine_model.rb', line 3 def initialize(data = {}) super(data) end |
Instance Method Details
#error? ⇒ Boolean
7 8 9 |
# File 'lib/rentvine/model/rentvine_model.rb', line 7 def error? false end |
#to_rentvine_hash ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/rentvine/model/rentvine_model.rb', line 11 def to_rentvine_hash data_hash = to_h # Remove custom appends from the hash &.dig(:appends)&.each { |key| data_hash.delete(key) } data_hash.delete(:meta) data_hash = data_hash.to_camelback_keys data_hash.keys.each do |key| next if (key.to_s =~ /Id$/).nil? new_key = key.to_s.gsub(/Id$/, 'ID') data_hash[new_key.to_sym] = data_hash.delete(key) end data_hash.to_camelback_keys end |