ledger_sync 1.1.1 → 1.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (124) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/Gemfile.lock +1 -1
  4. data/README.md +2 -3
  5. data/lib/ledger_sync.rb +12 -6
  6. data/lib/ledger_sync/adaptors/ledger_serializer.rb +124 -0
  7. data/lib/ledger_sync/adaptors/ledger_serializer_attribute.rb +148 -0
  8. data/lib/ledger_sync/adaptors/ledger_serializer_attribute_set.rb +51 -0
  9. data/lib/ledger_sync/adaptors/ledger_serializer_type/mapping_type.rb +41 -0
  10. data/lib/ledger_sync/adaptors/ledger_serializer_type/references_many_type.rb +24 -0
  11. data/lib/ledger_sync/adaptors/ledger_serializer_type/value_type.rb +17 -0
  12. data/lib/ledger_sync/adaptors/operation.rb +15 -9
  13. data/lib/ledger_sync/adaptors/quickbooks_online/account/ledger_serializer.rb +21 -0
  14. data/lib/ledger_sync/adaptors/quickbooks_online/account/operations/create.rb +8 -36
  15. data/lib/ledger_sync/adaptors/quickbooks_online/account/operations/find.rb +1 -13
  16. data/lib/ledger_sync/adaptors/quickbooks_online/account/operations/update.rb +4 -35
  17. data/lib/ledger_sync/adaptors/quickbooks_online/account/searcher.rb +3 -44
  18. data/lib/ledger_sync/adaptors/quickbooks_online/adaptor.rb +75 -28
  19. data/lib/ledger_sync/adaptors/quickbooks_online/bill/ledger_serializer.rb +40 -0
  20. data/lib/ledger_sync/adaptors/quickbooks_online/bill/operations/create.rb +9 -48
  21. data/lib/ledger_sync/adaptors/quickbooks_online/bill/operations/find.rb +10 -21
  22. data/lib/ledger_sync/adaptors/quickbooks_online/bill/operations/update.rb +9 -52
  23. data/lib/ledger_sync/adaptors/quickbooks_online/bill_line_item/ledger_serializer.rb +27 -0
  24. data/lib/ledger_sync/adaptors/quickbooks_online/customer/ledger_serializer.rb +23 -0
  25. data/lib/ledger_sync/adaptors/quickbooks_online/customer/operations/create.rb +2 -25
  26. data/lib/ledger_sync/adaptors/quickbooks_online/customer/operations/find.rb +2 -14
  27. data/lib/ledger_sync/adaptors/quickbooks_online/customer/operations/update.rb +3 -30
  28. data/lib/ledger_sync/adaptors/quickbooks_online/deposit/ledger_serializer.rb +35 -0
  29. data/lib/ledger_sync/adaptors/quickbooks_online/deposit/operations/create.rb +2 -39
  30. data/lib/ledger_sync/adaptors/quickbooks_online/deposit/operations/find.rb +2 -14
  31. data/lib/ledger_sync/adaptors/quickbooks_online/deposit/operations/update.rb +4 -43
  32. data/lib/ledger_sync/adaptors/quickbooks_online/deposit_line_item/ledger_serializer.rb +27 -0
  33. data/lib/ledger_sync/adaptors/quickbooks_online/expense/ledger_serializer.rb +48 -0
  34. data/lib/ledger_sync/adaptors/quickbooks_online/expense/operations/create.rb +10 -51
  35. data/lib/ledger_sync/adaptors/quickbooks_online/expense/operations/find.rb +10 -22
  36. data/lib/ledger_sync/adaptors/quickbooks_online/expense/operations/update.rb +10 -55
  37. data/lib/ledger_sync/adaptors/quickbooks_online/expense_line_item/ledger_serializer.rb +27 -0
  38. data/lib/ledger_sync/adaptors/quickbooks_online/journal_entry/ledger_serializer.rb +32 -0
  39. data/lib/ledger_sync/adaptors/quickbooks_online/journal_entry/operations/create.rb +4 -37
  40. data/lib/ledger_sync/adaptors/quickbooks_online/journal_entry/operations/find.rb +4 -15
  41. data/lib/ledger_sync/adaptors/quickbooks_online/journal_entry/operations/update.rb +5 -42
  42. data/lib/ledger_sync/adaptors/quickbooks_online/journal_entry_line_item/ledger_serializer.rb +31 -0
  43. data/lib/ledger_sync/adaptors/quickbooks_online/ledger_serializer.rb +103 -0
  44. data/lib/ledger_sync/adaptors/quickbooks_online/{account/mapping.rb → ledger_serializer_type/account_sub_type.rb} +128 -148
  45. data/lib/ledger_sync/adaptors/quickbooks_online/ledger_serializer_type/account_type.rb +51 -0
  46. data/lib/ledger_sync/adaptors/quickbooks_online/ledger_serializer_type/amount_type.rb +23 -0
  47. data/lib/ledger_sync/adaptors/quickbooks_online/ledger_serializer_type/classification_type.rb +23 -0
  48. data/lib/ledger_sync/adaptors/quickbooks_online/ledger_serializer_type/date_type.rb +23 -0
  49. data/lib/ledger_sync/adaptors/quickbooks_online/ledger_serializer_type/journal_entry_line_item_type.rb +20 -0
  50. data/lib/ledger_sync/adaptors/quickbooks_online/ledger_serializer_type/payment_type.rb +21 -0
  51. data/lib/ledger_sync/adaptors/quickbooks_online/operation.rb +2 -7
  52. data/lib/ledger_sync/adaptors/quickbooks_online/operation/create.rb +29 -0
  53. data/lib/ledger_sync/adaptors/quickbooks_online/operation/find.rb +31 -0
  54. data/lib/ledger_sync/adaptors/quickbooks_online/operation/full_update.rb +43 -0
  55. data/lib/ledger_sync/adaptors/quickbooks_online/operation/sparse_update.rb +29 -0
  56. data/lib/ledger_sync/adaptors/quickbooks_online/payment/ledger_serializer.rb +23 -0
  57. data/lib/ledger_sync/adaptors/quickbooks_online/payment/operations/create.rb +1 -24
  58. data/lib/ledger_sync/adaptors/quickbooks_online/payment/operations/find.rb +1 -13
  59. data/lib/ledger_sync/adaptors/quickbooks_online/payment/operations/update.rb +2 -29
  60. data/lib/ledger_sync/adaptors/quickbooks_online/transfer/ledger_serializer.rb +33 -0
  61. data/lib/ledger_sync/adaptors/quickbooks_online/transfer/operations/create.rb +1 -29
  62. data/lib/ledger_sync/adaptors/quickbooks_online/transfer/operations/find.rb +1 -13
  63. data/lib/ledger_sync/adaptors/quickbooks_online/transfer/operations/update.rb +4 -35
  64. data/lib/ledger_sync/adaptors/quickbooks_online/util/adaptor_error_parser.rb +2 -1
  65. data/lib/ledger_sync/adaptors/quickbooks_online/util/operation_error_parser.rb +2 -1
  66. data/lib/ledger_sync/adaptors/quickbooks_online/vendor/ledger_serializer.rb +25 -0
  67. data/lib/ledger_sync/adaptors/quickbooks_online/vendor/operations/create.rb +1 -23
  68. data/lib/ledger_sync/adaptors/quickbooks_online/vendor/operations/find.rb +1 -13
  69. data/lib/ledger_sync/adaptors/quickbooks_online/vendor/operations/update.rb +2 -29
  70. data/lib/ledger_sync/adaptors/test/account/operations/create.rb +5 -1
  71. data/lib/ledger_sync/adaptors/test/account/operations/find.rb +5 -1
  72. data/lib/ledger_sync/adaptors/test/account/operations/invalid.rb +1 -0
  73. data/lib/ledger_sync/adaptors/test/account/operations/update.rb +8 -2
  74. data/lib/ledger_sync/adaptors/test/account/operations/valid.rb +1 -0
  75. data/lib/ledger_sync/adaptors/test/customer/operations/create.rb +5 -1
  76. data/lib/ledger_sync/adaptors/test/customer/operations/find.rb +5 -1
  77. data/lib/ledger_sync/adaptors/test/customer/operations/invalid.rb +1 -0
  78. data/lib/ledger_sync/adaptors/test/customer/operations/update.rb +1 -24
  79. data/lib/ledger_sync/adaptors/test/customer/operations/valid.rb +3 -6
  80. data/lib/ledger_sync/adaptors/test/expense/operations/create.rb +8 -3
  81. data/lib/ledger_sync/adaptors/test/expense/operations/find.rb +4 -14
  82. data/lib/ledger_sync/adaptors/test/expense/operations/update.rb +2 -32
  83. data/lib/ledger_sync/adaptors/test/ledger_serializer.rb +64 -0
  84. data/lib/ledger_sync/adaptors/test/operation/create.rb +27 -0
  85. data/lib/ledger_sync/adaptors/test/operation/find.rb +29 -0
  86. data/lib/ledger_sync/adaptors/test/operation/update.rb +34 -0
  87. data/lib/ledger_sync/adaptors/test/payment/operations/create.rb +5 -1
  88. data/lib/ledger_sync/adaptors/test/payment/operations/find.rb +5 -1
  89. data/lib/ledger_sync/adaptors/test/payment/operations/update.rb +1 -23
  90. data/lib/ledger_sync/adaptors/test/transfer/operations/create.rb +1 -22
  91. data/lib/ledger_sync/adaptors/test/transfer/operations/find.rb +1 -13
  92. data/lib/ledger_sync/adaptors/test/transfer/operations/update.rb +1 -25
  93. data/lib/ledger_sync/adaptors/test/vendor/operations/create.rb +5 -1
  94. data/lib/ledger_sync/adaptors/test/vendor/operations/find.rb +7 -1
  95. data/lib/ledger_sync/adaptors/test/vendor/operations/invalid.rb +1 -0
  96. data/lib/ledger_sync/adaptors/test/vendor/operations/update.rb +1 -23
  97. data/lib/ledger_sync/adaptors/test/vendor/operations/valid.rb +1 -0
  98. data/lib/ledger_sync/error/adaptor_errors.rb +17 -5
  99. data/lib/ledger_sync/error/operation_errors.rb +12 -5
  100. data/lib/ledger_sync/error/resource_errors.rb +5 -1
  101. data/lib/ledger_sync/resource.rb +33 -6
  102. data/lib/ledger_sync/resource_attribute.rb +4 -0
  103. data/lib/ledger_sync/resource_attribute/dirty_mixin.rb +16 -0
  104. data/lib/ledger_sync/resource_attribute/mixin.rb +19 -7
  105. data/lib/ledger_sync/resource_attribute/reference/many.rb +55 -1
  106. data/lib/ledger_sync/resource_attribute_set.rb +6 -7
  107. data/lib/ledger_sync/resources/account.rb +1 -1
  108. data/lib/ledger_sync/resources/bill.rb +1 -0
  109. data/lib/ledger_sync/resources/bill_line_item.rb +2 -0
  110. data/lib/ledger_sync/resources/expense.rb +5 -1
  111. data/lib/ledger_sync/resources/expense_line_item.rb +2 -0
  112. data/lib/ledger_sync/resources/journal_entry.rb +1 -0
  113. data/lib/ledger_sync/result.rb +4 -3
  114. data/lib/ledger_sync/type/id.rb +34 -0
  115. data/lib/ledger_sync/type/reference_many.rb +8 -2
  116. data/lib/ledger_sync/type/reference_one.rb +5 -0
  117. data/lib/ledger_sync/type/value_mixin.rb +12 -0
  118. data/lib/ledger_sync/util/hash_helpers.rb +16 -0
  119. data/lib/ledger_sync/version.rb +1 -1
  120. data/qa.rb +142 -0
  121. metadata +38 -5
  122. data/lib/ledger_sync/adaptors/quickbooks_online/expense/mapping.rb +0 -15
  123. data/lib/ledger_sync/adaptors/quickbooks_online/journal_entry/mapping.rb +0 -14
  124. data/lib/ledger_sync/error/sync_errors.rb +0 -22
@@ -31,20 +31,19 @@ module LedgerSync
31
31
  name = attribute.name
32
32
  raise "Attribute #{name} already exists on #{resource.name}." if attributes.key?(name)
33
33
 
34
- case attribute
35
- when ResourceAttribute
36
- nil
37
- when ResourceAttribute::Reference::One
34
+ if attribute.is_a?(ResourceAttribute::Reference::One)
35
+ @attributes[attribute.name] = attribute
38
36
  @references << attribute
39
37
  @references_one << attribute
40
- when ResourceAttribute::Reference::Many
38
+ elsif attribute.is_a?(ResourceAttribute::Reference::Many)
39
+ @attributes[attribute.name] = attribute
41
40
  @references << attribute
42
41
  @references_many << attribute
42
+ elsif attribute.is_a?(ResourceAttribute)
43
+ @attributes[attribute.name] = attribute
43
44
  else
44
45
  raise 'Unknown attribute class'
45
46
  end
46
-
47
- @attributes[attribute.name] = attribute
48
47
  end
49
48
 
50
49
  def to_a
@@ -6,7 +6,7 @@ module LedgerSync
6
6
  attribute :classification, type: Type::String
7
7
  attribute :account_type, type: Type::String
8
8
  attribute :account_sub_type, type: Type::String
9
- attribute :number, type: Type::Integer
9
+ attribute :number, type: Type::String
10
10
  attribute :currency, type: Type::String
11
11
  attribute :description, type: Type::String
12
12
  attribute :active, type: Type::Boolean
@@ -4,6 +4,7 @@ module LedgerSync
4
4
  attribute :memo, type: Type::String
5
5
  attribute :transaction_date, type: Type::Date
6
6
  attribute :due_date, type: Type::Date
7
+ attribute :reference_number, type: Type::String
7
8
 
8
9
  references_one :vendor, to: Vendor
9
10
  references_one :account, to: Account
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module LedgerSync
2
4
  class BillLineItem < LedgerSync::Resource
3
5
  references_one :account, to: Account
@@ -1,17 +1,21 @@
1
1
  module LedgerSync
2
2
  class Expense < LedgerSync::Resource
3
3
  attribute :currency, type: Type::String
4
- attribute :amount, type: Type::Integer
5
4
  attribute :memo, type: Type::String
6
5
  attribute :payment_type, type: Type::String
7
6
  attribute :transaction_date, type: Type::Date
8
7
  attribute :exchange_rate, type: Type::Float
8
+ attribute :reference_number, type: Type::String
9
9
 
10
10
  references_one :vendor, to: Vendor
11
11
  references_one :account, to: Account
12
12
 
13
13
  references_many :line_items, to: ExpenseLineItem
14
14
 
15
+ def amount
16
+ line_items.map(&:amount).sum
17
+ end
18
+
15
19
  def name
16
20
  "Purchase: #{amount} #{currency}"
17
21
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module LedgerSync
2
4
  class ExpenseLineItem < LedgerSync::Resource
3
5
  references_one :account, to: Account
@@ -3,6 +3,7 @@ module LedgerSync
3
3
  attribute :currency, type: Type::String
4
4
  attribute :memo, type: Type::String
5
5
  attribute :transaction_date, type: Type::Date
6
+ attribute :reference_number, type: Type::String
6
7
 
7
8
  references_many :line_items, to: JournalEntryLineItem
8
9
 
@@ -27,16 +27,17 @@ module LedgerSync
27
27
 
28
28
  class OperationResult
29
29
  module ResultTypeBase
30
- attr_reader :operation, :response
30
+ attr_reader :operation, :resource, :response
31
31
 
32
32
  def self.included(base)
33
33
  base.class_eval do
34
- serialize only: %i[operation response]
34
+ serialize only: %i[operation resource response]
35
35
  end
36
36
  end
37
37
 
38
- def initialize(*args, operation:, response:)
38
+ def initialize(*args, operation:, resource:, response:)
39
39
  @operation = operation
40
+ @resource = resource
40
41
  @response = response
41
42
  super(*args)
42
43
  end
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ module LedgerSync
4
+ module Type
5
+ class ID < Value # :nodoc:
6
+ include ValueMixin
7
+
8
+ def cast?
9
+ true
10
+ end
11
+
12
+ def changed_in_place?(raw_old_value, new_value)
13
+ raw_old_value != new_value if new_value.is_a?(::String)
14
+ end
15
+
16
+ def type
17
+ :id
18
+ end
19
+
20
+ def valid_classes
21
+ [::String, ::Symbol, ::Integer]
22
+ end
23
+
24
+ private
25
+
26
+ def cast_value(value)
27
+ case value
28
+ when ::String then ::String.new(value)
29
+ else value.to_s
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
@@ -12,15 +12,21 @@ module LedgerSync
12
12
  super()
13
13
  end
14
14
 
15
+ def error_message(attribute:, resource:, value:)
16
+ return super unless value.is_a?(Array)
17
+
18
+ invalid_classes = value.reject { |e| e.is_a?(resource_class) }.map(&:class)
19
+ "Attribute #{attribute.name} for #{resource.class.name} should be an array of #{resource_class.name}. Given array containing: #{invalid_classes.join(', ')}"
20
+ end
21
+
15
22
  def type
16
23
  :reference_many
17
24
  end
18
25
 
19
26
  def valid_without_casting?(value:)
20
27
  return false unless value.is_a?(Array)
21
- return true if value.reject { |e| e.is_a?(resource_class) }.empty?
22
28
 
23
- false
29
+ value.reject { |e| e.is_a?(resource_class) }.empty?
24
30
  end
25
31
  end
26
32
  end
@@ -12,11 +12,16 @@ module LedgerSync
12
12
  super()
13
13
  end
14
14
 
15
+ def error_message(attribute:, resource:, value:)
16
+ "Attribute #{attribute.name} for #{resource.class.name} should be a #{resource_class.name}. Given #{value.class.name}"
17
+ end
18
+
15
19
  def type
16
20
  :reference_one
17
21
  end
18
22
 
19
23
  def valid_without_casting?(value:)
24
+ return true if value.nil?
20
25
  return true if value.is_a?(resource_class)
21
26
 
22
27
  false
@@ -4,6 +4,18 @@
4
4
  module LedgerSync
5
5
  module Type
6
6
  module ValueMixin
7
+ def self.included(base)
8
+ base.include SimplySerializable::Mixin
9
+ end
10
+
11
+ def cast?
12
+ false
13
+ end
14
+
15
+ def error_message(attribute:, resource:, value:)
16
+ "Attribute #{attribute.name} for #{resource.class.name} should be a class supported by #{self.class.name}. Given: #{value.class}"
17
+ end
18
+
7
19
  def valid_classes
8
20
  raise NotImplementedError
9
21
  end
@@ -7,6 +7,18 @@ module LedgerSync
7
7
  module HashHelpers
8
8
  module_function
9
9
 
10
+ def deep_merge(hash_to_merge_into:, other_hash:, &block)
11
+ hash_to_merge_into.merge(other_hash) do |key, this_val, other_val|
12
+ if this_val.is_a?(Hash) && other_val.is_a?(Hash)
13
+ deep_merge(hash_to_merge_into: this_val, other_hash: other_val, &block)
14
+ elsif block_given?
15
+ block.call(key, this_val, other_val)
16
+ else
17
+ other_val
18
+ end
19
+ end
20
+ end
21
+
10
22
  def deep_symbolize_keys(hash)
11
23
  deep_transform_keys_in_object(hash) { |key| key.to_sym rescue key }
12
24
  end
@@ -23,6 +35,10 @@ module LedgerSync
23
35
  object
24
36
  end
25
37
  end
38
+
39
+ def deep_stringify_keys(hash)
40
+ deep_transform_keys_in_object(hash) { |key| key.to_s rescue key }
41
+ end
26
42
  end
27
43
  end
28
44
  end
@@ -1,3 +1,3 @@
1
1
  module LedgerSync
2
- VERSION = '1.1.1'.freeze
2
+ VERSION = '1.1.2'.freeze
3
3
  end
data/qa.rb ADDED
@@ -0,0 +1,142 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require 'bundler/inline'
5
+ require 'yaml'
6
+
7
+ gemfile do
8
+ source 'https://rubygems.org'
9
+ gem 'byebug'
10
+ # gem 'ledger_sync'
11
+ gem 'ledger_sync', path: '/Users/ryanwjackson/dev/ledger_sync/ledger_sync'
12
+ gem 'activemodel'
13
+ end
14
+
15
+ config_path = "#{__dir__}/.qa_config.yml"
16
+
17
+ unless File.file?(config_path)
18
+ config_template = {
19
+ 'quickbooks_online' => {
20
+ 'access_token' => 'REQUIRED',
21
+ 'client_id' => 'REQUIRED',
22
+ 'client_secret' => 'REQUIRED',
23
+ 'realm_id' => 'REQUIRED',
24
+ 'refresh_token' => 'REQUIRED'
25
+ }
26
+ }
27
+ File.open(config_path, 'w') { |file| file.write(config_template.to_yaml) }
28
+ raise "Please fill out secret.yml located here:\n#{config_path}"
29
+ end
30
+
31
+ config = YAML.safe_load(File.read(config_path))
32
+
33
+ ### START: Shortcuts
34
+
35
+ LS = LedgerSync
36
+ QBO = LS::Adaptors::QuickBooksOnline
37
+
38
+ ### END: Shortcuts
39
+
40
+ ### START: Helper Methods
41
+
42
+ def perform(op)
43
+ if op.valid?
44
+ result = op.perform
45
+ byebug if op.failure?
46
+ return result
47
+ end
48
+
49
+ raise op.validate
50
+ end
51
+
52
+ ### END: Helper Methods
53
+
54
+ # TEST_RUN_ID = "#{Time.now}_#{(0...8).map { rand(65..90).chr }.join}"
55
+ TEST_RUN_ID = (0...8).map { rand(65..90).chr }.join
56
+
57
+ puts "Running Test: #{TEST_RUN_ID}"
58
+
59
+ adaptor = LedgerSync.adaptors.qbo.new(
60
+ access_token: config['quickbooks_online']['access_token'],
61
+ client_id: config['quickbooks_online']['client_id'],
62
+ client_secret: config['quickbooks_online']['client_secret'],
63
+ realm_id: config['quickbooks_online']['realm_id'],
64
+ refresh_token: config['quickbooks_online']['refresh_token'],
65
+ test: true
66
+ )
67
+ adaptor.refresh!
68
+
69
+ account = LS::Account.new(
70
+ name: "Test Account #{TEST_RUN_ID}",
71
+ classification: 'asset',
72
+ account_type: 'bank',
73
+ account_sub_type: 'cash_on_hand',
74
+ currency: 'usd',
75
+ description: "Test #{TEST_RUN_ID} Account description",
76
+ active: true
77
+ )
78
+
79
+ result = perform(QBO::Account::Operations::Create.new(
80
+ adaptor: adaptor,
81
+ resource: account
82
+ ))
83
+
84
+ account = result.resource
85
+
86
+ vendor = LS::Vendor.new(
87
+ email: "test-#{TEST_RUN_ID}-vendor@example.com",
88
+ first_name: "TestFirst#{TEST_RUN_ID}",
89
+ last_name: "TestLast#{TEST_RUN_ID}",
90
+ display_name: "Test #{TEST_RUN_ID} Display Name"
91
+ )
92
+
93
+ result = perform(QBO::Vendor::Operations::Create.new(
94
+ adaptor: adaptor,
95
+ resource: vendor
96
+ ))
97
+
98
+ vendor = result.resource
99
+
100
+ expense_line_item_1 = LS::ExpenseLineItem.new(
101
+ account: account,
102
+ amount: 12_345,
103
+ description: "Test #{TEST_RUN_ID} Line Item 1"
104
+ )
105
+
106
+ expense_line_item_2 = LS::ExpenseLineItem.new(
107
+ account: account,
108
+ amount: 23_456,
109
+ description: "Test #{TEST_RUN_ID} Line Item 2"
110
+ )
111
+
112
+ expense = LS::Expense.new(
113
+ currency: 'usd',
114
+ memo: 'Testing',
115
+ payment_type: 'cash',
116
+ transaction_date: Date.today,
117
+ exchange_rate: 1.0,
118
+ vendor: vendor,
119
+ account: account,
120
+ line_items: [
121
+ expense_line_item_1,
122
+ expense_line_item_2
123
+ ]
124
+ )
125
+ operation = QBO::Expense::Operations::Create.new(
126
+ adaptor: adaptor,
127
+ resource: expense
128
+ )
129
+
130
+ result = perform(operation)
131
+
132
+ pdb result.success?
133
+ byebug
134
+
135
+ puts "Writing secrets to secrets.yml...\n\n"
136
+
137
+ config['quickbooks_online']['access_token'] = adaptor.access_token
138
+ config['quickbooks_online']['refresh_token'] = adaptor.refresh_token
139
+
140
+ File.open(config_path, 'w') { |file| file.write(config.to_yaml) }
141
+
142
+ puts "BYE!\n\n"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ledger_sync
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Jackson
@@ -349,41 +349,68 @@ files:
349
349
  - lib/ledger_sync/adaptor_configuration_store.rb
350
350
  - lib/ledger_sync/adaptors/adaptor.rb
351
351
  - lib/ledger_sync/adaptors/contract.rb
352
+ - lib/ledger_sync/adaptors/ledger_serializer.rb
353
+ - lib/ledger_sync/adaptors/ledger_serializer_attribute.rb
354
+ - lib/ledger_sync/adaptors/ledger_serializer_attribute_set.rb
355
+ - lib/ledger_sync/adaptors/ledger_serializer_type/mapping_type.rb
356
+ - lib/ledger_sync/adaptors/ledger_serializer_type/references_many_type.rb
357
+ - lib/ledger_sync/adaptors/ledger_serializer_type/value_type.rb
352
358
  - lib/ledger_sync/adaptors/operation.rb
353
- - lib/ledger_sync/adaptors/quickbooks_online/account/mapping.rb
359
+ - lib/ledger_sync/adaptors/quickbooks_online/account/ledger_serializer.rb
354
360
  - lib/ledger_sync/adaptors/quickbooks_online/account/operations/create.rb
355
361
  - lib/ledger_sync/adaptors/quickbooks_online/account/operations/find.rb
356
362
  - lib/ledger_sync/adaptors/quickbooks_online/account/operations/update.rb
357
363
  - lib/ledger_sync/adaptors/quickbooks_online/account/searcher.rb
358
364
  - lib/ledger_sync/adaptors/quickbooks_online/adaptor.rb
365
+ - lib/ledger_sync/adaptors/quickbooks_online/bill/ledger_serializer.rb
359
366
  - lib/ledger_sync/adaptors/quickbooks_online/bill/operations/create.rb
360
367
  - lib/ledger_sync/adaptors/quickbooks_online/bill/operations/find.rb
361
368
  - lib/ledger_sync/adaptors/quickbooks_online/bill/operations/update.rb
362
369
  - lib/ledger_sync/adaptors/quickbooks_online/bill/searcher.rb
370
+ - lib/ledger_sync/adaptors/quickbooks_online/bill_line_item/ledger_serializer.rb
363
371
  - lib/ledger_sync/adaptors/quickbooks_online/config.rb
372
+ - lib/ledger_sync/adaptors/quickbooks_online/customer/ledger_serializer.rb
364
373
  - lib/ledger_sync/adaptors/quickbooks_online/customer/operations/create.rb
365
374
  - lib/ledger_sync/adaptors/quickbooks_online/customer/operations/find.rb
366
375
  - lib/ledger_sync/adaptors/quickbooks_online/customer/operations/update.rb
367
376
  - lib/ledger_sync/adaptors/quickbooks_online/customer/searcher.rb
377
+ - lib/ledger_sync/adaptors/quickbooks_online/deposit/ledger_serializer.rb
368
378
  - lib/ledger_sync/adaptors/quickbooks_online/deposit/operations/create.rb
369
379
  - lib/ledger_sync/adaptors/quickbooks_online/deposit/operations/find.rb
370
380
  - lib/ledger_sync/adaptors/quickbooks_online/deposit/operations/update.rb
371
381
  - lib/ledger_sync/adaptors/quickbooks_online/deposit/searcher.rb
372
- - lib/ledger_sync/adaptors/quickbooks_online/expense/mapping.rb
382
+ - lib/ledger_sync/adaptors/quickbooks_online/deposit_line_item/ledger_serializer.rb
383
+ - lib/ledger_sync/adaptors/quickbooks_online/expense/ledger_serializer.rb
373
384
  - lib/ledger_sync/adaptors/quickbooks_online/expense/operations/create.rb
374
385
  - lib/ledger_sync/adaptors/quickbooks_online/expense/operations/find.rb
375
386
  - lib/ledger_sync/adaptors/quickbooks_online/expense/operations/update.rb
376
387
  - lib/ledger_sync/adaptors/quickbooks_online/expense/searcher.rb
377
- - lib/ledger_sync/adaptors/quickbooks_online/journal_entry/mapping.rb
388
+ - lib/ledger_sync/adaptors/quickbooks_online/expense_line_item/ledger_serializer.rb
389
+ - lib/ledger_sync/adaptors/quickbooks_online/journal_entry/ledger_serializer.rb
378
390
  - lib/ledger_sync/adaptors/quickbooks_online/journal_entry/operations/create.rb
379
391
  - lib/ledger_sync/adaptors/quickbooks_online/journal_entry/operations/find.rb
380
392
  - lib/ledger_sync/adaptors/quickbooks_online/journal_entry/operations/update.rb
381
393
  - lib/ledger_sync/adaptors/quickbooks_online/journal_entry/searcher.rb
394
+ - lib/ledger_sync/adaptors/quickbooks_online/journal_entry_line_item/ledger_serializer.rb
395
+ - lib/ledger_sync/adaptors/quickbooks_online/ledger_serializer.rb
396
+ - lib/ledger_sync/adaptors/quickbooks_online/ledger_serializer_type/account_sub_type.rb
397
+ - lib/ledger_sync/adaptors/quickbooks_online/ledger_serializer_type/account_type.rb
398
+ - lib/ledger_sync/adaptors/quickbooks_online/ledger_serializer_type/amount_type.rb
399
+ - lib/ledger_sync/adaptors/quickbooks_online/ledger_serializer_type/classification_type.rb
400
+ - lib/ledger_sync/adaptors/quickbooks_online/ledger_serializer_type/date_type.rb
401
+ - lib/ledger_sync/adaptors/quickbooks_online/ledger_serializer_type/journal_entry_line_item_type.rb
402
+ - lib/ledger_sync/adaptors/quickbooks_online/ledger_serializer_type/payment_type.rb
382
403
  - lib/ledger_sync/adaptors/quickbooks_online/operation.rb
404
+ - lib/ledger_sync/adaptors/quickbooks_online/operation/create.rb
405
+ - lib/ledger_sync/adaptors/quickbooks_online/operation/find.rb
406
+ - lib/ledger_sync/adaptors/quickbooks_online/operation/full_update.rb
407
+ - lib/ledger_sync/adaptors/quickbooks_online/operation/sparse_update.rb
408
+ - lib/ledger_sync/adaptors/quickbooks_online/payment/ledger_serializer.rb
383
409
  - lib/ledger_sync/adaptors/quickbooks_online/payment/operations/create.rb
384
410
  - lib/ledger_sync/adaptors/quickbooks_online/payment/operations/find.rb
385
411
  - lib/ledger_sync/adaptors/quickbooks_online/payment/operations/update.rb
386
412
  - lib/ledger_sync/adaptors/quickbooks_online/searcher.rb
413
+ - lib/ledger_sync/adaptors/quickbooks_online/transfer/ledger_serializer.rb
387
414
  - lib/ledger_sync/adaptors/quickbooks_online/transfer/operations/create.rb
388
415
  - lib/ledger_sync/adaptors/quickbooks_online/transfer/operations/find.rb
389
416
  - lib/ledger_sync/adaptors/quickbooks_online/transfer/operations/update.rb
@@ -391,6 +418,7 @@ files:
391
418
  - lib/ledger_sync/adaptors/quickbooks_online/util/error_matcher.rb
392
419
  - lib/ledger_sync/adaptors/quickbooks_online/util/error_parser.rb
393
420
  - lib/ledger_sync/adaptors/quickbooks_online/util/operation_error_parser.rb
421
+ - lib/ledger_sync/adaptors/quickbooks_online/vendor/ledger_serializer.rb
394
422
  - lib/ledger_sync/adaptors/quickbooks_online/vendor/operations/create.rb
395
423
  - lib/ledger_sync/adaptors/quickbooks_online/vendor/operations/find.rb
396
424
  - lib/ledger_sync/adaptors/quickbooks_online/vendor/operations/update.rb
@@ -414,6 +442,10 @@ files:
414
442
  - lib/ledger_sync/adaptors/test/expense/operations/create.rb
415
443
  - lib/ledger_sync/adaptors/test/expense/operations/find.rb
416
444
  - lib/ledger_sync/adaptors/test/expense/operations/update.rb
445
+ - lib/ledger_sync/adaptors/test/ledger_serializer.rb
446
+ - lib/ledger_sync/adaptors/test/operation/create.rb
447
+ - lib/ledger_sync/adaptors/test/operation/find.rb
448
+ - lib/ledger_sync/adaptors/test/operation/update.rb
417
449
  - lib/ledger_sync/adaptors/test/payment/operations/create.rb
418
450
  - lib/ledger_sync/adaptors/test/payment/operations/find.rb
419
451
  - lib/ledger_sync/adaptors/test/payment/operations/update.rb
@@ -432,7 +464,6 @@ files:
432
464
  - lib/ledger_sync/error/adaptor_errors.rb
433
465
  - lib/ledger_sync/error/operation_errors.rb
434
466
  - lib/ledger_sync/error/resource_errors.rb
435
- - lib/ledger_sync/error/sync_errors.rb
436
467
  - lib/ledger_sync/resource.rb
437
468
  - lib/ledger_sync/resource_attribute.rb
438
469
  - lib/ledger_sync/resource_attribute/dirty_mixin.rb
@@ -458,6 +489,7 @@ files:
458
489
  - lib/ledger_sync/type/boolean.rb
459
490
  - lib/ledger_sync/type/date.rb
460
491
  - lib/ledger_sync/type/float.rb
492
+ - lib/ledger_sync/type/id.rb
461
493
  - lib/ledger_sync/type/integer.rb
462
494
  - lib/ledger_sync/type/reference_many.rb
463
495
  - lib/ledger_sync/type/reference_one.rb
@@ -471,6 +503,7 @@ files:
471
503
  - lib/ledger_sync/util/string_helpers.rb
472
504
  - lib/ledger_sync/util/validator.rb
473
505
  - lib/ledger_sync/version.rb
506
+ - qa.rb
474
507
  - release.sh
475
508
  homepage: https://github.com/LedgerSync/ledger_sync
476
509
  licenses: