class Haipa::Client::Serialization::Serialization

Class to handle serialization & deserialization.

Public Instance Methods

get_model(model_name) click to toggle source

Retrieves model of the model_name

@param model_name [String] Name of the model to retrieve.

# File lib/haipa_rest/serialization.rb, line 32
def get_model(model_name)
  begin
    Object.const_get(@context.class.to_s.split('::')[0...-1].join('::') + "::Models::#{model_name}")
  rescue NameError
    # Look into Haipa::Client namespace if model name not found in the models namespace
    Object.const_get("Haipa::Client::#{model_name}")
  end
end