Class: Moysklad::Entities::Base
- Inherits:
-
Object
- Object
- Moysklad::Entities::Base
- Defined in:
- lib/moysklad/entities/base.rb
Direct Known Subclasses
Attribute, AttributeMetadata, Collection, CompanySettingsCustomEntity, CompanySettingsMetadata, Currency, Currency::Unit, CustomEntity, CustomerOrderPosition, Employee, Entity, EntityMeta, Group, Image, Meta, Owner, Price, PriceType, Rate, ResourceMetadata, Shortcut, Uom
Instance Attribute Summary collapse
-
#dump ⇒ Object
Returns the value of attribute dump.
-
#universe ⇒ Object
Returns the value of attribute universe.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(data = {}) ⇒ Base
constructor
A new instance of Base.
- #to_json(*args) ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(data = {}) ⇒ Base
Returns a new instance of Base.
13 14 15 |
# File 'lib/moysklad/entities/base.rb', line 13 def initialize(data = {}) super data.merge(dump: data) end |
Instance Attribute Details
#dump ⇒ Object
Returns the value of attribute dump.
5 6 7 |
# File 'lib/moysklad/entities/base.rb', line 5 def dump @dump end |
#universe ⇒ Object
Returns the value of attribute universe.
4 5 6 |
# File 'lib/moysklad/entities/base.rb', line 4 def universe @universe end |
Class Method Details
.build(data, universe) ⇒ Object
7 8 9 10 11 |
# File 'lib/moysklad/entities/base.rb', line 7 def self.build(data, universe) entity = new data entity.universe = universe entity end |
Instance Method Details
#to_json(*args) ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'lib/moysklad/entities/base.rb', line 17 def to_json(*args) presented = {} to_h.each_pair do |k, v| presented[k] = v unless v.nil? end presented.to_json end |
#to_s ⇒ Object
26 27 28 |
# File 'lib/moysklad/entities/base.rb', line 26 def to_s attributes.to_s end |