ledger_sync 1.3.4 → 1.4.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (683) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +11 -2
  3. data/.overcommit.yml +30 -0
  4. data/.rubocop.yml +14 -1
  5. data/.travis.yml +12 -2
  6. data/Dockerfile +2 -2
  7. data/Gemfile +2 -0
  8. data/Gemfile.lock +99 -39
  9. data/LICENSE.txt +5 -21
  10. data/README.md +9 -489
  11. data/Rakefile +2 -0
  12. data/bin/console +1 -0
  13. data/bin/quickbooks_online_oauth_server.rb +103 -0
  14. data/docs/.gitignore +4 -0
  15. data/documentation/build.sh +10 -0
  16. data/documentation/generate.rb +32 -0
  17. data/documentation/generators/generator.rb +80 -0
  18. data/documentation/generators/guides/generator.rb +36 -0
  19. data/documentation/generators/reference/generator.rb +76 -0
  20. data/documentation/generators/reference/ledger/generator.rb +74 -0
  21. data/documentation/generators/template.rb +22 -0
  22. data/documentation/helper_methods.rb +17 -0
  23. data/documentation/site/CNAME +1 -0
  24. data/documentation/site/LICENSE.md +40 -0
  25. data/documentation/site/README.md +8 -0
  26. data/documentation/site/_config.yml +119 -0
  27. data/documentation/site/_data/guides_sections.yml +10 -0
  28. data/documentation/site/_data/reference_sections.yml +5 -0
  29. data/documentation/site/_includes/action_link.html +11 -0
  30. data/documentation/site/_includes/alerts/base.html +3 -0
  31. data/documentation/site/_includes/alerts/danger.html +1 -0
  32. data/documentation/site/_includes/alerts/info.html +1 -0
  33. data/documentation/site/_includes/alerts/success.html +1 -0
  34. data/documentation/site/_includes/alerts/warning.html +1 -0
  35. data/documentation/site/_includes/cta_buttons.html +4 -0
  36. data/documentation/site/_includes/example.md +8 -0
  37. data/documentation/site/_includes/footer.html +20 -0
  38. data/documentation/site/_includes/getting_help.md +8 -0
  39. data/documentation/site/_includes/guides_menu.html +29 -0
  40. data/documentation/site/_includes/guides_submenu.html +7 -0
  41. data/documentation/site/_includes/header.html +35 -0
  42. data/documentation/site/_includes/installation_instructions.md +17 -0
  43. data/documentation/site/_includes/ledgers/netsuite_soap_summary.md +1 -0
  44. data/documentation/site/_includes/ledgers/netsuite_summary.md +1 -0
  45. data/documentation/site/_includes/ledgers/netsuite_summary_shared.md +1 -0
  46. data/documentation/site/_includes/ledgers/quickbooks_online_summary.md +1 -0
  47. data/documentation/site/_includes/ledgers/stripe_summary.md +1 -0
  48. data/documentation/site/_includes/reference/netsuite/authentication/_token_based_authentication.md +99 -0
  49. data/documentation/site/_includes/reference/netsuite/authentication/index.md +15 -0
  50. data/documentation/site/_includes/reference/netsuite/authentication/token_based_authentication.md +6 -0
  51. data/documentation/site/_includes/reference/netsuite/index.md +25 -0
  52. data/documentation/site/_includes/reference/netsuite_soap/index.md +11 -0
  53. data/documentation/site/_includes/reference/quickbooks_online/authentication/index.md +55 -0
  54. data/documentation/site/_includes/reference/quickbooks_online/errors/index.md +9 -0
  55. data/documentation/site/_includes/reference/quickbooks_online/index.md +6 -0
  56. data/documentation/site/_includes/reference/quickbooks_online/webhooks/index.md +42 -0
  57. data/documentation/site/_includes/reference/stripe/index.md +6 -0
  58. data/documentation/site/_includes/section_content.html +29 -0
  59. data/documentation/site/_includes/section_cta.html +24 -0
  60. data/documentation/site/_includes/section_grid.html +45 -0
  61. data/documentation/site/_includes/section_guides.html +35 -0
  62. data/documentation/site/_includes/section_hero.html +23 -0
  63. data/documentation/site/_includes/submenu.html +7 -0
  64. data/documentation/site/_layouts/advanced.html +8 -0
  65. data/documentation/site/_layouts/base.html +34 -0
  66. data/documentation/site/_layouts/blog.html +51 -0
  67. data/documentation/site/_layouts/body.html +11 -0
  68. data/documentation/site/_layouts/guides.html +46 -0
  69. data/documentation/site/_layouts/page.html +26 -0
  70. data/documentation/site/_layouts/post.html +52 -0
  71. data/documentation/site/_layouts/reference.html +46 -0
  72. data/documentation/site/_layouts/reference_netsuite.html +46 -0
  73. data/documentation/site/_layouts/reference_netsuite_soap.html +46 -0
  74. data/documentation/site/_layouts/reference_quickbooks_online.html +46 -0
  75. data/documentation/site/_layouts/reference_stripe.html +46 -0
  76. data/documentation/site/_plugins/filters.rb +122 -0
  77. data/documentation/site/_plugins/hooks.rb +9 -0
  78. data/documentation/site/_posts/2020-06-01-introducing-docs.md +17 -0
  79. data/documentation/site/_posts/2020-06-10-netsuite-authentication.md +382 -0
  80. data/documentation/site/_sass/imports/_animations.scss +19 -0
  81. data/documentation/site/_sass/imports/_footer.scss +94 -0
  82. data/documentation/site/_sass/imports/_functions.scss +69 -0
  83. data/documentation/site/_sass/imports/_general.scss +687 -0
  84. data/documentation/site/_sass/imports/_guides.scss +300 -0
  85. data/documentation/site/_sass/imports/_header.scss +358 -0
  86. data/documentation/site/_sass/imports/_icons.scss +90 -0
  87. data/documentation/site/_sass/imports/_post-navigation.scss +67 -0
  88. data/documentation/site/_sass/imports/_posts-pages.scss +165 -0
  89. data/documentation/site/_sass/imports/_prism.scss +174 -0
  90. data/documentation/site/_sass/imports/_reset.scss +210 -0
  91. data/documentation/site/_sass/imports/_sections.scss +370 -0
  92. data/documentation/site/_sass/imports/_structure.scss +44 -0
  93. data/documentation/site/_templates/_layouts/reference_ledger.html.erb +46 -0
  94. data/documentation/site/_templates/guides/ledger.md.erb +9 -0
  95. data/documentation/site/_templates/reference/resources/index.md.erb +9 -0
  96. data/documentation/site/_templates/reference/resources/resource.md.erb +41 -0
  97. data/documentation/site/assets/css/brands.min.css +5 -0
  98. data/documentation/site/assets/css/fontawesome.min.css +5 -0
  99. data/documentation/site/assets/css/main.scss +45 -0
  100. data/documentation/site/assets/css/monokai.css +441 -0
  101. data/documentation/site/assets/js/main.js +214 -0
  102. data/documentation/site/assets/js/plugins.js +22 -0
  103. data/documentation/site/assets/js/prism.js +9 -0
  104. data/documentation/site/assets/webfonts/fa-brands-400.eot +0 -0
  105. data/documentation/site/assets/webfonts/fa-brands-400.svg +3452 -0
  106. data/documentation/site/assets/webfonts/fa-brands-400.ttf +0 -0
  107. data/documentation/site/assets/webfonts/fa-brands-400.woff +0 -0
  108. data/documentation/site/assets/webfonts/fa-brands-400.woff2 +0 -0
  109. data/documentation/site/blog/index.md +6 -0
  110. data/documentation/site/guides/architecture/clients.md +35 -0
  111. data/documentation/site/guides/architecture/index.md +14 -0
  112. data/documentation/site/guides/architecture/operations.md +45 -0
  113. data/documentation/site/guides/architecture/resources.md +40 -0
  114. data/documentation/site/guides/architecture/results.md +6 -0
  115. data/documentation/site/guides/architecture/searchers.md +28 -0
  116. data/documentation/site/guides/architecture/serialization.md +59 -0
  117. data/documentation/site/guides/community/index.md +8 -0
  118. data/documentation/site/guides/contribute/console.md +6 -0
  119. data/documentation/site/guides/contribute/deployment.md +17 -0
  120. data/documentation/site/guides/contribute/documentation.md +37 -0
  121. data/documentation/site/guides/contribute/index.md +18 -0
  122. data/documentation/site/guides/contribute/qa.md +16 -0
  123. data/documentation/site/guides/contribute/testing.md +6 -0
  124. data/documentation/site/guides/customization/custom_resources.md +50 -0
  125. data/documentation/site/guides/customization/custom_serializers.md +47 -0
  126. data/documentation/site/guides/customization/index.md +15 -0
  127. data/documentation/site/guides/customization/resource_converters.md +79 -0
  128. data/documentation/site/guides/getting-started/get-help.md +7 -0
  129. data/documentation/site/guides/getting-started/index.md +8 -0
  130. data/documentation/site/guides/getting-started/installation.md +7 -0
  131. data/documentation/site/guides/getting-started/quick-start.md +123 -0
  132. data/documentation/site/guides/index.md +16 -0
  133. data/documentation/site/guides/ledgers/index.md +12 -0
  134. data/documentation/site/guides/ledgers/netsuite.md +9 -0
  135. data/documentation/site/guides/ledgers/netsuite_soap.md +9 -0
  136. data/documentation/site/guides/ledgers/quickbooks_online.md +9 -0
  137. data/documentation/site/guides/ledgers/stripe.md +9 -0
  138. data/documentation/site/guides/modern-treasury/index.md +14 -0
  139. data/documentation/site/guides/tips_and_more/index.md +76 -0
  140. data/documentation/site/images/1.jpg +0 -0
  141. data/documentation/site/images/10.jpg +0 -0
  142. data/documentation/site/images/2.jpg +0 -0
  143. data/documentation/site/images/3.jpg +0 -0
  144. data/documentation/site/images/4.jpg +0 -0
  145. data/documentation/site/images/5.jpg +0 -0
  146. data/documentation/site/images/6.jpg +0 -0
  147. data/documentation/site/images/7.jpg +0 -0
  148. data/documentation/site/images/8.jpg +0 -0
  149. data/documentation/site/images/9.jpg +0 -0
  150. data/documentation/site/images/logo.svg +8 -0
  151. data/documentation/site/index.md +99 -0
  152. data/documentation/site/overview.md +21 -0
  153. data/documentation/site/reference/index.md +6 -0
  154. data/documentation/site/reference/netsuite/authentication/_token_based_authentication.md +99 -0
  155. data/documentation/site/reference/netsuite/authentication/index.md +15 -0
  156. data/documentation/site/reference/netsuite/authentication/token_based_authentication.md +6 -0
  157. data/documentation/site/reference/netsuite/index.md +25 -0
  158. data/documentation/site/reference/netsuite/resources/account.md +44 -0
  159. data/documentation/site/reference/netsuite/resources/check.md +55 -0
  160. data/documentation/site/reference/netsuite/resources/check_line_item.md +27 -0
  161. data/documentation/site/reference/netsuite/resources/currency.md +49 -0
  162. data/documentation/site/reference/netsuite/resources/customer.md +54 -0
  163. data/documentation/site/reference/netsuite/resources/customer_deposit.md +52 -0
  164. data/documentation/site/reference/netsuite/resources/department.md +53 -0
  165. data/documentation/site/reference/netsuite/resources/deposit.md +29 -0
  166. data/documentation/site/reference/netsuite/resources/deposit_line_item.md +27 -0
  167. data/documentation/site/reference/netsuite/resources/index.md +25 -0
  168. data/documentation/site/reference/netsuite/resources/invoice.md +29 -0
  169. data/documentation/site/reference/netsuite/resources/invoice_line_item.md +26 -0
  170. data/documentation/site/reference/netsuite/resources/item.md +23 -0
  171. data/documentation/site/reference/netsuite/resources/journal_entry.md +52 -0
  172. data/documentation/site/reference/netsuite/resources/journal_entry_line_item.md +28 -0
  173. data/documentation/site/reference/netsuite/resources/ledger_class.md +53 -0
  174. data/documentation/site/reference/netsuite/resources/location.md +49 -0
  175. data/documentation/site/reference/netsuite/resources/resource.md +22 -0
  176. data/documentation/site/reference/netsuite/resources/subsidiary.md +26 -0
  177. data/documentation/site/reference/netsuite/resources/vendor.md +55 -0
  178. data/documentation/site/reference/netsuite_soap/index.md +11 -0
  179. data/documentation/site/reference/netsuite_soap/resources/customer.md +38 -0
  180. data/documentation/site/reference/netsuite_soap/resources/index.md +9 -0
  181. data/documentation/site/reference/netsuite_soap/resources/resource.md +22 -0
  182. data/documentation/site/reference/netsuite_soap/resources/subsidiary.md +36 -0
  183. data/documentation/site/reference/quickbooks_online/authentication/index.md +55 -0
  184. data/documentation/site/reference/quickbooks_online/errors/index.md +9 -0
  185. data/documentation/site/reference/quickbooks_online/index.md +6 -0
  186. data/documentation/site/reference/quickbooks_online/resources/account.md +50 -0
  187. data/documentation/site/reference/quickbooks_online/resources/bill.md +51 -0
  188. data/documentation/site/reference/quickbooks_online/resources/bill_line_item.md +26 -0
  189. data/documentation/site/reference/quickbooks_online/resources/bill_payment.md +53 -0
  190. data/documentation/site/reference/quickbooks_online/resources/bill_payment_line_item.md +24 -0
  191. data/documentation/site/reference/quickbooks_online/resources/currency.md +25 -0
  192. data/documentation/site/reference/quickbooks_online/resources/customer.md +46 -0
  193. data/documentation/site/reference/quickbooks_online/resources/department.md +47 -0
  194. data/documentation/site/reference/quickbooks_online/resources/deposit.md +49 -0
  195. data/documentation/site/reference/quickbooks_online/resources/deposit_line_item.md +27 -0
  196. data/documentation/site/reference/quickbooks_online/resources/expense.md +52 -0
  197. data/documentation/site/reference/quickbooks_online/resources/expense_line_item.md +26 -0
  198. data/documentation/site/reference/quickbooks_online/resources/index.md +33 -0
  199. data/documentation/site/reference/quickbooks_online/resources/invoice.md +47 -0
  200. data/documentation/site/reference/quickbooks_online/resources/invoice_sales_line_item.md +26 -0
  201. data/documentation/site/reference/quickbooks_online/resources/item.md +23 -0
  202. data/documentation/site/reference/quickbooks_online/resources/journal_entry.md +47 -0
  203. data/documentation/site/reference/quickbooks_online/resources/journal_entry_line_item.md +28 -0
  204. data/documentation/site/reference/quickbooks_online/resources/ledger_class.md +47 -0
  205. data/documentation/site/reference/quickbooks_online/resources/payment.md +50 -0
  206. data/documentation/site/reference/quickbooks_online/resources/payment_line_item.md +24 -0
  207. data/documentation/site/reference/quickbooks_online/resources/preferences.md +38 -0
  208. data/documentation/site/reference/quickbooks_online/resources/primary_email_addr.md +23 -0
  209. data/documentation/site/reference/quickbooks_online/resources/primary_phone.md +23 -0
  210. data/documentation/site/reference/quickbooks_online/resources/resource.md +22 -0
  211. data/documentation/site/reference/quickbooks_online/resources/subsidiary.md +24 -0
  212. data/documentation/site/reference/quickbooks_online/resources/transfer.md +46 -0
  213. data/documentation/site/reference/quickbooks_online/resources/vendor.md +49 -0
  214. data/documentation/site/reference/quickbooks_online/webhooks/index.md +42 -0
  215. data/documentation/site/reference/stripe/index.md +6 -0
  216. data/documentation/site/reference/stripe/resources/customer.md +49 -0
  217. data/documentation/site/reference/stripe/resources/index.md +8 -0
  218. data/documentation/site/reference/stripe/resources/resource.md +22 -0
  219. data/documentation/site/style-guide.md +137 -0
  220. data/ledger_sync.gemspec +8 -2
  221. data/lib/ledger_sync.rb +47 -62
  222. data/lib/ledger_sync/concerns/validatable.rb +2 -0
  223. data/lib/ledger_sync/core_ext/resonad.rb +2 -2
  224. data/lib/ledger_sync/deserializer.rb +108 -0
  225. data/lib/ledger_sync/error.rb +15 -0
  226. data/lib/ledger_sync/error/{adaptor_errors.rb → ledger_errors.rb} +13 -13
  227. data/lib/ledger_sync/error/operation_errors.rb +1 -1
  228. data/lib/ledger_sync/error/resource_errors.rb +49 -19
  229. data/lib/ledger_sync/{adaptor_configuration.rb → ledger_configuration.rb} +12 -12
  230. data/lib/ledger_sync/ledger_configuration_store.rb +60 -0
  231. data/lib/ledger_sync/{adaptors/adaptor.rb → ledgers/client.rb} +35 -17
  232. data/lib/ledger_sync/{adaptors → ledgers}/contract.rb +1 -1
  233. data/lib/ledger_sync/ledgers/dashboard_url_helper.rb +23 -0
  234. data/lib/ledger_sync/ledgers/mixins/infer_client_mixin.rb +28 -0
  235. data/lib/ledger_sync/{adaptors → ledgers}/mixins/infer_resource_class_mixin.rb +5 -2
  236. data/lib/ledger_sync/ledgers/mixins/infer_serializer_mixin.rb +54 -0
  237. data/lib/ledger_sync/{adaptors → ledgers}/mixins/infer_validation_contract_mixin.rb +1 -1
  238. data/lib/ledger_sync/{adaptors → ledgers}/mixins/offset_and_limit_pagination_searcher_mixin.rb +1 -1
  239. data/lib/ledger_sync/ledgers/mixins/serialization_mixin.rb +41 -0
  240. data/lib/ledger_sync/ledgers/netsuite/account/deserializer.rb +23 -0
  241. data/lib/ledger_sync/{adaptors → ledgers}/netsuite/account/operations/create.rb +4 -4
  242. data/lib/ledger_sync/{adaptors → ledgers}/netsuite/account/operations/find.rb +4 -4
  243. data/lib/ledger_sync/{adaptors → ledgers}/netsuite/account/searcher.rb +2 -2
  244. data/lib/ledger_sync/ledgers/netsuite/account/searcher_deserializer.rb +29 -0
  245. data/lib/ledger_sync/ledgers/netsuite/account/serializer.rb +21 -0
  246. data/lib/ledger_sync/ledgers/netsuite/check/deserializer.rb +29 -0
  247. data/lib/ledger_sync/ledgers/netsuite/check/operations/create.rb +27 -0
  248. data/lib/ledger_sync/ledgers/netsuite/check/operations/delete.rb +27 -0
  249. data/lib/ledger_sync/ledgers/netsuite/check/operations/find.rb +27 -0
  250. data/lib/ledger_sync/ledgers/netsuite/check/operations/update.rb +27 -0
  251. data/lib/ledger_sync/ledgers/netsuite/check/searcher.rb +15 -0
  252. data/lib/ledger_sync/ledgers/netsuite/check/searcher_deserializer.rb +16 -0
  253. data/lib/ledger_sync/ledgers/netsuite/check/serializer.rb +51 -0
  254. data/lib/ledger_sync/ledgers/netsuite/check_line_item/deserializer.rb +17 -0
  255. data/lib/ledger_sync/ledgers/netsuite/check_line_item/serializer.rb +25 -0
  256. data/lib/ledger_sync/{adaptors/netsuite/adaptor.rb → ledgers/netsuite/client.rb} +47 -16
  257. data/lib/ledger_sync/ledgers/netsuite/config.rb +5 -0
  258. data/lib/ledger_sync/ledgers/netsuite/currency/deserializer.rb +23 -0
  259. data/lib/ledger_sync/{adaptors → ledgers}/netsuite/currency/operations/create.rb +3 -3
  260. data/lib/ledger_sync/{adaptors → ledgers}/netsuite/currency/operations/delete.rb +3 -3
  261. data/lib/ledger_sync/{adaptors → ledgers}/netsuite/currency/operations/find.rb +3 -3
  262. data/lib/ledger_sync/{adaptors → ledgers}/netsuite/currency/operations/update.rb +3 -3
  263. data/lib/ledger_sync/ledgers/netsuite/currency/serializer.rb +21 -0
  264. data/lib/ledger_sync/ledgers/netsuite/customer/deserializer.rb +22 -0
  265. data/lib/ledger_sync/{adaptors → ledgers}/netsuite/customer/operations/create.rb +7 -5
  266. data/lib/ledger_sync/{adaptors → ledgers}/netsuite/customer/operations/delete.rb +7 -5
  267. data/lib/ledger_sync/{adaptors → ledgers}/netsuite/customer/operations/find.rb +7 -5
  268. data/lib/ledger_sync/{adaptors → ledgers}/netsuite/customer/operations/update.rb +7 -5
  269. data/lib/ledger_sync/{adaptors/netsuite/department → ledgers/netsuite/customer}/searcher.rb +2 -2
  270. data/lib/ledger_sync/ledgers/netsuite/customer/searcher_deserializer.rb +18 -0
  271. data/lib/ledger_sync/ledgers/netsuite/customer/serializer.rb +29 -0
  272. data/lib/ledger_sync/ledgers/netsuite/customer_deposit/deserializer.rb +20 -0
  273. data/lib/ledger_sync/ledgers/netsuite/customer_deposit/operations/create.rb +24 -0
  274. data/lib/ledger_sync/ledgers/netsuite/customer_deposit/operations/delete.rb +24 -0
  275. data/lib/ledger_sync/ledgers/netsuite/customer_deposit/operations/find.rb +24 -0
  276. data/lib/ledger_sync/ledgers/netsuite/customer_deposit/operations/update.rb +24 -0
  277. data/lib/ledger_sync/ledgers/netsuite/customer_deposit/searcher.rb +12 -0
  278. data/lib/ledger_sync/ledgers/netsuite/customer_deposit/searcher_deserializer.rb +16 -0
  279. data/lib/ledger_sync/ledgers/netsuite/customer_deposit/serializer.rb +25 -0
  280. data/lib/ledger_sync/ledgers/netsuite/dashboard_url_helper.rb +28 -0
  281. data/lib/ledger_sync/ledgers/netsuite/department/deserializer.rb +15 -0
  282. data/lib/ledger_sync/{adaptors → ledgers}/netsuite/department/operations/create.rb +3 -3
  283. data/lib/ledger_sync/{adaptors → ledgers}/netsuite/department/operations/delete.rb +3 -3
  284. data/lib/ledger_sync/{adaptors → ledgers}/netsuite/department/operations/find.rb +3 -3
  285. data/lib/ledger_sync/{adaptors → ledgers}/netsuite/department/operations/update.rb +3 -3
  286. data/lib/ledger_sync/ledgers/netsuite/department/searcher.rb +12 -0
  287. data/lib/ledger_sync/ledgers/netsuite/department/searcher_deserializer.rb +19 -0
  288. data/lib/ledger_sync/ledgers/netsuite/department/serializer.rb +13 -0
  289. data/lib/ledger_sync/ledgers/netsuite/deserializer.rb +18 -0
  290. data/lib/ledger_sync/ledgers/netsuite/error.rb +19 -0
  291. data/lib/ledger_sync/ledgers/netsuite/journal_entry/deserializer.rb +31 -0
  292. data/lib/ledger_sync/ledgers/netsuite/journal_entry/operations/create.rb +26 -0
  293. data/lib/ledger_sync/ledgers/netsuite/journal_entry/operations/delete.rb +26 -0
  294. data/lib/ledger_sync/ledgers/netsuite/journal_entry/operations/find.rb +26 -0
  295. data/lib/ledger_sync/ledgers/netsuite/journal_entry/operations/update.rb +30 -0
  296. data/lib/ledger_sync/ledgers/netsuite/journal_entry/serializer.rb +36 -0
  297. data/lib/ledger_sync/ledgers/netsuite/journal_entry_line_item/deserializer.rb +20 -0
  298. data/lib/ledger_sync/ledgers/netsuite/journal_entry_line_item/serializer.rb +21 -0
  299. data/lib/ledger_sync/ledgers/netsuite/ledger_class/deserializer.rb +15 -0
  300. data/lib/ledger_sync/ledgers/netsuite/ledger_class/operations/create.rb +25 -0
  301. data/lib/ledger_sync/ledgers/netsuite/ledger_class/operations/delete.rb +25 -0
  302. data/lib/ledger_sync/ledgers/netsuite/ledger_class/operations/find.rb +25 -0
  303. data/lib/ledger_sync/ledgers/netsuite/ledger_class/operations/update.rb +25 -0
  304. data/lib/ledger_sync/ledgers/netsuite/ledger_class/searcher.rb +12 -0
  305. data/lib/ledger_sync/ledgers/netsuite/ledger_class/searcher_deserializer.rb +19 -0
  306. data/lib/ledger_sync/ledgers/netsuite/ledger_class/serializer.rb +13 -0
  307. data/lib/ledger_sync/ledgers/netsuite/location/deserializer.rb +15 -0
  308. data/lib/ledger_sync/ledgers/netsuite/location/operations/create.rb +21 -0
  309. data/lib/ledger_sync/ledgers/netsuite/location/operations/delete.rb +21 -0
  310. data/lib/ledger_sync/ledgers/netsuite/location/operations/find.rb +21 -0
  311. data/lib/ledger_sync/ledgers/netsuite/location/operations/update.rb +21 -0
  312. data/lib/ledger_sync/ledgers/netsuite/location/searcher.rb +12 -0
  313. data/lib/ledger_sync/ledgers/netsuite/location/serializer.rb +13 -0
  314. data/lib/ledger_sync/ledgers/netsuite/operation.rb +40 -0
  315. data/lib/ledger_sync/{adaptors → ledgers}/netsuite/operation/create.rb +6 -13
  316. data/lib/ledger_sync/{adaptors → ledgers}/netsuite/operation/delete.rb +4 -4
  317. data/lib/ledger_sync/{adaptors → ledgers}/netsuite/operation/find.rb +9 -5
  318. data/lib/ledger_sync/{adaptors → ledgers}/netsuite/operation/update.rb +6 -13
  319. data/lib/ledger_sync/{adaptors → ledgers}/netsuite/record/http_method.rb +3 -3
  320. data/lib/ledger_sync/{adaptors → ledgers}/netsuite/record/metadata.rb +17 -13
  321. data/lib/ledger_sync/{adaptors → ledgers}/netsuite/record/parameter.rb +2 -2
  322. data/lib/ledger_sync/{adaptors → ledgers}/netsuite/record/property.rb +2 -2
  323. data/lib/ledger_sync/ledgers/netsuite/reference/serializer.rb +13 -0
  324. data/lib/ledger_sync/ledgers/netsuite/resource.rb +10 -0
  325. data/lib/ledger_sync/ledgers/netsuite/resources/account.rb +43 -0
  326. data/lib/ledger_sync/ledgers/netsuite/resources/check.rb +23 -0
  327. data/lib/ledger_sync/ledgers/netsuite/resources/check_line_item.rb +15 -0
  328. data/lib/ledger_sync/ledgers/netsuite/resources/currency.rb +13 -0
  329. data/lib/ledger_sync/ledgers/netsuite/resources/customer.rb +19 -0
  330. data/lib/ledger_sync/ledgers/netsuite/resources/customer_deposit.rb +15 -0
  331. data/lib/ledger_sync/ledgers/netsuite/resources/department.rb +16 -0
  332. data/lib/ledger_sync/ledgers/netsuite/resources/deposit.rb +28 -0
  333. data/lib/ledger_sync/ledgers/netsuite/resources/deposit_line_item.rb +25 -0
  334. data/lib/ledger_sync/ledgers/netsuite/resources/invoice.rb +28 -0
  335. data/lib/ledger_sync/ledgers/netsuite/resources/invoice_line_item.rb +21 -0
  336. data/lib/ledger_sync/ledgers/netsuite/resources/item.rb +11 -0
  337. data/lib/ledger_sync/ledgers/netsuite/resources/journal_entry.rb +26 -0
  338. data/lib/ledger_sync/ledgers/netsuite/resources/journal_entry_line_item.rb +24 -0
  339. data/lib/ledger_sync/ledgers/netsuite/resources/ledger_class.rb +16 -0
  340. data/lib/ledger_sync/ledgers/netsuite/resources/location.rb +11 -0
  341. data/lib/ledger_sync/ledgers/netsuite/resources/subsidiary.rb +12 -0
  342. data/lib/ledger_sync/ledgers/netsuite/resources/vendor.rb +23 -0
  343. data/lib/ledger_sync/ledgers/netsuite/searcher.rb +66 -0
  344. data/lib/ledger_sync/ledgers/netsuite/serializer.rb +13 -0
  345. data/lib/ledger_sync/ledgers/netsuite/subsidiary/deserializer.rb +17 -0
  346. data/lib/ledger_sync/ledgers/netsuite/subsidiary/searcher.rb +12 -0
  347. data/lib/ledger_sync/ledgers/netsuite/subsidiary/searcher_deserializer.rb +15 -0
  348. data/lib/ledger_sync/ledgers/netsuite/subsidiary/serializer.rb +15 -0
  349. data/lib/ledger_sync/{adaptors → ledgers}/netsuite/token.rb +19 -23
  350. data/lib/ledger_sync/ledgers/netsuite/type/deserializer_active_type.rb +32 -0
  351. data/lib/ledger_sync/ledgers/netsuite/type/deserializer_customer_type.rb +33 -0
  352. data/lib/ledger_sync/ledgers/netsuite/type/deserializer_entity_type.rb +30 -0
  353. data/lib/ledger_sync/ledgers/netsuite/type/deserializer_subsidiary_type.rb +33 -0
  354. data/lib/ledger_sync/ledgers/netsuite/vendor/deserializer.rb +30 -0
  355. data/lib/ledger_sync/{adaptors → ledgers}/netsuite/vendor/operations/create.rb +3 -3
  356. data/lib/ledger_sync/{adaptors → ledgers}/netsuite/vendor/operations/delete.rb +3 -3
  357. data/lib/ledger_sync/{adaptors → ledgers}/netsuite/vendor/operations/find.rb +3 -3
  358. data/lib/ledger_sync/{adaptors → ledgers}/netsuite/vendor/operations/update.rb +3 -3
  359. data/lib/ledger_sync/ledgers/netsuite/vendor/searcher.rb +12 -0
  360. data/lib/ledger_sync/ledgers/netsuite/vendor/searcher_deserializer.rb +21 -0
  361. data/lib/ledger_sync/ledgers/netsuite/vendor/serializer.rb +30 -0
  362. data/lib/ledger_sync/{adaptors/netsuite_soap/adaptor.rb → ledgers/netsuite_soap/client.rb} +17 -23
  363. data/lib/ledger_sync/ledgers/netsuite_soap/config.rb +5 -0
  364. data/lib/ledger_sync/{adaptors → ledgers}/netsuite_soap/customer/operations/create.rb +5 -3
  365. data/lib/ledger_sync/{adaptors → ledgers}/netsuite_soap/customer/operations/find.rb +3 -3
  366. data/lib/ledger_sync/{adaptors → ledgers}/netsuite_soap/operation.rb +5 -5
  367. data/lib/ledger_sync/{adaptors → ledgers}/netsuite_soap/operation/create.rb +5 -5
  368. data/lib/ledger_sync/{adaptors → ledgers}/netsuite_soap/operation/find.rb +2 -2
  369. data/lib/ledger_sync/ledgers/netsuite_soap/resource.rb +10 -0
  370. data/lib/ledger_sync/ledgers/netsuite_soap/resources/customer.rb +29 -0
  371. data/lib/ledger_sync/ledgers/netsuite_soap/resources/subsidiary.rb +12 -0
  372. data/lib/ledger_sync/{adaptors → ledgers}/netsuite_soap/subsidiary/operations/create.rb +3 -3
  373. data/lib/ledger_sync/{adaptors → ledgers}/netsuite_soap/subsidiary/operations/find.rb +3 -3
  374. data/lib/ledger_sync/{adaptors → ledgers}/operation.rb +41 -34
  375. data/lib/ledger_sync/ledgers/quickbooks_online/account/deserializer.rb +43 -0
  376. data/lib/ledger_sync/{adaptors → ledgers}/quickbooks_online/account/operations/create.rb +6 -4
  377. data/lib/ledger_sync/{adaptors → ledgers}/quickbooks_online/account/operations/find.rb +6 -4
  378. data/lib/ledger_sync/{adaptors → ledgers}/quickbooks_online/account/operations/update.rb +4 -4
  379. data/lib/ledger_sync/{adaptors → ledgers}/quickbooks_online/account/searcher.rb +2 -2
  380. data/lib/ledger_sync/ledgers/quickbooks_online/account/serializer.rb +37 -0
  381. data/lib/ledger_sync/ledgers/quickbooks_online/bill/deserializer.rb +45 -0
  382. data/lib/ledger_sync/{adaptors → ledgers}/quickbooks_online/bill/operations/create.rb +5 -3
  383. data/lib/ledger_sync/{adaptors → ledgers}/quickbooks_online/bill/operations/find.rb +5 -3
  384. data/lib/ledger_sync/{adaptors → ledgers}/quickbooks_online/bill/operations/update.rb +5 -3
  385. data/lib/ledger_sync/{adaptors → ledgers}/quickbooks_online/bill/searcher.rb +2 -2
  386. data/lib/ledger_sync/ledgers/quickbooks_online/bill/serializer.rb +44 -0
  387. data/lib/ledger_sync/ledgers/quickbooks_online/bill_line_item/deserializer.rb +25 -0
  388. data/lib/ledger_sync/ledgers/quickbooks_online/bill_line_item/serializer.rb +29 -0
  389. data/lib/ledger_sync/ledgers/quickbooks_online/bill_payment/deserializer.rb +59 -0
  390. data/lib/ledger_sync/{adaptors → ledgers}/quickbooks_online/bill_payment/operations/create.rb +3 -3
  391. data/lib/ledger_sync/{adaptors → ledgers}/quickbooks_online/bill_payment/operations/find.rb +3 -3
  392. data/lib/ledger_sync/{adaptors → ledgers}/quickbooks_online/bill_payment/operations/update.rb +3 -3
  393. data/lib/ledger_sync/ledgers/quickbooks_online/bill_payment/serializer.rb +77 -0
  394. data/lib/ledger_sync/ledgers/quickbooks_online/bill_payment_line_item/deserializer.rb +18 -0
  395. data/lib/ledger_sync/ledgers/quickbooks_online/bill_payment_line_item/serializer.rb +18 -0
  396. data/lib/ledger_sync/{adaptors/quickbooks_online/adaptor.rb → ledgers/quickbooks_online/client.rb} +30 -17
  397. data/lib/ledger_sync/{adaptors → ledgers}/quickbooks_online/config.rb +1 -1
  398. data/lib/ledger_sync/ledgers/quickbooks_online/currency/deserializer.rb +17 -0
  399. data/lib/ledger_sync/ledgers/quickbooks_online/currency/serializer.rb +16 -0
  400. data/lib/ledger_sync/ledgers/quickbooks_online/customer/deserializer.rb +19 -0
  401. data/lib/ledger_sync/ledgers/quickbooks_online/customer/operations/create.rb +26 -0
  402. data/lib/ledger_sync/ledgers/quickbooks_online/customer/operations/find.rb +26 -0
  403. data/lib/ledger_sync/{adaptors → ledgers}/quickbooks_online/customer/operations/update.rb +8 -6
  404. data/lib/ledger_sync/{adaptors → ledgers}/quickbooks_online/customer/searcher.rb +5 -3
  405. data/lib/ledger_sync/ledgers/quickbooks_online/customer/serializer.rb +19 -0
  406. data/lib/ledger_sync/ledgers/quickbooks_online/dashboard_url_helper.rb +34 -0
  407. data/lib/ledger_sync/ledgers/quickbooks_online/department/deserializer.rb +28 -0
  408. data/lib/ledger_sync/{adaptors → ledgers}/quickbooks_online/department/operations/create.rb +5 -3
  409. data/lib/ledger_sync/{adaptors → ledgers}/quickbooks_online/department/operations/find.rb +5 -3
  410. data/lib/ledger_sync/{adaptors → ledgers}/quickbooks_online/department/operations/update.rb +3 -3
  411. data/lib/ledger_sync/{adaptors → ledgers}/quickbooks_online/department/searcher.rb +3 -3
  412. data/lib/ledger_sync/ledgers/quickbooks_online/department/serializer.rb +49 -0
  413. data/lib/ledger_sync/ledgers/quickbooks_online/deposit/deserializer.rb +39 -0
  414. data/lib/ledger_sync/{adaptors → ledgers}/quickbooks_online/deposit/operations/create.rb +5 -3
  415. data/lib/ledger_sync/{adaptors → ledgers}/quickbooks_online/deposit/operations/find.rb +5 -3
  416. data/lib/ledger_sync/{adaptors → ledgers}/quickbooks_online/deposit/operations/update.rb +3 -3
  417. data/lib/ledger_sync/{adaptors/quickbooks_online/expense → ledgers/quickbooks_online/deposit}/searcher.rb +2 -2
  418. data/lib/ledger_sync/ledgers/quickbooks_online/deposit/serializer.rb +39 -0
  419. data/lib/ledger_sync/ledgers/quickbooks_online/deposit_line_item/deserializer.rb +38 -0
  420. data/lib/ledger_sync/ledgers/quickbooks_online/deposit_line_item/serializer.rb +41 -0
  421. data/lib/ledger_sync/ledgers/quickbooks_online/deserializer.rb +100 -0
  422. data/lib/ledger_sync/ledgers/quickbooks_online/expense/deserializer.rb +59 -0
  423. data/lib/ledger_sync/{adaptors → ledgers}/quickbooks_online/expense/operations/create.rb +5 -3
  424. data/lib/ledger_sync/{adaptors → ledgers}/quickbooks_online/expense/operations/find.rb +5 -3
  425. data/lib/ledger_sync/{adaptors → ledgers}/quickbooks_online/expense/operations/update.rb +5 -3
  426. data/lib/ledger_sync/{adaptors/quickbooks_online/deposit → ledgers/quickbooks_online/expense}/searcher.rb +3 -2
  427. data/lib/ledger_sync/ledgers/quickbooks_online/expense/serializer.rb +59 -0
  428. data/lib/ledger_sync/ledgers/quickbooks_online/expense_line_item/deserializer.rb +25 -0
  429. data/lib/ledger_sync/ledgers/quickbooks_online/expense_line_item/serializer.rb +27 -0
  430. data/lib/ledger_sync/ledgers/quickbooks_online/invoice/deserializer.rb +35 -0
  431. data/lib/ledger_sync/{adaptors → ledgers}/quickbooks_online/invoice/operations/create.rb +3 -3
  432. data/lib/ledger_sync/{adaptors → ledgers}/quickbooks_online/invoice/operations/find.rb +5 -3
  433. data/lib/ledger_sync/{adaptors → ledgers}/quickbooks_online/invoice/operations/update.rb +5 -3
  434. data/lib/ledger_sync/ledgers/quickbooks_online/invoice/serializer.rb +35 -0
  435. data/lib/ledger_sync/ledgers/quickbooks_online/invoice_sales_line_item/deserializer.rb +25 -0
  436. data/lib/ledger_sync/ledgers/quickbooks_online/invoice_sales_line_item/serializer.rb +29 -0
  437. data/lib/ledger_sync/{adaptors/quickbooks_online/item/ledger_serializer.rb → ledgers/quickbooks_online/item/deserializer.rb} +3 -3
  438. data/lib/ledger_sync/ledgers/quickbooks_online/item/serializer.rb +12 -0
  439. data/lib/ledger_sync/ledgers/quickbooks_online/journal_entry/deserializer.rb +33 -0
  440. data/lib/ledger_sync/{adaptors → ledgers}/quickbooks_online/journal_entry/operations/create.rb +5 -3
  441. data/lib/ledger_sync/{adaptors → ledgers}/quickbooks_online/journal_entry/operations/find.rb +5 -3
  442. data/lib/ledger_sync/{adaptors → ledgers}/quickbooks_online/journal_entry/operations/update.rb +5 -3
  443. data/lib/ledger_sync/{adaptors → ledgers}/quickbooks_online/journal_entry/searcher.rb +2 -2
  444. data/lib/ledger_sync/ledgers/quickbooks_online/journal_entry/serializer.rb +33 -0
  445. data/lib/ledger_sync/ledgers/quickbooks_online/journal_entry_line_item/deserializer.rb +32 -0
  446. data/lib/ledger_sync/ledgers/quickbooks_online/journal_entry_line_item/serializer.rb +36 -0
  447. data/lib/ledger_sync/ledgers/quickbooks_online/ledger_class/deserializer.rb +28 -0
  448. data/lib/ledger_sync/{adaptors → ledgers}/quickbooks_online/ledger_class/operations/create.rb +5 -3
  449. data/lib/ledger_sync/{adaptors → ledgers}/quickbooks_online/ledger_class/operations/find.rb +5 -3
  450. data/lib/ledger_sync/{adaptors → ledgers}/quickbooks_online/ledger_class/operations/update.rb +3 -3
  451. data/lib/ledger_sync/{adaptors → ledgers}/quickbooks_online/ledger_class/searcher.rb +3 -3
  452. data/lib/ledger_sync/{adaptors/quickbooks_online/ledger_class/ledger_serializer.rb → ledgers/quickbooks_online/ledger_class/serializer.rb} +8 -9
  453. data/lib/ledger_sync/{adaptors → ledgers}/quickbooks_online/oauth_client.rb +1 -1
  454. data/lib/ledger_sync/{adaptors → ledgers}/quickbooks_online/operation.rb +8 -7
  455. data/lib/ledger_sync/{adaptors → ledgers}/quickbooks_online/operation/create.rb +4 -4
  456. data/lib/ledger_sync/{adaptors → ledgers}/quickbooks_online/operation/find.rb +3 -3
  457. data/lib/ledger_sync/{adaptors → ledgers}/quickbooks_online/operation/full_update.rb +11 -12
  458. data/lib/ledger_sync/{adaptors → ledgers}/quickbooks_online/operation/sparse_update.rb +5 -5
  459. data/lib/ledger_sync/ledgers/quickbooks_online/payment/deserializer.rb +48 -0
  460. data/lib/ledger_sync/{adaptors → ledgers}/quickbooks_online/payment/operations/create.rb +3 -3
  461. data/lib/ledger_sync/{adaptors → ledgers}/quickbooks_online/payment/operations/find.rb +5 -3
  462. data/lib/ledger_sync/{adaptors → ledgers}/quickbooks_online/payment/operations/update.rb +5 -3
  463. data/lib/ledger_sync/ledgers/quickbooks_online/payment/serializer.rb +48 -0
  464. data/lib/ledger_sync/ledgers/quickbooks_online/payment_line_item/deserializer.rb +18 -0
  465. data/lib/ledger_sync/ledgers/quickbooks_online/payment_line_item/serializer.rb +18 -0
  466. data/lib/ledger_sync/ledgers/quickbooks_online/preferences/deserializer.rb +43 -0
  467. data/lib/ledger_sync/{adaptors → ledgers}/quickbooks_online/preferences/operations/find.rb +2 -10
  468. data/lib/ledger_sync/ledgers/quickbooks_online/preferences/serializer.rb +43 -0
  469. data/lib/ledger_sync/{adaptors → ledgers}/quickbooks_online/request.rb +13 -13
  470. data/lib/ledger_sync/ledgers/quickbooks_online/resource.rb +10 -0
  471. data/lib/ledger_sync/ledgers/quickbooks_online/resources/account.rb +355 -0
  472. data/lib/ledger_sync/ledgers/quickbooks_online/resources/bill.rb +31 -0
  473. data/lib/ledger_sync/ledgers/quickbooks_online/resources/bill_line_item.rb +21 -0
  474. data/lib/ledger_sync/ledgers/quickbooks_online/resources/bill_payment.rb +42 -0
  475. data/lib/ledger_sync/ledgers/quickbooks_online/resources/bill_payment_line_item.rb +19 -0
  476. data/lib/ledger_sync/ledgers/quickbooks_online/resources/currency.rb +13 -0
  477. data/lib/ledger_sync/ledgers/quickbooks_online/resources/customer.rb +23 -0
  478. data/lib/ledger_sync/ledgers/quickbooks_online/resources/department.rb +16 -0
  479. data/lib/ledger_sync/ledgers/quickbooks_online/resources/deposit.rb +28 -0
  480. data/lib/ledger_sync/ledgers/quickbooks_online/resources/deposit_line_item.rb +25 -0
  481. data/lib/ledger_sync/ledgers/quickbooks_online/resources/expense.rb +40 -0
  482. data/lib/ledger_sync/ledgers/quickbooks_online/resources/expense_line_item.rb +21 -0
  483. data/lib/ledger_sync/ledgers/quickbooks_online/resources/invoice.rb +28 -0
  484. data/lib/ledger_sync/ledgers/quickbooks_online/resources/invoice_sales_line_item.rb +21 -0
  485. data/lib/ledger_sync/ledgers/quickbooks_online/resources/item.rb +11 -0
  486. data/lib/ledger_sync/ledgers/quickbooks_online/resources/journal_entry.rb +24 -0
  487. data/lib/ledger_sync/ledgers/quickbooks_online/resources/journal_entry_line_item.rb +29 -0
  488. data/lib/ledger_sync/ledgers/quickbooks_online/resources/ledger_class.rb +16 -0
  489. data/lib/ledger_sync/ledgers/quickbooks_online/resources/payment.rb +31 -0
  490. data/lib/ledger_sync/ledgers/quickbooks_online/resources/payment_line_item.rb +19 -0
  491. data/lib/ledger_sync/{adaptors → ledgers}/quickbooks_online/resources/preferences.rb +2 -2
  492. data/lib/ledger_sync/ledgers/quickbooks_online/resources/primary_email_addr.rb +11 -0
  493. data/lib/ledger_sync/ledgers/quickbooks_online/resources/primary_phone.rb +11 -0
  494. data/lib/ledger_sync/ledgers/quickbooks_online/resources/subsidiary.rb +12 -0
  495. data/lib/ledger_sync/ledgers/quickbooks_online/resources/transfer.rb +24 -0
  496. data/lib/ledger_sync/ledgers/quickbooks_online/resources/vendor.rb +23 -0
  497. data/lib/ledger_sync/{adaptors → ledgers}/quickbooks_online/searcher.rb +6 -7
  498. data/lib/ledger_sync/ledgers/quickbooks_online/serialization/type/amount_float_to_integer_type.rb +21 -0
  499. data/lib/ledger_sync/ledgers/quickbooks_online/serialization/type/deserialize_transaction_reference_type.rb +30 -0
  500. data/lib/ledger_sync/ledgers/quickbooks_online/serialization/type/integer_to_amount_float_type.rb +21 -0
  501. data/lib/ledger_sync/ledgers/quickbooks_online/serialization/type/serialize_transaction_reference_type.rb +30 -0
  502. data/lib/ledger_sync/ledgers/quickbooks_online/serializer.rb +71 -0
  503. data/lib/ledger_sync/ledgers/quickbooks_online/serialziation/type/mapping_type.rb +25 -0
  504. data/lib/ledger_sync/ledgers/quickbooks_online/transfer/deserializer.rb +34 -0
  505. data/lib/ledger_sync/{adaptors → ledgers}/quickbooks_online/transfer/operations/create.rb +5 -3
  506. data/lib/ledger_sync/{adaptors → ledgers}/quickbooks_online/transfer/operations/find.rb +5 -3
  507. data/lib/ledger_sync/{adaptors → ledgers}/quickbooks_online/transfer/operations/update.rb +3 -3
  508. data/lib/ledger_sync/ledgers/quickbooks_online/transfer/serializer.rb +34 -0
  509. data/lib/ledger_sync/{adaptors → ledgers}/quickbooks_online/util/error_matcher.rb +11 -8
  510. data/lib/ledger_sync/{adaptors → ledgers}/quickbooks_online/util/error_parser.rb +3 -3
  511. data/lib/ledger_sync/{adaptors/quickbooks_online/util/adaptor_error_parser.rb → ledgers/quickbooks_online/util/ledger_error_parser.rb} +19 -19
  512. data/lib/ledger_sync/{adaptors → ledgers}/quickbooks_online/util/operation_error_parser.rb +9 -9
  513. data/lib/ledger_sync/ledgers/quickbooks_online/vendor/deserializer.rb +25 -0
  514. data/lib/ledger_sync/{adaptors → ledgers}/quickbooks_online/vendor/operations/create.rb +3 -3
  515. data/lib/ledger_sync/{adaptors → ledgers}/quickbooks_online/vendor/operations/find.rb +4 -4
  516. data/lib/ledger_sync/{adaptors → ledgers}/quickbooks_online/vendor/operations/update.rb +3 -3
  517. data/lib/ledger_sync/{adaptors → ledgers}/quickbooks_online/vendor/searcher.rb +2 -2
  518. data/lib/ledger_sync/{adaptors/quickbooks_online/vendor/ledger_serializer.rb → ledgers/quickbooks_online/vendor/serializer.rb} +7 -7
  519. data/lib/ledger_sync/{adaptors → ledgers}/quickbooks_online/webhook.rb +1 -1
  520. data/lib/ledger_sync/{adaptors → ledgers}/quickbooks_online/webhook_event.rb +12 -10
  521. data/lib/ledger_sync/{adaptors → ledgers}/quickbooks_online/webhook_notification.rb +5 -4
  522. data/lib/ledger_sync/{adaptors → ledgers}/request.rb +11 -7
  523. data/lib/ledger_sync/{adaptors → ledgers}/response.rb +4 -2
  524. data/lib/ledger_sync/{adaptors → ledgers}/searcher.rb +11 -10
  525. data/lib/ledger_sync/ledgers/stripe/client.rb +37 -0
  526. data/lib/ledger_sync/{adaptors → ledgers}/stripe/config.rb +1 -1
  527. data/lib/ledger_sync/{adaptors → ledgers}/stripe/customer/operations/create.rb +3 -3
  528. data/lib/ledger_sync/{adaptors → ledgers}/stripe/customer/operations/delete.rb +3 -3
  529. data/lib/ledger_sync/{adaptors → ledgers}/stripe/customer/operations/find.rb +3 -3
  530. data/lib/ledger_sync/{adaptors → ledgers}/stripe/customer/operations/update.rb +3 -3
  531. data/lib/ledger_sync/ledgers/stripe/dashboard_url_helper.rb +21 -0
  532. data/lib/ledger_sync/{adaptors → ledgers}/stripe/operation.rb +5 -5
  533. data/lib/ledger_sync/{adaptors → ledgers}/stripe/operation/create.rb +2 -4
  534. data/lib/ledger_sync/{adaptors → ledgers}/stripe/operation/delete.rb +2 -4
  535. data/lib/ledger_sync/{adaptors → ledgers}/stripe/operation/find.rb +2 -2
  536. data/lib/ledger_sync/{adaptors → ledgers}/stripe/operation/update.rb +2 -4
  537. data/lib/ledger_sync/ledgers/stripe/resource.rb +10 -0
  538. data/lib/ledger_sync/ledgers/stripe/resources/customer.rb +13 -0
  539. data/lib/ledger_sync/operation.rb +23 -0
  540. data/lib/ledger_sync/resource.rb +24 -10
  541. data/lib/ledger_sync/resource_adaptor.rb +52 -0
  542. data/lib/ledger_sync/resource_attribute.rb +31 -9
  543. data/lib/ledger_sync/resource_attribute/dirty_mixin.rb +5 -1
  544. data/lib/ledger_sync/resource_attribute/mixin.rb +17 -27
  545. data/lib/ledger_sync/resource_attribute/reference/many.rb +21 -23
  546. data/lib/ledger_sync/resource_attribute/reference/one.rb +16 -5
  547. data/lib/ledger_sync/resource_attribute_set.rb +4 -8
  548. data/lib/ledger_sync/result.rb +9 -14
  549. data/lib/ledger_sync/serialization/attribute.rb +41 -0
  550. data/lib/ledger_sync/serialization/attribute_set_mixin.rb +27 -0
  551. data/lib/ledger_sync/serialization/deserializer_attribute.rb +82 -0
  552. data/lib/ledger_sync/serialization/deserializer_attribute_set.rb +22 -0
  553. data/lib/ledger_sync/serialization/mixin.rb +70 -0
  554. data/lib/ledger_sync/serialization/serializer_attribute.rb +64 -0
  555. data/lib/ledger_sync/serialization/serializer_attribute_set.rb +22 -0
  556. data/lib/ledger_sync/serialization/type/deserializer_references_many_type.rb +26 -0
  557. data/lib/ledger_sync/serialization/type/deserializer_references_one_type.rb +12 -0
  558. data/lib/ledger_sync/serialization/type/deserializer_type.rb +29 -0
  559. data/lib/ledger_sync/serialization/type/format_date_type.rb +23 -0
  560. data/lib/ledger_sync/serialization/type/mapping_type.rb +23 -0
  561. data/lib/ledger_sync/serialization/type/parse_date_type.rb +23 -0
  562. data/lib/ledger_sync/serialization/type/serializer_references_many_type.rb +21 -0
  563. data/lib/ledger_sync/serialization/type/serializer_references_one_type.rb +12 -0
  564. data/lib/ledger_sync/serialization/type/serializer_type.rb +23 -0
  565. data/lib/ledger_sync/serializer.rb +97 -0
  566. data/lib/ledger_sync/type/boolean.rb +2 -0
  567. data/lib/ledger_sync/type/date.rb +3 -1
  568. data/lib/ledger_sync/type/float.rb +2 -0
  569. data/lib/ledger_sync/type/hash.rb +6 -2
  570. data/lib/ledger_sync/type/id.rb +8 -2
  571. data/lib/ledger_sync/type/integer.rb +2 -0
  572. data/lib/ledger_sync/type/reference_many.rb +15 -5
  573. data/lib/ledger_sync/type/reference_one.rb +8 -17
  574. data/lib/ledger_sync/type/string.rb +2 -0
  575. data/lib/ledger_sync/type/string_from_set.rb +43 -0
  576. data/lib/ledger_sync/type/value_mixin.rb +37 -7
  577. data/lib/ledger_sync/util/hash_helpers.rb +12 -2
  578. data/lib/ledger_sync/util/mixins/delegate_iterable_methods_mixin.rb +44 -0
  579. data/lib/ledger_sync/util/mixins/dupable_mixin.rb +13 -0
  580. data/lib/ledger_sync/util/mixins/resource_registerable_mixin.rb +29 -0
  581. data/lib/ledger_sync/util/read_only_object.rb +1 -1
  582. data/lib/ledger_sync/util/resource_converter.rb +117 -0
  583. data/lib/ledger_sync/util/resource_converter/attribute.rb +133 -0
  584. data/lib/ledger_sync/util/resource_converter/attribute_set.rb +43 -0
  585. data/lib/ledger_sync/util/resource_converter/type/references_many_type.rb +27 -0
  586. data/lib/ledger_sync/util/resource_converter/type/references_one_type.rb +14 -0
  587. data/lib/ledger_sync/util/resource_converter/type/resource_converter_type.rb +26 -0
  588. data/lib/ledger_sync/util/resources_builder.rb +24 -16
  589. data/lib/ledger_sync/util/string_helpers.rb +3 -3
  590. data/lib/ledger_sync/util/url_helpers.rb +38 -0
  591. data/lib/ledger_sync/util/validator.rb +3 -1
  592. data/lib/ledger_sync/version.rb +3 -1
  593. data/licenses/BSL.txt +97 -0
  594. data/licenses/documentation_site.txt +7 -0
  595. metadata +626 -220
  596. data/_config.yml +0 -1
  597. data/lib/ledger_sync/adaptor_configuration_store.rb +0 -56
  598. data/lib/ledger_sync/adaptors/ledger_serializer.rb +0 -143
  599. data/lib/ledger_sync/adaptors/ledger_serializer_attribute.rb +0 -178
  600. data/lib/ledger_sync/adaptors/ledger_serializer_attribute_set.rb +0 -58
  601. data/lib/ledger_sync/adaptors/ledger_serializer_type/mapping_type.rb +0 -41
  602. data/lib/ledger_sync/adaptors/ledger_serializer_type/references_many_type.rb +0 -24
  603. data/lib/ledger_sync/adaptors/ledger_serializer_type/references_one_type.rb +0 -22
  604. data/lib/ledger_sync/adaptors/ledger_serializer_type/value_type.rb +0 -17
  605. data/lib/ledger_sync/adaptors/mixins/infer_adaptor_class_mixin.rb +0 -24
  606. data/lib/ledger_sync/adaptors/mixins/infer_ledger_serializer_mixin.rb +0 -45
  607. data/lib/ledger_sync/adaptors/netsuite/account/ledger_deserializer.rb +0 -24
  608. data/lib/ledger_sync/adaptors/netsuite/account/ledger_serializer.rb +0 -22
  609. data/lib/ledger_sync/adaptors/netsuite/config.rb +0 -5
  610. data/lib/ledger_sync/adaptors/netsuite/currency/deledger_serializer.rb +0 -28
  611. data/lib/ledger_sync/adaptors/netsuite/currency/ledger_serializer.rb +0 -25
  612. data/lib/ledger_sync/adaptors/netsuite/customer/ledger_deserializer.rb +0 -27
  613. data/lib/ledger_sync/adaptors/netsuite/customer/ledger_serializer.rb +0 -38
  614. data/lib/ledger_sync/adaptors/netsuite/department/ledger_serializer.rb +0 -17
  615. data/lib/ledger_sync/adaptors/netsuite/ledger_serializer.rb +0 -30
  616. data/lib/ledger_sync/adaptors/netsuite/ledger_serializer_type/reference_type.rb +0 -24
  617. data/lib/ledger_sync/adaptors/netsuite/ledger_serializer_type/subsidiary_type.rb +0 -22
  618. data/lib/ledger_sync/adaptors/netsuite/operation.rb +0 -19
  619. data/lib/ledger_sync/adaptors/netsuite/searcher.rb +0 -36
  620. data/lib/ledger_sync/adaptors/netsuite/vendor/ledger_deserializer.rb +0 -32
  621. data/lib/ledger_sync/adaptors/netsuite/vendor/ledger_serializer.rb +0 -35
  622. data/lib/ledger_sync/adaptors/netsuite_soap/config.rb +0 -5
  623. data/lib/ledger_sync/adaptors/netsuite_soap/customer/ledger_serializer.rb +0 -13
  624. data/lib/ledger_sync/adaptors/netsuite_soap/ledger_serializer.rb +0 -25
  625. data/lib/ledger_sync/adaptors/quickbooks_online/account/ledger_serializer.rb +0 -37
  626. data/lib/ledger_sync/adaptors/quickbooks_online/bill/ledger_serializer.rb +0 -46
  627. data/lib/ledger_sync/adaptors/quickbooks_online/bill_line_item/ledger_serializer.rb +0 -30
  628. data/lib/ledger_sync/adaptors/quickbooks_online/bill_payment/ledger_serializer.rb +0 -76
  629. data/lib/ledger_sync/adaptors/quickbooks_online/bill_payment_line_item/ledger_serializer.rb +0 -19
  630. data/lib/ledger_sync/adaptors/quickbooks_online/currency/ledger_serializer.rb +0 -17
  631. data/lib/ledger_sync/adaptors/quickbooks_online/customer/ledger_serializer.rb +0 -23
  632. data/lib/ledger_sync/adaptors/quickbooks_online/customer/operations/create.rb +0 -22
  633. data/lib/ledger_sync/adaptors/quickbooks_online/customer/operations/find.rb +0 -22
  634. data/lib/ledger_sync/adaptors/quickbooks_online/dashboard_url_helper.rb +0 -59
  635. data/lib/ledger_sync/adaptors/quickbooks_online/department/ledger_serializer.rb +0 -38
  636. data/lib/ledger_sync/adaptors/quickbooks_online/deposit/ledger_serializer.rb +0 -40
  637. data/lib/ledger_sync/adaptors/quickbooks_online/deposit_line_item/ledger_serializer.rb +0 -34
  638. data/lib/ledger_sync/adaptors/quickbooks_online/expense/ledger_serializer.rb +0 -52
  639. data/lib/ledger_sync/adaptors/quickbooks_online/expense_line_item/ledger_serializer.rb +0 -30
  640. data/lib/ledger_sync/adaptors/quickbooks_online/invoice/ledger_serializer.rb +0 -36
  641. data/lib/ledger_sync/adaptors/quickbooks_online/invoice_sales_line_item/ledger_serializer.rb +0 -30
  642. data/lib/ledger_sync/adaptors/quickbooks_online/journal_entry/ledger_serializer.rb +0 -34
  643. data/lib/ledger_sync/adaptors/quickbooks_online/journal_entry_line_item/ledger_serializer.rb +0 -37
  644. data/lib/ledger_sync/adaptors/quickbooks_online/ledger_serializer.rb +0 -131
  645. data/lib/ledger_sync/adaptors/quickbooks_online/ledger_serializer_type/account_sub_type.rb +0 -305
  646. data/lib/ledger_sync/adaptors/quickbooks_online/ledger_serializer_type/account_type.rb +0 -51
  647. data/lib/ledger_sync/adaptors/quickbooks_online/ledger_serializer_type/amount_type.rb +0 -23
  648. data/lib/ledger_sync/adaptors/quickbooks_online/ledger_serializer_type/classification_type.rb +0 -23
  649. data/lib/ledger_sync/adaptors/quickbooks_online/ledger_serializer_type/date_type.rb +0 -23
  650. data/lib/ledger_sync/adaptors/quickbooks_online/ledger_serializer_type/entity_reference_type.rb +0 -49
  651. data/lib/ledger_sync/adaptors/quickbooks_online/ledger_serializer_type/journal_entry_line_item_type.rb +0 -20
  652. data/lib/ledger_sync/adaptors/quickbooks_online/ledger_serializer_type/payment_type.rb +0 -21
  653. data/lib/ledger_sync/adaptors/quickbooks_online/ledger_serializer_type/transaction_reference_type.rb +0 -49
  654. data/lib/ledger_sync/adaptors/quickbooks_online/payment/ledger_serializer.rb +0 -50
  655. data/lib/ledger_sync/adaptors/quickbooks_online/payment_line_item/ledger_serializer.rb +0 -19
  656. data/lib/ledger_sync/adaptors/quickbooks_online/preferences/ledger_serializer.rb +0 -45
  657. data/lib/ledger_sync/adaptors/quickbooks_online/transfer/ledger_serializer.rb +0 -36
  658. data/lib/ledger_sync/adaptors/stripe/adaptor.rb +0 -45
  659. data/lib/ledger_sync/adaptors/test/customer/ledger_serializer.rb +0 -12
  660. data/lib/ledger_sync/adaptors/test/ledger_serializer.rb +0 -12
  661. data/lib/ledger_sync/resources/account.rb +0 -17
  662. data/lib/ledger_sync/resources/bill.rb +0 -27
  663. data/lib/ledger_sync/resources/bill_line_item.rb +0 -17
  664. data/lib/ledger_sync/resources/bill_payment.rb +0 -32
  665. data/lib/ledger_sync/resources/bill_payment_line_item.rb +0 -15
  666. data/lib/ledger_sync/resources/currency.rb +0 -9
  667. data/lib/ledger_sync/resources/customer.rb +0 -25
  668. data/lib/ledger_sync/resources/department.rb +0 -14
  669. data/lib/ledger_sync/resources/deposit.rb +0 -24
  670. data/lib/ledger_sync/resources/deposit_line_item.rb +0 -22
  671. data/lib/ledger_sync/resources/expense.rb +0 -33
  672. data/lib/ledger_sync/resources/expense_line_item.rb +0 -17
  673. data/lib/ledger_sync/resources/invoice.rb +0 -24
  674. data/lib/ledger_sync/resources/invoice_sales_line_item.rb +0 -17
  675. data/lib/ledger_sync/resources/item.rb +0 -5
  676. data/lib/ledger_sync/resources/journal_entry.rb +0 -20
  677. data/lib/ledger_sync/resources/journal_entry_line_item.rb +0 -20
  678. data/lib/ledger_sync/resources/ledger_class.rb +0 -14
  679. data/lib/ledger_sync/resources/payment.rb +0 -27
  680. data/lib/ledger_sync/resources/payment_line_item.rb +0 -15
  681. data/lib/ledger_sync/resources/subsidiary.rb +0 -8
  682. data/lib/ledger_sync/resources/transfer.rb +0 -20
  683. data/lib/ledger_sync/resources/vendor.rb +0 -19
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3a9ac9abd02e87286bdff439fc491e286bb1d4d175f109f892061e7485cec2fd
4
- data.tar.gz: ef25734c3e806d530e9b50b9cec78bc93de4c11ec87dc8c9be5f004650113487
3
+ metadata.gz: fd6a2c51848e4e1e51a7c0870956a23b7e6d81c6eff754554340fd48d350a6a9
4
+ data.tar.gz: d632009d62b0f7cfa59edceee5d9e2df57caa27a437197dc324e978dfc71d44c
5
5
  SHA512:
6
- metadata.gz: 34d67c0a951e721b66b61fd686cdb9258d11aa7270a61fe32e5aa2c0d66a1b614643b0f14d99c8c5d49f19a631cddc742b9afb3ad5035be164d903d77a3b727b
7
- data.tar.gz: e21b60479be3bd1ed92ff65907b250e6286b0d37c9dc44ff2d3300d0aefdb6fe47d4d20359366a1be9133cb08fe3d6d2b1ee363c3c5eb2f5a44499a82827406f
6
+ metadata.gz: 8b09d33912d3bd337a3d84cf05093193dc1a80b1bdc3137f903131d386bb5a38355da76856b72cb55cfa2cdd190ef98c88ba87aeb62b5851beae05bc7aeb1fb9
7
+ data.tar.gz: bdc088c4b18661ee9ead64d5877c1e4104a1d9a6f1d39aec8e7d24cfd45f35ca00c3953783f2bfec22f62a7d56cc6cebf8a9e50f09596c272274b61e149cecf1
data/.gitignore CHANGED
@@ -10,11 +10,20 @@
10
10
  # rspec failure tracking
11
11
  .rspec_status
12
12
 
13
+ ### Jekyll ###
14
+ _site/
15
+ .sass-cache/
16
+ .jekyll-cache/
17
+ .jekyll-metadata
18
+
19
+ # byebug
13
20
  .byebug_history
14
- .qa_config.yml
15
21
 
22
+ # Mac
16
23
  .DS_Store
17
24
 
25
+ # dotenv
18
26
  .env
19
27
 
20
- .tool-versions
28
+ .tool-versions
29
+ .ruby-version
@@ -0,0 +1,30 @@
1
+ # Use this file to configure the Overcommit hooks you wish to use. This will
2
+ # extend the default configuration defined in:
3
+ # https://github.com/sds/overcommit/blob/master/config/default.yml
4
+ #
5
+ # At the topmost level of this YAML file is a key representing type of hook
6
+ # being run (e.g. pre-commit, commit-msg, etc.). Within each type you can
7
+ # customize each hook, such as whether to only run it on certain files (via
8
+ # `include`), whether to only display output if it fails (via `quiet`), etc.
9
+ #
10
+ # For a complete list of hooks, see:
11
+ # https://github.com/sds/overcommit/tree/master/lib/overcommit/hook
12
+ #
13
+ # For a complete list of options that you can use to customize hooks, see:
14
+ # https://github.com/sds/overcommit#configuration
15
+ #
16
+ # Uncomment the following lines to make the configuration take effect.
17
+ gemfile: Gemfile
18
+
19
+ PreCommit:
20
+ ALL:
21
+ exclude:
22
+ - 'documentation/site/assets/webfonts/**/*.svg'
23
+
24
+ RuboCop:
25
+ command: ['bundle', 'exec', 'rubocop']
26
+ enabled: true
27
+ on_warn: fail # Treat all warnings as failures
28
+
29
+ TrailingWhitespace:
30
+ enabled: true
@@ -1,4 +1,17 @@
1
1
  inherit_from: .rubocop_todo.yml
2
2
 
3
3
  AllCops:
4
- TargetRubyVersion: 2.6
4
+ TargetRubyVersion: 2.6
5
+
6
+ Layout/LineLength:
7
+ Enabled: True
8
+ Max: 120
9
+
10
+ Style/HashEachMethods:
11
+ Enabled: True
12
+
13
+ Style/HashTransformKeys:
14
+ Enabled: True
15
+
16
+ Style/HashTransformValues:
17
+ Enabled: True
@@ -1,9 +1,19 @@
1
1
  ---
2
- sudo: false
3
2
  language: ruby
4
3
  cache: bundler
5
4
  rvm:
6
- - 2.5.1
5
+ - 2.5.8
6
+ - 2.6.6
7
+ - 2.6.3
8
+ - 2.7.1
9
+ - ruby-head
7
10
  before_install:
8
11
  - gem update --system
9
12
  - gem install bundler:1.17.3
13
+ - gem install overcommit
14
+ script:
15
+ - bundle exec rspec --order rand
16
+ - overcommit --sign && overcommit --run
17
+ jobs:
18
+ allow_failures:
19
+ - rvm: ruby-head
data/Dockerfile CHANGED
@@ -1,8 +1,8 @@
1
- FROM ruby:2.5.1
1
+ FROM ruby:2.6.6
2
2
 
3
3
  WORKDIR /lib
4
4
 
5
5
  COPY . .
6
6
  RUN bundle install
7
7
 
8
- CMD ["bundle", "exec", "rspec"]
8
+ CMD ["bundle", "exec", "rspec", "--order rand"]
data/Gemfile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'https://rubygems.org'
2
4
 
3
5
  git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ledger_sync (1.3.4)
4
+ ledger_sync (1.4.4)
5
5
  activemodel
6
6
  colorize
7
7
  coveralls
@@ -17,20 +17,20 @@ PATH
17
17
  oauth2
18
18
  pd_ruby
19
19
  resonad
20
- simply_serializable (>= 1.3.0)
20
+ simply_serializable (>= 1.5.1)
21
21
  stripe
22
22
 
23
23
  GEM
24
24
  remote: https://rubygems.org/
25
25
  specs:
26
- activemodel (6.0.2.1)
27
- activesupport (= 6.0.2.1)
28
- activesupport (6.0.2.1)
26
+ activemodel (6.0.3.1)
27
+ activesupport (= 6.0.3.1)
28
+ activesupport (6.0.3.1)
29
29
  concurrent-ruby (~> 1.0, >= 1.0.2)
30
30
  i18n (>= 0.7, < 2)
31
31
  minitest (~> 5.1)
32
32
  tzinfo (~> 1.1)
33
- zeitwerk (~> 2.2)
33
+ zeitwerk (~> 2.2, >= 2.2.2)
34
34
  addressable (2.7.0)
35
35
  public_suffix (>= 2.0.2, < 5.0)
36
36
  akami (1.3.1)
@@ -40,7 +40,9 @@ GEM
40
40
  awesome_print (1.8.0)
41
41
  builder (3.2.4)
42
42
  bump (0.9.0)
43
- byebug (11.1.1)
43
+ byebug (11.1.3)
44
+ childprocess (3.0.0)
45
+ colorator (1.1.0)
44
46
  colorize (0.8.1)
45
47
  concurrent-ruby (1.1.6)
46
48
  coveralls (0.8.23)
@@ -54,7 +56,7 @@ GEM
54
56
  diff-lcs (1.3)
55
57
  docile (1.3.2)
56
58
  dotenv (2.7.5)
57
- dry-configurable (0.11.3)
59
+ dry-configurable (0.11.5)
58
60
  concurrent-ruby (~> 1.0)
59
61
  dry-core (~> 0.4, >= 0.4.7)
60
62
  dry-equalizer (~> 0.2)
@@ -70,14 +72,14 @@ GEM
70
72
  concurrent-ruby (~> 1.0)
71
73
  dry-core (~> 0.2)
72
74
  dry-equalizer (~> 0.2)
73
- dry-schema (1.4.3)
75
+ dry-schema (1.5.1)
74
76
  concurrent-ruby (~> 1.0)
75
77
  dry-configurable (~> 0.8, >= 0.8.3)
76
78
  dry-core (~> 0.4)
77
79
  dry-equalizer (~> 0.2)
78
80
  dry-initializer (~> 3.0)
79
81
  dry-logic (~> 1.0)
80
- dry-types (~> 1.2)
82
+ dry-types (~> 1.4)
81
83
  dry-types (1.4.0)
82
84
  concurrent-ruby (~> 1.0)
83
85
  dry-container (~> 0.3)
@@ -85,36 +87,71 @@ GEM
85
87
  dry-equalizer (~> 0.3)
86
88
  dry-inflector (~> 0.1, >= 0.1.2)
87
89
  dry-logic (~> 1.0, >= 1.0.2)
88
- dry-validation (1.4.2)
90
+ dry-validation (1.5.1)
89
91
  concurrent-ruby (~> 1.0)
90
92
  dry-container (~> 0.7, >= 0.7.1)
91
93
  dry-core (~> 0.4)
92
94
  dry-equalizer (~> 0.2)
93
95
  dry-initializer (~> 3.0)
94
- dry-schema (~> 1.4, >= 1.4.3)
95
- factory_bot (5.1.1)
96
- activesupport (>= 4.2.0)
97
- faraday (0.17.3)
96
+ dry-schema (~> 1.5)
97
+ em-websocket (0.5.1)
98
+ eventmachine (>= 0.12.9)
99
+ http_parser.rb (~> 0.6.0)
100
+ eventmachine (1.2.7)
101
+ factory_bot (6.0.1)
102
+ activesupport (>= 5.0.0)
103
+ faraday (1.0.1)
98
104
  multipart-post (>= 1.2, < 3)
99
105
  faraday-detailed_logger (2.3.0)
100
106
  faraday (>= 0.8, < 2)
101
- faraday_middleware (0.14.0)
102
- faraday (>= 0.7.4, < 1.0)
107
+ faraday_middleware (1.0.0)
108
+ faraday (~> 1.0)
109
+ ffi (1.13.0)
103
110
  fingerprintable (1.2.1)
104
111
  colorize
112
+ forwardable-extended (2.6.0)
105
113
  gyoku (1.3.1)
106
114
  builder (>= 2.1.2)
107
115
  hashdiff (1.0.1)
116
+ http_parser.rb (0.6.0)
108
117
  httpi (2.4.4)
109
118
  rack
110
119
  socksify
111
- i18n (1.8.2)
120
+ i18n (0.9.5)
112
121
  concurrent-ruby (~> 1.0)
113
- jaro_winkler (1.5.4)
122
+ iniparse (1.5.0)
123
+ jekyll (3.8.7)
124
+ addressable (~> 2.4)
125
+ colorator (~> 1.0)
126
+ em-websocket (~> 0.5)
127
+ i18n (~> 0.7)
128
+ jekyll-sass-converter (~> 1.0)
129
+ jekyll-watch (~> 2.0)
130
+ kramdown (~> 1.14)
131
+ liquid (~> 4.0)
132
+ mercenary (~> 0.3.3)
133
+ pathutil (~> 0.9)
134
+ rouge (>= 1.7, < 4)
135
+ safe_yaml (~> 1.0)
136
+ jekyll-menus (0.6.1)
137
+ jekyll (>= 3.6, < 5.0)
138
+ jekyll-paginate (1.1.0)
139
+ jekyll-paginate-v2 (1.9.4)
140
+ jekyll (~> 3.0)
141
+ jekyll-sass-converter (1.5.2)
142
+ sass (~> 3.4)
143
+ jekyll-watch (2.2.1)
144
+ listen (~> 3.0)
114
145
  json (2.3.0)
115
146
  jwt (2.2.1)
147
+ kramdown (1.17.0)
148
+ liquid (4.0.3)
149
+ listen (3.2.1)
150
+ rb-fsevent (~> 0.10, >= 0.10.3)
151
+ rb-inotify (~> 0.9, >= 0.9.10)
152
+ mercenary (0.3.6)
116
153
  mini_portile2 (2.4.0)
117
- minitest (5.14.0)
154
+ minitest (5.14.1)
118
155
  multi_json (1.14.1)
119
156
  multi_xml (0.6.0)
120
157
  multipart-post (2.1.1)
@@ -129,40 +166,58 @@ GEM
129
166
  multi_json (~> 1.3)
130
167
  multi_xml (~> 0.5)
131
168
  rack (>= 1.2, < 3)
169
+ overcommit (0.53.0)
170
+ childprocess (>= 0.6.3, < 4)
171
+ iniparse (~> 1.4)
132
172
  parallel (1.19.1)
133
- parser (2.7.0.3)
173
+ parser (2.7.1.3)
134
174
  ast (~> 2.4.0)
135
- pd_ruby (0.2.0)
175
+ pathutil (0.16.2)
176
+ forwardable-extended (~> 2.6)
177
+ pd_ruby (0.2.3)
136
178
  colorize
137
- public_suffix (4.0.3)
138
- rack (2.2.2)
179
+ public_suffix (4.0.5)
180
+ rack (2.2.3)
139
181
  rainbow (3.0.0)
140
182
  rake (13.0.1)
183
+ rb-fsevent (0.10.4)
184
+ rb-inotify (0.10.1)
185
+ ffi (~> 1.0)
186
+ regexp_parser (1.7.1)
141
187
  resonad (1.2.0)
142
188
  rexml (3.2.4)
189
+ rouge (3.19.0)
143
190
  rspec (3.9.0)
144
191
  rspec-core (~> 3.9.0)
145
192
  rspec-expectations (~> 3.9.0)
146
193
  rspec-mocks (~> 3.9.0)
147
- rspec-core (3.9.1)
148
- rspec-support (~> 3.9.1)
149
- rspec-expectations (3.9.0)
194
+ rspec-core (3.9.2)
195
+ rspec-support (~> 3.9.3)
196
+ rspec-expectations (3.9.2)
150
197
  diff-lcs (>= 1.2.0, < 2.0)
151
198
  rspec-support (~> 3.9.0)
152
199
  rspec-mocks (3.9.1)
153
200
  diff-lcs (>= 1.2.0, < 2.0)
154
201
  rspec-support (~> 3.9.0)
155
- rspec-support (3.9.2)
156
- rubocop (0.80.0)
157
- jaro_winkler (~> 1.5.1)
202
+ rspec-support (3.9.3)
203
+ rubocop (0.85.1)
158
204
  parallel (~> 1.10)
159
205
  parser (>= 2.7.0.1)
160
206
  rainbow (>= 2.2.2, < 4.0)
207
+ regexp_parser (>= 1.7)
161
208
  rexml
209
+ rubocop-ast (>= 0.0.3)
162
210
  ruby-progressbar (~> 1.7)
163
- unicode-display_width (>= 1.4.0, < 1.7)
211
+ unicode-display_width (>= 1.4.0, < 2.0)
212
+ rubocop-ast (0.0.3)
213
+ parser (>= 2.7.0.1)
164
214
  ruby-progressbar (1.10.1)
165
215
  safe_yaml (1.0.5)
216
+ sass (3.7.4)
217
+ sass-listen (~> 4.0.0)
218
+ sass-listen (4.0.0)
219
+ rb-fsevent (~> 0.9, >= 0.9.4)
220
+ rb-inotify (~> 0.9, >= 0.9.7)
166
221
  savon (2.12.0)
167
222
  akami (~> 1.2)
168
223
  builder (>= 2.1.2)
@@ -176,29 +231,29 @@ GEM
176
231
  json (>= 1.8, < 3)
177
232
  simplecov-html (~> 0.10.0)
178
233
  simplecov-html (0.10.2)
179
- simply_serializable (1.4.2)
234
+ simply_serializable (1.5.1)
180
235
  fingerprintable (>= 1.2.1)
181
236
  socksify (1.7.1)
182
- stripe (5.17.0)
237
+ stripe (5.22.0)
183
238
  sync (0.5.0)
184
239
  term-ansicolor (1.7.1)
185
240
  tins (~> 1.0)
186
241
  thor (1.0.1)
187
242
  thread_safe (0.3.6)
188
- tins (1.24.1)
243
+ tins (1.25.0)
189
244
  sync
190
- tzinfo (1.2.6)
245
+ tzinfo (1.2.7)
191
246
  thread_safe (~> 0.1)
192
- unicode-display_width (1.6.1)
193
- vcr (5.1.0)
247
+ unicode-display_width (1.7.0)
248
+ vcr (6.0.0)
194
249
  wasabi (3.5.0)
195
250
  httpi (~> 2.0)
196
251
  nokogiri (>= 1.4.2)
197
- webmock (3.8.2)
252
+ webmock (3.8.3)
198
253
  addressable (>= 2.3.6)
199
254
  crack (>= 0.3.2)
200
255
  hashdiff (>= 0.4.0, < 2.0.0)
201
- zeitwerk (2.2.2)
256
+ zeitwerk (2.3.0)
202
257
 
203
258
  PLATFORMS
204
259
  ruby
@@ -209,7 +264,12 @@ DEPENDENCIES
209
264
  bundler (~> 1.16)
210
265
  byebug
211
266
  factory_bot
267
+ jekyll (~> 3.8.4)
268
+ jekyll-menus (~> 0.6.0)
269
+ jekyll-paginate (~> 1.1)
270
+ jekyll-paginate-v2 (~> 1.9)
212
271
  ledger_sync!
272
+ overcommit
213
273
  rake (~> 13.0)
214
274
  rspec (~> 3.2)
215
275
  rubocop
@@ -1,21 +1,5 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2019 Ryan Jackson
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in
13
- all copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- THE SOFTWARE.
1
+ Source code in this repository is variously licensed under the Business Source
2
+ License 1.1 (BSL) and other licenses. A copy of each license can be found in the licenses
3
+ directory or the relative directories. Source code in a given file is licensed under the BSL and the
4
+ copyright belongs to Modern Treasury Inc. unless otherwise noted at the
5
+ beginning of the file or in a specific license file.
data/README.md CHANGED
@@ -4,503 +4,23 @@
4
4
  [![Gem Version](https://badge.fury.io/rb/ledger_sync.svg)](https://badge.fury.io/rb/ledger_sync)
5
5
  [![Coverage Status](https://coveralls.io/repos/github/LedgerSync/ledger_sync/badge.svg?branch=master)](https://coveralls.io/github/LedgerSync/ledger_sync?branch=master)
6
6
 
7
- ## Installation
7
+ ## Join the Conversation
8
8
 
9
- Add this line to your application's Gemfile:
9
+ [Click here](https://join.slack.com/t/ledger-sync/shared_invite/zt-e5nbl8qc-eOA~5k7bg3p16_l3J7OS~Q) to join our public Slack group.
10
10
 
11
- ```ruby
12
- gem 'ledger_sync'
13
- ```
11
+ ## Documentation
14
12
 
15
- And then execute:
13
+ The most up-to-date documentation can be found at [www.ledgersync.dev](http://www.ledgersync.dev)
16
14
 
17
- ```bash
18
- $ bundle
19
- ```
15
+ ## License
20
16
 
21
- Or install it yourself as:
17
+ The gem is available as open source under the terms of the licenses detailed in `LICENSE.txt`.
22
18
 
23
- ```bash
24
- $ gem install ledger_sync
25
- ```
26
-
27
- ## Usage
28
-
29
- To use LedgerSync, you must create an `Operation`. The operation will be ledger-specific and will require the following:
30
-
31
- 1. Adaptor
32
- 2. Resource(s)
33
-
34
- The code may look like the following:
35
-
36
- ```ruby
37
- # First we create an adaptor, which is our connection to a ledger.
38
- # Each ledger may require different keys, so check the
39
- # documentation below for specifics.
40
- adaptor = LedgerSync::Adaptors::QuickBooksOnline::Adaptor.new(
41
- access_token: access_token, # assuming this is defined
42
- client_id: ENV['QUICKBOOKS_ONLINE_CLIENT_ID'],
43
- client_secret: ENV['QUICKBOOKS_ONLINE_CLIENT_SECRET'],
44
- realm_id: ENV['QUICKBOOKS_ONLINE_REALM_ID'],
45
- refresh_token: refresh_token, # assuming this is defined
46
- )
47
-
48
- # Create a resource on which to operate. Some resources have
49
- # relationships with other resources. You can use
50
- # `Util::ResourcesBuilder` to create resources and relationships from
51
- # a structured hash.
52
- resource = LedgerSync::Customer.new(
53
- name: 'Sample Customer',
54
- email: 'test@example.com'
55
- )
56
-
57
- # Create the operation we want to perform.
58
- operation = LedgerSync::Adaptors::QuickBooksOnline::Customer::Operations::Create.new(
59
- adaptor: adaptor,
60
- resource: resource
61
- )
62
-
63
- result = operation.perform # Returns a LedgerSync::OperationResult
64
-
65
- if result.success?
66
- resource = result.operation.resource
67
- # Do something with resource
68
- else # result.failure?
69
- raise result.error
70
- end
71
-
72
- # Because QuickBooks Online uses Oauth 2, you must always be sure to
73
- # save the access_token, refresh_token, and expirations as they can
74
- # change with any API call.
75
- result.operation.adaptor.ledger_attributes_to_save.each do |key, value|
76
- # save values
77
- end
78
- ```
79
-
80
- ## How it Works
81
-
82
- This library consists of two important layers:
83
-
84
- 1. Resources
85
- 2. Adaptors
86
-
87
- ### Resources
88
-
89
- Resources are named ruby objects (e.g. `Customer`, `Payment`, etc.) with strict attributes (e.g. `name`, `amount`, etc.). They are a layer between your application and an adaptor. They can be validated using an adaptor. You can create and use the resources, and an adaptor will update resources as needed based on the intention and outcome of that operation.
90
-
91
- You can find supported resources by calling `LedgerSync.resources`.
92
-
93
- Resources have defined attributes. Attributes are explicitly defined. An error is thrown if an unknown attribute is passed to it. You can retrieve the attributes of a resource by calling `LedgerSync::Customer.attributes`.
94
-
95
- A subset of these `attributes` may be a `reference`, which is simply a special type of attribute that references another resource. You can retrieve the references of a resource by calling `LedgerSync::Customer.references`.
96
-
97
- #### Custom Attributes
98
-
99
- Some ledgers (e.g. NetSuite) allow for custom attributes (or "fields"), which can vary by account and user. To allow for custom attributes, you can create new resources, ledger serializers (see below), and validation contracts (see below). Assuming your ledger supports the string attribute `foo` for customers, you could do the following:
100
-
101
- ```ruby
102
- class CustomCustomer < LedgerSync::Customer
103
- attribute :foo, type: LedgerSync::Type::String
104
- end
105
- ```
106
-
107
- Depending on your use of LedgerSync, you may need to define resources dynamically with different custom attributes. You could do so using something like the following:
108
-
109
- ```ruby
110
- custom_attributes_for_customers = [
111
- [
112
- [:foo, LedgerSync::Type::String]
113
- ],
114
- [
115
- [:foo, LedgerSync::Type::Integer],
116
- [:bar, LedgerSync::Type::Boolean]
117
- ]
118
- ]
119
-
120
- custom_customer_classes = custom_attributes_for_customers.map do |attributes|
121
- klass = Class.new(LedgerSync::Customer)
122
- attributes.each do |name, type|
123
- klass.attribute name, type: type
124
- end
125
- klass
126
- end
127
-
128
- klass1, klass2 = custom_customer_classes
129
-
130
- # First Custom Customer Class
131
- klass1.resource_attributes.include?(:foo) # => true
132
- klass1.resource_attributes[:foo].type # => #<LedgerSync::Type::String:0x00007fe04e9529b0 @precision=nil, @scale=nil, @limit=nil>
133
- klass1.resource_attributes.include?(:bar) # => false
134
-
135
- # Second Custom Customer Class
136
- klass2.resource_attributes.include?(:foo) # => true
137
- klass2.resource_attributes[:foo].type # => #<LedgerSync::Type::Integer:0x00007fe04e2c7898 @precision=nil, @scale=nil, @limit=nil, @range=-2147483648...2147483648>
138
- klass2.resource_attributes.include?(:bar) # => true
139
- klass2.resource_attributes[:bar].type # => #<LedgerSync::Type::Boolean:0x00007fe04e2e4f10 @precision=nil, @scale=nil, @limit=nil>
140
- ```
141
-
142
- You can now use these custom resources in operations that require custom attributes.
143
-
144
- ### Adaptors
145
-
146
- Adaptors are ledger-specific ruby objects that contain all the logic to authenticate to a ledger, perform ledger-specific operations, and validate resources based on the requirements of the ledger. Adaptors contain a number of useful objects:
147
-
148
- - adaptor
149
- - serializers
150
- - operations
151
- - searchers
152
-
153
- #### Adaptor
154
-
155
- The adaptor handles authentication and requests to the ledger. Each adaptors initializer will vary based on the needs of that ledger.
156
-
157
- #### Serializers
158
-
159
- Operations depend on `LedgerSync::Adaptor::LedgerSerializer`s to serialize and deserialize objects. Most resources have a default serializer per adaptor which may acts as both a serializer and deserializer. You can provide custom serializers, which is necessary when working with custom attributes. For example, given the following:
160
- - `custom_resource` that is a `LedgerSync::Customer` (see above)
161
- - the attribute `foo` is used in both the request and response bodies
162
- - using the `NetSuite` adaptor
163
-
164
- you could implement custom serializers using the following code:
165
-
166
- ```ruby
167
- class CustomSerializer < LedgerSync::Adaptors::NetSuite::Customer::LedgerSerializer
168
- attribute ledger_attribute: :foo,
169
- resource_attribute: :foo,
170
- deserialize: true, # optional, default: true
171
- serialize: true # optional, default: true
172
- end
173
-
174
- # Serializing
175
- custom_resource = CustomCustomer.new(foo: 'asdf') # See above under Resources -> Custom Attributes
176
- serializer = CustomSerializer.new(resource: custom_resource)
177
- serializer.to_ledger_hash # => {"foo"=>"asdf"}
178
-
179
- # Deserializing
180
- deserialized_resource = serializer.deserialize(hash: { foo: 'qwerty' })
181
- deserialized_resource.foo # => 'qwerty'
182
- custom_resource.foo # => 'asdf'
183
-
184
- op = LedgerSync::Adaptors::NetSuite::Customer::Operations::Create.new(
185
- adaptor: adaptor,
186
- ledger_deserializer_class: CustomSerializer, # You must specify, though you could use a separate class
187
- ledger_serializer_class: CustomSerializer,
188
- resource: custom_resource
189
- )
190
- ```
191
-
192
- Note that in the above example, we extend an existing customer serializer in the NetSuite adaptor. In most cases, serializers have the following inheritance pattern: `LedgerSync::Adaptors::[ADAPTOR]::[RESOURCE]::LedgerSerializer < LedgerSync::Adaptors::[ADAPTOR]::LedgerSerializer < LedgerSync::Adaptors::LedgerSerializer`
193
-
194
- So in this example, it would be `LedgerSync::Adaptors::NetSuite::Customer::LedgerSerializer < LedgerSync::Adaptors::NetSuite::LedgerSerializer < LedgerSync::Adaptors::LedgerSerializer`. The more specific the serializer, the more helper methods are available that are adaptor and/or resource specific.
195
-
196
- #### Operation
197
-
198
- Each adaptor defines operations that can be performed on specific resources (e.g. `Customer::Operations::Update`, `Payment::Operations::Create`). The operation defines two key things:
199
-
200
- - a `Contract` class which is used to validate the resource using the `dry-validation` gem
201
- - a `perform` instance method, which handles the actual API requests and response/error handling.
202
-
203
- Note: Adaptors may support different operations for each resource type.
204
-
205
- ##### Contracts
206
-
207
- Contracts are dry-validation schemas, which determine if an operation can be performed. You can create custom schemas and pass them to operations. Assuming you have an `operation_class` variable and `foo` is an attribute of a `custom_resource` (see above) that is required to be a string, you can implement it with the following:
208
-
209
- ```ruby
210
- class CustomContract < LedgerSync::Adaptors::Contract
211
- params do
212
- required(:foo).filled(:string)
213
- end
214
- end
215
-
216
- # A valid case
217
- custom_resource = CustomResource.new(foo: 'asdf')
218
- op = operation_class.new(
219
- adaptor: adaptor,
220
- resource: resource,
221
- validation_contract: CustomContract
222
- )
223
- op.valid? # => true
224
-
225
- # An invalid case
226
- custom_resource = CustomResource.new(foo: nil)
227
- operation_class.new(
228
- adaptor: adaptor,
229
- resource: resource,
230
- validation_contract: CustomContract
231
- )
232
- op.valid? # => false
233
-
234
- ```
235
-
236
- #### Searcher
237
-
238
- Searchers are used to search objects in the ledger. A searcher takes an `adaptor`, `query` string and optional `pagination` hash. For example, to search customer's by name:
239
-
240
- ```ruby
241
- searcher = LedgerSync::Adaptors::QuickBooksOnline::Customer::Searcher.new(
242
- adaptor: adaptor # assuming this is defined,
243
- query: 'test'
244
- )
245
-
246
- result = searcher.search # returns a LedgerSync::SearchResult
247
-
248
- if result.success?
249
- resources = result.resources
250
- # Do something with found resources
251
- else # result.failure?
252
- raise result.error
253
- end
254
-
255
- # Different ledgers may use different pagination strategies. In order
256
- # to get the next and previous set of results, you can use the following:
257
- next_searcher = searcher.next_searcher
258
- previous_searcher = searcher.previous_searcher
259
- ```
260
-
261
- ## NetSuite
262
-
263
- The NetSuite adaptor leverages NetSuite's REST API.
264
-
265
- ### Resource Metadata and Schemas
266
-
267
- Due to NetSuites granular user permissions and custom attributes, resources and methods for those resources can vary from one user (a.k.a. token) to another. Because of this variance, there are some helper classes that allow you to retrieve NetSuite records, allowed methods, attributes/parameters, etc.
268
-
269
- To retrieve the metadata for a record:
270
-
271
- ```ruby
272
- metadata = LedgerSync::Adaptors::NetSuite::Record::Metadata.new(
273
- adaptor: netsuite_adaptor, # Assuming this is previous defined
274
- record: :customer
275
- )
276
-
277
- puts metadata.http_methods # Returns a list of LedgerSync::Adaptors::NetSuite::Record::HTTPMethod objects
278
- puts metadata.properties # Returns a list of LedgerSync::Adaptors::NetSuite::Record::Property objects
279
- ```
280
-
281
- ### Reference
282
-
283
- - [NetSuite REST API Documentation](https://docs.oracle.com/cloud/latest/netsuitecs_gs/NSTRW/NSTRW.pdf)
284
-
285
- ## NetSuite SOAP
286
-
287
- LedgerSync supports the NetSuite SOAP adaptor, leveraging [the NetSuite gem](https://github.com/NetSweet/netsuite). The adaptor and sample operations are provided, though the main NetSuite adaptor uses the REST API.
288
-
289
- ### Reference
290
-
291
- - [NetSuite SOAP API Documentation](https://docs.oracle.com/cloud/latest/netsuitecs_gs/NSTWR/NSTWR.pdf)
292
-
293
-
294
- ## QuickBooks Online
295
-
296
- ### OAuth
297
-
298
- QuickBooks Online utilizes OAuth 2.0, which requires frequent refreshing of the access token. The adaptor will handle this automatically, attempting a single token refresh on any single request authentication failure. Depending on how you use the library, every adaptor has implements a class method `ledger_attributes_to_save`, which is an array of attributes that may change as the adaptor is used. You can also call the instance method `ledger_attributes_to_save` which will be a hash of these values. It is a good practice to always store these attributes if you are saving access tokens in your database.
299
-
300
- The adaptor also implements some helper methods for getting tokens. For example, you can set up an adaptor using the following:
301
-
302
- ```ruby
303
- # Retrieve the following values from Intuit app settings
304
- client_id = 'ID'
305
- client_secret = 'SECRET'
306
- redirect_uri = 'http://localhost:3000'
307
-
308
- oauth_client = LedgerSync::Adaptors::QuickBooksOnline::OAuthClientHelper.new(
309
- client_id: client_id,
310
- client_secret: client_secret
311
- )
312
-
313
- puts oauth_client.authorization_url(redirect_uri: redirect_uri)
314
-
315
- # Visit on the output URL and authorize a company.
316
- # You will be redirected back to the redirect_uri.
317
- # Copy the full url from your browser:
318
-
319
- uri = 'https://localhost:3000/?code=FOO&state=BAR&realm_id=BAZ'
320
-
321
- adaptor = LedgerSync::Adaptors::QuickBooksOnline::Adaptor.new_from_oauth_client_uri(
322
- oauth_client: oauth_client,
323
- uri: uri
324
- )
325
-
326
- # You can test that the auth works:
327
-
328
- adaptor.refresh!
329
- ```
330
-
331
- **Note: If you have a `.env` file storing your secrets, the adaptor will automatically update the variables and record previous values whenever values change**
332
-
333
- ### Webhooks
334
-
335
- Reference: [QuickBooks Online Webhook Documentation](https://developer.intuit.com/app/developer/qbo/docs/develop/webhooks/managing-webhooks-notifications#validating-the-notification)
336
-
337
- LedgerSync offers an easy way to validate and parse webhook payloads. It also allows you to easily fetch the resources referenced. You can create and use a webhook with the following:
338
-
339
- ```ruby
340
- # Assuming `request` is the webhook request received from Quickbooks Online
341
- webhook = LedgerSync::Adaptors::QuickBooksOnline::Webhook.new(
342
- payload: request.body.read # It accepts a JSON string or hash
343
- )
344
-
345
- verification_token = WEBHOOK_VERIFICATION_TOKEN # You get this token when you create webhooks in the QuickBooks Online dashboard
346
- signature = request.headers['intuit-signature']
347
- raise 'Not valid' unless webhook.valid?(signature: signature, verification_token: verification_token)
348
-
349
- # Although not yet used, webhooks may include notifications for multiple realms
350
- webhook.notifications.each do |notification|
351
- puts notification.realm_id
352
-
353
- # Multiple events may be referenced.
354
- notification.events.each do |event|
355
- puts event.resource # Returns a LedgerSync resource with the `ledger_id` set
356
-
357
- # Other helpful methods
358
- notification.find_operation_class(adaptor: your_quickbooks_adaptor_instance) # The respective Find class
359
- notification.find_operation(adaptor: your_quickbooks_adaptor_instance) # The initialized respective Find operation
360
- notification.find(adaptor: your_quickbooks_adaptor_instance) # Performs a Find operation for the resource retrieving the latest version from QuickBooks Online
361
- end
362
-
363
- # Other helpful methods
364
- notification.resources # All resources for a given webhook across all events
365
- end
366
-
367
- # Other helpful methods
368
- webhook.events # All events for a given webhook across all realms
369
- webhook.resources # All events for a given webhook across all realms and events
370
- ```
371
-
372
- ### Errors
373
-
374
- - [QuickBooks Online Error Documentation](https://developer.intuit.com/app/developer/qbo/docs/develop/troubleshooting/error-codes)
375
-
376
- ## Tips and More
377
-
378
- ### Keyword Arguments
379
-
380
- LedgerSync heavily uses ruby keyword arguments so as to make it clear what values are being passed and which attributes are required. When this README says something like "the `fun_function` function takes the argument `foo`" that translates to `fun_function(foo: :some_value)`.
381
-
382
- ### Fingerprints
383
-
384
- Most objects in LedgerSync can be fingerprinted by calling the instance method `fingerprint`. For example:
385
-
386
- ```ruby
387
- puts LedgerSync::Customer.new.fingerprint # "b3eab7ec00431a4ae0468fee72e5ba8f"
388
-
389
- puts LedgerSync::Customer.new.fingerprint == LedgerSync::Customer.new.fingerprint # true
390
- puts LedgerSync::Customer.new.fingerprint == LedgerSync::Customer.new(name: :foo).fingerprint # false
391
- puts LedgerSync::Customer.new.fingerprint == LedgerSync::Payment.new.fingerprint # false
392
- ```
393
-
394
- Fingerprints are used to compare objects. This method is used in de-duping objects, as it only considers the data inside and not the instance itself (as shown above).
395
-
396
- ### Serialization
397
-
398
- Most objects in LedgerSync can be serialized by calling the instance method `serialize`. For example:
399
-
400
- ```ruby
401
- puts LedgerSync::Payment.new(
402
- customer: LedgerSync::Customer.new
403
- )
404
-
405
- {
406
- root: "LedgerSync::Payment/8eed81c0177801a001f2544f0c85e21d",
407
- objects: {
408
- "LedgerSync::Payment/8eed81c0177801a001f2544f0c85e21d": {
409
- id: "LedgerSync::Payment/8eed81c0177801a001f2544f0c85e21d",
410
- object: "LedgerSync::Payment",
411
- fingeprint: "8eed81c0177801a001f2544f0c85e21d",
412
- data: {
413
- currency: nil,
414
- amount: nil,
415
- customer: {
416
- object: "reference",
417
- id: "LedgerSync::Customer/b3eab7ec00431a4ae0468fee72e5ba8f"
418
- },
419
- external_id: "",
420
- ledger_id: nil,
421
-
422
- }
423
- },
424
- "LedgerSync::Customer/b3eab7ec00431a4ae0468fee72e5ba8f": {
425
- id: "LedgerSync::Customer/b3eab7ec00431a4ae0468fee72e5ba8f",
426
- object: "LedgerSync::Customer",
427
- fingeprint: "b3eab7ec00431a4ae0468fee72e5ba8f",
428
- data: {
429
- name: nil,
430
- email: nil,
431
- phone_number: nil,
432
- external_id: "",
433
- ledger_id: nil
434
- }
435
- }
436
- }
437
- }
438
- ```
439
-
440
- The serialization of any object follows the same structure. There is a `:root` key that holds the ID of the root object. There is also an `:objects` hash that contains all of the objects for this serialization. As you can see, unique nested objects listed in the `:objects` hash and referenced using a "reference object", in this case:
441
-
442
- ```ruby
443
- {
444
- object: "reference",
445
- id: "LedgerSync::Customer/b3eab7ec00431a4ae0468fee72e5ba8f"
446
- }
447
- ```
448
-
449
- ## Development
450
-
451
- After checking out the repo, run `bin/setup` to install dependencies.
452
-
453
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org)
454
-
455
- ### Testing
456
-
457
- Run `bundle exec rspec` to run all unit, feature, and integration tests. Unlike QA Tests, all external HTTP requests and responses are stubbed.
458
-
459
- ### QA Testing
460
-
461
- **BE SURE TO USE A TEST ENVIRONMENT ON YOUR LEDGER.**
462
-
463
- To fully test the library against the actual ledgers, you can run `bin/qa` which will run all tests in the `qa/` directory. QA Tests are written in RSpec. Unlike tests in the `spec/` directory, QA tests allow external HTTP requests.
464
-
465
- As these interact with real ledgers, you will need to provide secrets. You can do so in a `.env` file in the root directory. Copy the `.env.template` file to get started.
466
-
467
- **WARNINGS:**
468
-
469
- - **BE SURE TO USE A TEST ENVIRONMENT ON YOUR LEDGER.**
470
- - **NEVER CHECK IN YOUR SECRETS (e.g. the `.env` file).**
471
- - Because these tests actually create and modify resources, they attempt to do "cleanup" by deleting any newly created resources. This process could fail, and you may need to delete these resources manually.
472
-
473
- ### Console
474
-
475
- Run `bundle console` to start and interactive console with the library already loaded. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
476
-
477
- ## Deployment
478
-
479
- To deploy a new version of the gem to RubyGems, you can use the `release.sh` script in the root. The script takes advantage of [the bump gem](https://github.com/gregorym/bump). So you may call the script using any of the following:
480
-
481
- ```bash
482
- # Version Format: MAJOR.MINOR.PATCH
483
- ./release.sh patch # to bump X in 1.1.X
484
- ./release.sh minor # to bump X in 1.X.1
485
- ./release.sh major # to bump X in X.1.1
486
- ```
487
-
488
- ### Contributing
489
-
490
- Bug reports and pull requests are welcome on GitHub at https://github.com/LedgerSync/ledger_sync. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
491
-
492
- ### License
493
-
494
- The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
495
-
496
- ### Code of Conduct
497
-
498
- Everyone interacting in the LedgerSync project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/LedgerSync/ledger_sync/blob/master/CODE_OF_CONDUCT.md).
499
-
500
- # Maintainers
19
+ ## Maintainers
501
20
 
502
21
  A big thank you to our maintainers:
503
22
 
504
23
  - [@ryanwjackson](https://github.com/ryanwjackson)
505
24
  - [@jozefvaclavik](https://github.com/jozefvaclavik)
506
- - And the whole [Modern Treasury](https://www.moderntreasury.com) team
25
+ - [@SeanBolt](https://github.com/SeanBolt)
26
+ - And the whole [Modern Treasury](https://www.moderntreasury.com) team