Module: Smplkit::ApiSupport::ResourceShim Private

Defined in:
lib/smplkit/api_support.rb

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Deep-stringify Hash keys so resources returned by generated to_hash (symbol-keyed) match what the wrapper helpers expect (string-keyed).

Class Method Summary collapse

Class Method Details

.from_model(model) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Convenience: produce a string-keyed Hash from a generated model.



84
85
86
87
88
# File 'lib/smplkit/api_support.rb', line 84

def from_model(model)
  return {} if model.nil?

  stringify(model.to_hash)
end

.stringify(value) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



79
80
81
# File 'lib/smplkit/api_support.rb', line 79

def stringify(value)
  Smplkit::Helpers.deep_stringify_keys(value)
end