class AmoCRM::Entities::Attribute

Public Instance Methods

attributeName(universe) click to toggle source

Название свойства, полученное из AttributeMetadata

@return String

# File lib/amo_crm/entities/attribute.rb, line 40
def attributeName universe
  metadata(universe).name
end
get_value(universe) click to toggle source

Значение свойства согласно его типу

@return [String | AmoCRM::Entities::CustomEntity | Integer | Decimal ]

# File lib/amo_crm/entities/attribute.rb, line 47
def get_value universe
  md = metadata universe
  case md.attrType
  when 'ID_CUSTOM'
    universe.custom_entities.find( entityValueUuid ).name
  when 'LINK'
    valueText
  when 'TEXT'
    valueText
  when 'STRING'
    valueString
  when 'DOUBLE'
    doubleValue
  when 'LONG'
    longValue
  when 'TIME'
    timeValue
  when 'FILE'
    file
  else
    raise "Не известный тип мета-аттрибута #{md.uuid}: #{md.attrType}"
  end
end
metadata(universe) click to toggle source

Объект описывающий тип атритуба

@return AmoCRM::Entities::AttributeMetadata

# File lib/amo_crm/entities/attribute.rb, line 32
def metadata universe
  universe.embedded_entity_metadata.subresource_by_name(:GoodFolder).find metadataUuid
end