Class: Datacentred::Model::Base
- Inherits:
-
RecursiveOpenStruct
- Object
- RecursiveOpenStruct
- Datacentred::Model::Base
- Defined in:
- lib/datacentred/model/base.rb
Overview
Base class for all API models.
Uses Recursive Structs to allow nested property access.
Instance Method Summary collapse
-
#initialize(params, _opts = nil) ⇒ Base
constructor
Instantiate a new model object.
Constructor Details
#initialize(params, _opts = nil) ⇒ Base
Instantiate a new model object.
10 11 12 13 14 15 16 17 18 |
# File 'lib/datacentred/model/base.rb', line 10 def initialize(params, _opts=nil) params.delete "links" if params['links'] ["created_at", "updated_at", "last_updated_at"].each do |key| params[key] = Time.parse(params[key]) if params[key] end super params, recurse_over_arrays: true end |