Sha256: c29c3f0bb0546a9393290ea824660485c2b91f06be6e8a73b0c5975a8ec72ee2

Contents?: true

Size: 442 Bytes

Versions: 2

Compression:

Stored size: 442 Bytes

Contents

module Moysklad::Entities
  class Base
    include Virtus.model
    attr_accessor :universe
    attr_accessor :dump

    def self.build(data, universe)
      entity = new data
      entity.universe = universe
      entity
    end

    def to_json(*args)
      presented = {}
      to_h.each_pair do |k, v|
        presented[k] = v unless v.nil?
      end

      presented.to_json
    end

    def to_s
      attributes.to_s
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
moysklad-0.4.1 lib/moysklad/entities/base.rb
moysklad-0.4.0 lib/moysklad/entities/base.rb