Sha256: 096bef116ef866664795de72998bc49950bc8a118f15749213011290dfd99ac1

Contents?: true

Size: 1.23 KB

Versions: 5

Compression:

Stored size: 1.23 KB

Contents

module Osm

  class FlexiRecordField
    include ::ActiveAttr::MassAssignmentSecurity
    include ::ActiveAttr::Model

    # @!attribute [rw] id
    #   @return [String] OSM identifier for the field. Special ones are 'dob', 'total', 'completed', 'age', 'firstname' and 'lastname', user ones are of the format 'f\_NUMBER'
    # @!attribute [rw] name
    #   @return [String] Human readable name for the field
    # @!attribute [rw] editable
    #   @return [Boolean] Wether the field can be edited

    attribute :id, :type => String
    attribute :name, :type => String
    attribute :editable, :type => Boolean, :default => false

    attr_accessible :id, :name, :editable

    validates_presence_of :id
    validates_presence_of :name


    # @!method initialize
    #   Initialize a new FlexiRecordField
    #   @param [Hash] attributes the hash of attributes (see attributes for descriptions, use Symbol of attribute name as the key)


    # Initialize a new FlexiRecordField from api data
    # @param [Hash] data the hash of data provided by the API
    def self.from_api(data)
      new({
        :id => data['field'],
        :name => data['name'],
        :editable => data['editable'],
      })
    end

  end # Class FlexiRecordField

end # Module

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
osm-0.0.24 lib/osm/flexi_record_field.rb
osm-0.0.23 lib/osm/flexi_record_field.rb
osm-0.0.22 lib/osm/flexi_record_field.rb
osm-0.0.21 lib/osm/flexi_record_field.rb
osm-0.0.20 lib/osm/flexi_record_field.rb