Sha256: 1ff4646a80165a38e9a6e0afea76afc1dc6ba59232097534a8da3145044dc1d4
Contents?: true
Size: 1.24 KB
Versions: 1
Compression:
Stored size: 1.24 KB
Contents
# frozen_string_literal: true require_relative 'resource_attribute' # Template class for named resources such as # LedgerSync::Invoice, LedgerSync::Contact, etc. module LedgerSync class Resource include SimplySerializable::Mixin include Validatable include Fingerprintable::Mixin include ResourceAttribute::Mixin include ResourceAttribute::Reference::One::Mixin include ResourceAttribute::Reference::Many::Mixin PRIMITIVES = [ Date, DateTime, FalseClass, Float, Integer, NilClass, String, Time, TrueClass ].freeze serialize except: %i[resource_attributes references] dirty_attribute :external_id, :ledger_id, :sync_token def initialize(external_id: nil, ledger_id: nil, sync_token: nil, **data) @external_id = external_id.try(:to_sym) @ledger_id = ledger_id @sync_token = sync_token super(data) end def klass_from_resource_type(obj) LedgerSync.const_get(LedgerSync::Util::StringHelpers.camelcase(obj)) end def self.resource_type @resource_type ||= LedgerSync::Util::StringHelpers.underscore(name.split('::').last).to_sym end def ==(other) other.fingerprint == fingerprint end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ledger_sync-1.1.1 | lib/ledger_sync/resource.rb |