Sha256: f15b9e0fcf0d7501ab004839d2a0e483bae164922bc06e6c8da31069741b1b5d

Contents?: true

Size: 469 Bytes

Versions: 1

Compression:

Stored size: 469 Bytes

Contents

require_relative 'custom_entity'

module Moysklad::Entities
  class AttributeValue < Virtus::Attribute
    def coerce(value)
      if value.is_a? String
        value
      elsif value.is_a? ::Hash
        if value['meta']['type'] == 'customentity'
          CustomEntity.new value
        else
          raise "Unknown meta type: #{value['meta']['type']}"
        end
      else
        raise "Unknown value type (#{value}) #{value.class}"
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
moysklad-0.3.0 lib/moysklad/entities/attribute_value.rb