class Roqua::CoreApi::Models::Person # when support for rails 3 is dropped: replace by include ActiveModel::Model extend ActiveModel::Naming extend ActiveModel::Translation include ActiveModel::Validations include ActiveModel::Conversion include ActiveModel::Serialization attr_reader :id attr_accessor :role, :firstname, :lastname, :initials, :email, :phone_home, :phone_work, :phone_cell, :birthdate, :gender, :country_of_birth, :address_type, :street, :city, :zipcode, :country validates :role, inclusion: { in: %w( professional patient parent ) } def initialize(params = {}) @id = params.delete('id') params.each do |attr, value| public_send("#{attr}=", value) end if params super() end def assign_attributes(params = {}) params.each do |attr, value| public_send("#{attr}=", value) end if params end def attributes as_json end end