class Schema def initialize(resource) @schema = resource.get(:schema) end def type(t) @schema.select { |c| c['type'] == t }.map { |c| c['name'] }.uniq end end person_schema = Schema.new(Person) family_schema = Schema.new(Family) DATETIME_ATTRIBUTES = person_schema.type(:datetime) + family_schema.type(:datetime).map { |c| 'family_' + c } BOOLEAN_ATTRIBUTES = person_schema.type(:boolean) + family_schema.type(:boolean).map { |c| 'family_' + c } INTEGER_ATTRIBUTES = person_schema.type(:integer) + family_schema.type(:integer).map { |c| 'family_' + c } \ + %w(mobile_phone work_phone fax business_phone family_home_phone) IGNORE_ATTRIBUTES = %w(updated_at created_at family_updated_at family_latitude family_longitude)