Class: ApiModel::Base

Inherits:
Hashie::Trash
  • Object
show all
Extended by:
ActiveModel::Callbacks, ActiveModel::Naming, RestMethods
Includes:
ActiveModel::Conversion, ActiveModel::Serialization, ActiveModel::Validations, ConfigurationMethods
Defined in:
lib/api-model.rb

Instance Method Summary collapse

Methods included from RestMethods

cache, cache_id, call_api, get_json, post_json

Instance Method Details

#property_exists?(property_name) ⇒ Boolean

Overrides Hashie::Trash to catch errors from trying to set properties which have not been defined and defines it automatically



44
45
46
47
48
49
# File 'lib/api-model.rb', line 44

def property_exists?(property_name)
  super property_name
rescue NoMethodError
  Log.debug "Could not set #{property_name} on #{self.class.name}. Defining it now."
  self.class.property property_name.to_sym
end