class Datacentred::Model::Base

Base class for all API models.

Uses Recursive Structs to allow nested property access.

Public Class Methods

new(params, _opts=nil) click to toggle source

Instantiate a new model object.

@param [Hash] params Object properties as returned by the API.

Calls superclass method
# 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