Module: LedgerSync
- Defined in:
- lib/ledger_sync/resource.rb,
lib/ledger_sync.rb,
lib/ledger_sync/sync.rb,
lib/ledger_sync/error.rb,
lib/ledger_sync/result.rb,
lib/ledger_sync/version.rb,
lib/ledger_sync/util/performer.rb,
lib/ledger_sync/util/validator.rb,
lib/ledger_sync/adaptors/adaptor.rb,
lib/ledger_sync/resources/vendor.rb,
lib/ledger_sync/util/coordinator.rb,
lib/ledger_sync/adaptors/contract.rb,
lib/ledger_sync/adaptors/searcher.rb,
lib/ledger_sync/resources/invoice.rb,
lib/ledger_sync/resources/payment.rb,
lib/ledger_sync/resources/product.rb,
lib/ledger_sync/util/hash_helpers.rb,
lib/ledger_sync/adaptors/operation.rb,
lib/ledger_sync/resources/customer.rb,
lib/ledger_sync/util/string_helpers.rb,
lib/ledger_sync/concerns/validatable.rb,
lib/ledger_sync/error/adaptor_errors.rb,
lib/ledger_sync/adaptor_configuration.rb,
lib/ledger_sync/adaptors/test/adaptor.rb,
lib/ledger_sync/error/resource_errors.rb,
lib/ledger_sync/error/operation_errors.rb,
lib/ledger_sync/util/resources_builder.rb,
lib/ledger_sync/adaptor_configuration_store.rb,
lib/ledger_sync/adaptors/test/customer/searcher.rb,
lib/ledger_sync/adaptors/quickbooks_online/adaptor.rb,
lib/ledger_sync/adaptors/test/payment/operations/find.rb,
lib/ledger_sync/adaptors/test/customer/operations/find.rb,
lib/ledger_sync/adaptors/test/customer/operations/valid.rb,
lib/ledger_sync/adaptors/test/payment/operations/create.rb,
lib/ledger_sync/adaptors/test/payment/operations/update.rb,
lib/ledger_sync/adaptors/test/payment/operations/upsert.rb,
lib/ledger_sync/adaptors/test/customer/operations/create.rb,
lib/ledger_sync/adaptors/test/customer/operations/update.rb,
lib/ledger_sync/adaptors/test/customer/operations/upsert.rb,
lib/ledger_sync/adaptors/test/customer/operations/invalid.rb,
lib/ledger_sync/adaptors/quickbooks_online/customer/searcher.rb,
lib/ledger_sync/adaptors/quickbooks_online/util/error_parser.rb,
lib/ledger_sync/adaptors/quickbooks_online/util/error_matcher.rb,
lib/ledger_sync/adaptors/quickbooks_online/invoice/operations/find.rb,
lib/ledger_sync/adaptors/quickbooks_online/payment/operations/find.rb,
lib/ledger_sync/adaptors/quickbooks_online/product/operations/find.rb,
lib/ledger_sync/adaptors/quickbooks_online/customer/operations/find.rb,
lib/ledger_sync/adaptors/quickbooks_online/invoice/operations/create.rb,
lib/ledger_sync/adaptors/quickbooks_online/invoice/operations/update.rb,
lib/ledger_sync/adaptors/quickbooks_online/invoice/operations/upsert.rb,
lib/ledger_sync/adaptors/quickbooks_online/payment/operations/create.rb,
lib/ledger_sync/adaptors/quickbooks_online/payment/operations/update.rb,
lib/ledger_sync/adaptors/quickbooks_online/payment/operations/upsert.rb,
lib/ledger_sync/adaptors/quickbooks_online/product/operations/create.rb,
lib/ledger_sync/adaptors/quickbooks_online/product/operations/update.rb,
lib/ledger_sync/adaptors/quickbooks_online/product/operations/upsert.rb,
lib/ledger_sync/adaptors/quickbooks_online/util/adaptor_error_parser.rb,
lib/ledger_sync/adaptors/quickbooks_online/customer/operations/create.rb,
lib/ledger_sync/adaptors/quickbooks_online/customer/operations/update.rb,
lib/ledger_sync/adaptors/quickbooks_online/customer/operations/upsert.rb,
lib/ledger_sync/adaptors/quickbooks_online/util/operation_error_parser.rb,
lib/ledger_sync/adaptors/test/error/adaptor_error/operations/throttle_error.rb
Overview
Template class for named resources such as LedgerSync::Invoice, LedgerSync::Contact, etc.
Defined Under Namespace
Modules: Adaptors, ResultBase, Util, Validatable
Classes: AdaptorConfiguration, AdaptorConfigurationStore, Customer, Error, Invoice, OperationResult, Payment, Product, Resource, ResourceError, Result, SearchResult, Sync, SyncResult, ValidationResult, Vendor
Constant Summary
collapse
- LEVEL_DEBUG =
map to the same values as the standard library’s logger
Logger::DEBUG
- LEVEL_ERROR =
Logger::ERROR
- LEVEL_INFO =
Logger::INFO
- VERSION =
'1.0.2'.freeze
Class Attribute Summary collapse
Class Method Summary
collapse
Class Attribute Details
.adaptors ⇒ Object
Returns the value of attribute adaptors.
63
64
65
|
# File 'lib/ledger_sync.rb', line 63
def adaptors
@adaptors
end
|
.resources ⇒ Object
Returns the value of attribute resources.
63
64
65
|
# File 'lib/ledger_sync.rb', line 63
def resources
@resources
end
|
Class Method Details
.log_level ⇒ Object
66
67
68
|
# File 'lib/ledger_sync.rb', line 66
def self.log_level
@log_level
end
|
.log_level=(val) ⇒ Object
70
71
72
73
74
|
# File 'lib/ledger_sync.rb', line 70
def self.log_level=(val)
raise ArgumentError, 'log_level should only be set to `nil`, `debug` or `info`' if !val.nil? && ![LEVEL_DEBUG, LEVEL_ERROR, LEVEL_INFO].include?(val)
@log_level = val
end
|
.logger ⇒ Object
76
77
78
|
# File 'lib/ledger_sync.rb', line 76
def self.logger
@logger
end
|
.logger=(val) ⇒ Object
80
81
82
|
# File 'lib/ledger_sync.rb', line 80
def self.logger=(val)
@logger = val
end
|
.register_adaptor(adaptor_key) {|adaptors.send(adaptor_key)| ... } ⇒ Object
84
85
86
87
88
|
# File 'lib/ledger_sync.rb', line 84
def self.register_adaptor(adaptor_key)
self.adaptors ||= LedgerSync::AdaptorConfigurationStore.new
self.adaptors.register_adaptor(adaptor_key)
yield(adaptors.send(adaptor_key))
end
|
.register_resource(resource:) ⇒ Object
90
91
92
93
94
95
|
# File 'lib/ledger_sync.rb', line 90
def self.register_resource(resource:)
self.resources ||= {}
raise "Resource key #{resource.resource_type} already exists." if resources.key?(resource.resource_type)
self.resources[resource.resource_type] = resource
end
|
.root ⇒ Object
97
98
99
|
# File 'lib/ledger_sync.rb', line 97
def self.root
File.dirname __dir__
end
|