Sha256: 5f8b9cde14b39b9c8350c754d4b8410e85ee8b0140a130e045aeaa0e11f7165f
Contents?: true
Size: 989 Bytes
Versions: 3
Compression:
Stored size: 989 Bytes
Contents
require "active_model" require "einvoice/neweb/validator/invoice_validator" require "einvoice/neweb/validator/invoice_item_validator" module Einvoice module Neweb module Model class Base include ActiveModel::Model include ActiveModel::Validations include ActiveModel::Serialization include ActiveModel::Serializers::JSON include Einvoice::Neweb::Validator def attributes=(hash) @invoice_item ||= [] hash.each do |key, value| case key.to_sym when :invoice_item value.each { |v| @invoice_item << InvoiceItem.new(v) } when :contact @contact = Contact.new(value) when :customer_defined @customer_defined = CustomerDefined.new(value) else send("#{key}=", value) end end end def attributes instance_values end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
einvoice-1.1.1 | lib/einvoice/neweb/model/base.rb |
einvoice-1.1.0 | lib/einvoice/neweb/model/base.rb |
einvoice-1.0.0 | lib/einvoice/neweb/model/base.rb |