Module: Her::Model::Attributes::ClassMethods

Defined in:
lib/her/model/attributes.rb

Instance Method Summary collapse

Instance Method Details

#attributes(*attributes) ⇒ Object

Define the attributes that will be used to track dirty attributes and validations

Examples:

class User
  include Her::Model
  attributes :name, :email
end

Parameters:

  • attributes (Array)


240
241
242
243
244
# File 'lib/her/model/attributes.rb', line 240

def attributes(*attributes)
  attribute_methods_mutex.synchronize do
    define_attribute_methods attributes
  end
end

#store_metadata(value = nil) ⇒ Object

Define the accessor in which the API response metadata (obtained from the parsing middleware) will be stored

Examples:

class User
  include Her::Model
   :server_data
end

Parameters:

  • store_metadata (Symbol)


270
271
272
# File 'lib/her/model/attributes.rb', line 270

def (value = nil)
  store_her_data(:metadata, value)
end

#store_response_errors(value = nil) ⇒ Object

Define the accessor in which the API response errors (obtained from the parsing middleware) will be stored

Examples:

class User
  include Her::Model
  store_response_errors :server_errors
end

Parameters:

  • store_response_errors (Symbol)


256
257
258
# File 'lib/her/model/attributes.rb', line 256

def store_response_errors(value = nil)
  store_her_data(:response_errors, value)
end