ledger_sync 1.4.2 → 1.4.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (165) hide show
  1. checksums.yaml +4 -4
  2. data/.overcommit.yml +30 -0
  3. data/.travis.yml +6 -1
  4. data/Gemfile +2 -0
  5. data/Gemfile.lock +11 -5
  6. data/Rakefile +2 -0
  7. data/bin/console +1 -0
  8. data/bin/quickbooks_online_oauth_server.rb +5 -4
  9. data/documentation/generators/generator.rb +4 -4
  10. data/documentation/site/LICENSE.md +14 -14
  11. data/documentation/site/_includes/header.html +34 -34
  12. data/documentation/site/_includes/section_content.html +25 -30
  13. data/documentation/site/_includes/section_cta.html +20 -24
  14. data/documentation/site/_includes/section_grid.html +39 -54
  15. data/documentation/site/_includes/section_hero.html +19 -24
  16. data/documentation/site/_includes/submenu.html +6 -7
  17. data/documentation/site/_layouts/advanced.html +0 -1
  18. data/documentation/site/_layouts/guides.html +2 -2
  19. data/documentation/site/_layouts/page.html +2 -2
  20. data/documentation/site/_plugins/filters.rb +3 -3
  21. data/documentation/site/_templates/reference/resources/resource.md.erb +14 -0
  22. data/documentation/site/assets/js/plugins.js +1 -1
  23. data/documentation/site/guides/architecture/searchers.md +3 -3
  24. data/documentation/site/reference/netsuite/resources/account.md +6 -0
  25. data/documentation/site/reference/netsuite/resources/check.md +6 -0
  26. data/documentation/site/reference/netsuite/resources/check_line_item.md +4 -0
  27. data/documentation/site/reference/netsuite/resources/currency.md +4 -0
  28. data/documentation/site/reference/netsuite/resources/customer.md +6 -0
  29. data/documentation/site/reference/netsuite/resources/customer_deposit.md +6 -0
  30. data/documentation/site/reference/netsuite/resources/department.md +6 -0
  31. data/documentation/site/reference/netsuite/resources/deposit.md +4 -0
  32. data/documentation/site/reference/netsuite/resources/deposit_line_item.md +4 -0
  33. data/documentation/site/reference/netsuite/resources/invoice.md +4 -0
  34. data/documentation/site/reference/netsuite/resources/invoice_line_item.md +4 -0
  35. data/documentation/site/reference/netsuite/resources/item.md +4 -0
  36. data/documentation/site/reference/netsuite/resources/journal_entry.md +4 -0
  37. data/documentation/site/reference/netsuite/resources/journal_entry_line_item.md +4 -0
  38. data/documentation/site/reference/netsuite/resources/ledger_class.md +6 -0
  39. data/documentation/site/reference/netsuite/resources/location.md +6 -0
  40. data/documentation/site/reference/netsuite/resources/resource.md +4 -0
  41. data/documentation/site/reference/netsuite/resources/subsidiary.md +6 -0
  42. data/documentation/site/reference/netsuite/resources/vendor.md +6 -0
  43. data/documentation/site/reference/netsuite_soap/resources/customer.md +4 -0
  44. data/documentation/site/reference/netsuite_soap/resources/resource.md +4 -0
  45. data/documentation/site/reference/netsuite_soap/resources/subsidiary.md +4 -0
  46. data/documentation/site/reference/quickbooks_online/resources/account.md +6 -0
  47. data/documentation/site/reference/quickbooks_online/resources/bill.md +6 -0
  48. data/documentation/site/reference/quickbooks_online/resources/bill_line_item.md +4 -0
  49. data/documentation/site/reference/quickbooks_online/resources/bill_payment.md +4 -0
  50. data/documentation/site/reference/quickbooks_online/resources/bill_payment_line_item.md +4 -0
  51. data/documentation/site/reference/quickbooks_online/resources/currency.md +4 -0
  52. data/documentation/site/reference/quickbooks_online/resources/customer.md +6 -0
  53. data/documentation/site/reference/quickbooks_online/resources/department.md +6 -0
  54. data/documentation/site/reference/quickbooks_online/resources/deposit.md +6 -0
  55. data/documentation/site/reference/quickbooks_online/resources/deposit_line_item.md +4 -0
  56. data/documentation/site/reference/quickbooks_online/resources/expense.md +6 -0
  57. data/documentation/site/reference/quickbooks_online/resources/expense_line_item.md +4 -0
  58. data/documentation/site/reference/quickbooks_online/resources/invoice.md +4 -0
  59. data/documentation/site/reference/quickbooks_online/resources/invoice_sales_line_item.md +4 -0
  60. data/documentation/site/reference/quickbooks_online/resources/item.md +4 -0
  61. data/documentation/site/reference/quickbooks_online/resources/journal_entry.md +6 -0
  62. data/documentation/site/reference/quickbooks_online/resources/journal_entry_line_item.md +4 -0
  63. data/documentation/site/reference/quickbooks_online/resources/ledger_class.md +6 -0
  64. data/documentation/site/reference/quickbooks_online/resources/payment.md +4 -0
  65. data/documentation/site/reference/quickbooks_online/resources/payment_line_item.md +4 -0
  66. data/documentation/site/reference/quickbooks_online/resources/preferences.md +4 -0
  67. data/documentation/site/reference/quickbooks_online/resources/primary_email_addr.md +4 -0
  68. data/documentation/site/reference/quickbooks_online/resources/primary_phone.md +4 -0
  69. data/documentation/site/reference/quickbooks_online/resources/resource.md +4 -0
  70. data/documentation/site/reference/quickbooks_online/resources/subsidiary.md +4 -0
  71. data/documentation/site/reference/quickbooks_online/resources/transfer.md +4 -0
  72. data/documentation/site/reference/quickbooks_online/resources/vendor.md +6 -0
  73. data/documentation/site/reference/stripe/resources/customer.md +4 -0
  74. data/documentation/site/reference/stripe/resources/resource.md +4 -0
  75. data/ledger_sync.gemspec +3 -1
  76. data/lib/ledger_sync.rb +3 -1
  77. data/lib/ledger_sync/concerns/validatable.rb +2 -0
  78. data/lib/ledger_sync/error/operation_errors.rb +1 -1
  79. data/lib/ledger_sync/error/resource_errors.rb +3 -2
  80. data/lib/ledger_sync/ledger_configuration_store.rb +5 -1
  81. data/lib/ledger_sync/ledgers/client.rb +12 -4
  82. data/lib/ledger_sync/ledgers/mixins/infer_serializer_mixin.rb +3 -1
  83. data/lib/ledger_sync/ledgers/netsuite/account/operations/find.rb +1 -1
  84. data/lib/ledger_sync/ledgers/netsuite/client.rb +2 -2
  85. data/lib/ledger_sync/ledgers/netsuite/dashboard_url_helper.rb +1 -1
  86. data/lib/ledger_sync/ledgers/netsuite/error.rb +1 -0
  87. data/lib/ledger_sync/ledgers/netsuite/journal_entry_line_item/deserializer.rb +0 -3
  88. data/lib/ledger_sync/ledgers/netsuite/resources/account.rb +1 -2
  89. data/lib/ledger_sync/ledgers/netsuite/searcher.rb +3 -1
  90. data/lib/ledger_sync/ledgers/netsuite/token.rb +1 -1
  91. data/lib/ledger_sync/ledgers/netsuite/type/deserializer_entity_type.rb +6 -6
  92. data/lib/ledger_sync/ledgers/netsuite/vendor/operations/create.rb +1 -1
  93. data/lib/ledger_sync/ledgers/netsuite/vendor/operations/delete.rb +1 -1
  94. data/lib/ledger_sync/ledgers/netsuite/vendor/operations/find.rb +1 -1
  95. data/lib/ledger_sync/ledgers/netsuite/vendor/operations/update.rb +1 -1
  96. data/lib/ledger_sync/ledgers/netsuite_soap/client.rb +15 -21
  97. data/lib/ledger_sync/ledgers/netsuite_soap/customer/operations/create.rb +2 -0
  98. data/lib/ledger_sync/ledgers/operation.rb +5 -3
  99. data/lib/ledger_sync/ledgers/quickbooks_online/account/operations/create.rb +2 -0
  100. data/lib/ledger_sync/ledgers/quickbooks_online/account/operations/find.rb +2 -0
  101. data/lib/ledger_sync/ledgers/quickbooks_online/bill/operations/create.rb +2 -0
  102. data/lib/ledger_sync/ledgers/quickbooks_online/bill/operations/find.rb +2 -0
  103. data/lib/ledger_sync/ledgers/quickbooks_online/bill/operations/update.rb +2 -0
  104. data/lib/ledger_sync/ledgers/quickbooks_online/client.rb +12 -4
  105. data/lib/ledger_sync/ledgers/quickbooks_online/customer/searcher.rb +2 -0
  106. data/lib/ledger_sync/ledgers/quickbooks_online/dashboard_url_helper.rb +22 -22
  107. data/lib/ledger_sync/ledgers/quickbooks_online/department/operations/create.rb +2 -0
  108. data/lib/ledger_sync/ledgers/quickbooks_online/department/operations/find.rb +2 -0
  109. data/lib/ledger_sync/ledgers/quickbooks_online/deposit/operations/create.rb +2 -0
  110. data/lib/ledger_sync/ledgers/quickbooks_online/deposit/operations/find.rb +2 -0
  111. data/lib/ledger_sync/ledgers/quickbooks_online/deposit/searcher.rb +1 -0
  112. data/lib/ledger_sync/ledgers/quickbooks_online/deserializer.rb +4 -2
  113. data/lib/ledger_sync/ledgers/quickbooks_online/expense/deserializer.rb +3 -2
  114. data/lib/ledger_sync/ledgers/quickbooks_online/expense/operations/create.rb +2 -0
  115. data/lib/ledger_sync/ledgers/quickbooks_online/expense/operations/find.rb +2 -0
  116. data/lib/ledger_sync/ledgers/quickbooks_online/expense/operations/update.rb +2 -0
  117. data/lib/ledger_sync/ledgers/quickbooks_online/invoice/operations/find.rb +2 -0
  118. data/lib/ledger_sync/ledgers/quickbooks_online/invoice/operations/update.rb +2 -0
  119. data/lib/ledger_sync/ledgers/quickbooks_online/journal_entry/operations/create.rb +2 -0
  120. data/lib/ledger_sync/ledgers/quickbooks_online/journal_entry/operations/find.rb +2 -0
  121. data/lib/ledger_sync/ledgers/quickbooks_online/journal_entry/operations/update.rb +2 -0
  122. data/lib/ledger_sync/ledgers/quickbooks_online/ledger_class/deserializer.rb +0 -1
  123. data/lib/ledger_sync/ledgers/quickbooks_online/ledger_class/operations/create.rb +2 -0
  124. data/lib/ledger_sync/ledgers/quickbooks_online/ledger_class/operations/find.rb +2 -0
  125. data/lib/ledger_sync/ledgers/quickbooks_online/operation.rb +1 -1
  126. data/lib/ledger_sync/ledgers/quickbooks_online/payment/operations/find.rb +2 -0
  127. data/lib/ledger_sync/ledgers/quickbooks_online/payment/operations/update.rb +2 -0
  128. data/lib/ledger_sync/ledgers/quickbooks_online/resources/customer.rb +4 -0
  129. data/lib/ledger_sync/ledgers/quickbooks_online/transfer/operations/create.rb +2 -0
  130. data/lib/ledger_sync/ledgers/quickbooks_online/transfer/operations/find.rb +2 -0
  131. data/lib/ledger_sync/ledgers/quickbooks_online/util/error_matcher.rb +8 -5
  132. data/lib/ledger_sync/ledgers/quickbooks_online/util/ledger_error_parser.rb +3 -3
  133. data/lib/ledger_sync/ledgers/quickbooks_online/util/operation_error_parser.rb +2 -2
  134. data/lib/ledger_sync/ledgers/quickbooks_online/webhook_event.rb +3 -1
  135. data/lib/ledger_sync/ledgers/quickbooks_online/webhook_notification.rb +4 -3
  136. data/lib/ledger_sync/ledgers/response.rb +3 -1
  137. data/lib/ledger_sync/ledgers/stripe/client.rb +1 -1
  138. data/lib/ledger_sync/ledgers/stripe/dashboard_url_helper.rb +1 -1
  139. data/lib/ledger_sync/ledgers/stripe/operation/create.rb +0 -2
  140. data/lib/ledger_sync/ledgers/stripe/operation/delete.rb +0 -2
  141. data/lib/ledger_sync/ledgers/stripe/operation/update.rb +0 -2
  142. data/lib/ledger_sync/resource.rb +3 -1
  143. data/lib/ledger_sync/resource_attribute/dirty_mixin.rb +1 -1
  144. data/lib/ledger_sync/resource_attribute/mixin.rb +3 -3
  145. data/lib/ledger_sync/resource_attribute_set.rb +1 -1
  146. data/lib/ledger_sync/result.rb +7 -12
  147. data/lib/ledger_sync/serialization/deserializer_attribute.rb +6 -2
  148. data/lib/ledger_sync/serializer.rb +3 -1
  149. data/lib/ledger_sync/type/reference_one.rb +1 -1
  150. data/lib/ledger_sync/util/hash_helpers.rb +12 -2
  151. data/lib/ledger_sync/util/mixins/delegate_iterable_methods_mixin.rb +1 -0
  152. data/lib/ledger_sync/util/read_only_object.rb +1 -1
  153. data/lib/ledger_sync/util/resource_converter.rb +12 -8
  154. data/lib/ledger_sync/util/resource_converter/attribute.rb +3 -1
  155. data/lib/ledger_sync/util/resource_converter/attribute_set.rb +2 -1
  156. data/lib/ledger_sync/util/resources_builder.rb +5 -5
  157. data/lib/ledger_sync/version.rb +3 -1
  158. metadata +17 -10
  159. data/documentation/site/reference/architecture/clients.md +0 -33
  160. data/documentation/site/reference/architecture/index.md +0 -14
  161. data/documentation/site/reference/architecture/operations.md +0 -6
  162. data/documentation/site/reference/architecture/resources.md +0 -38
  163. data/documentation/site/reference/architecture/results.md +0 -6
  164. data/documentation/site/reference/architecture/searchers.md +0 -6
  165. data/documentation/site/reference/architecture/serialization.md +0 -6
@@ -1,33 +0,0 @@
1
- ---
2
- title: Clients
3
- weight: 1
4
- layout: reference
5
- ---
6
-
7
- ## Overview
8
-
9
- Clients handle the authentication and requests to the ledger. A ledger may have different authentication strategies,
10
- so clients will accept different arguments. For example, QuickBooks Online utilizes Oauth 2.0 while NetSuite offers
11
- Token Based Authentication. While similar, the required keys are different.
12
-
13
- ## How to use
14
-
15
- Unless you are customizing LedgerSync, you will always pass an instantiated client to an object (e.g. an operation).
16
- The object will handle using the client as needed.
17
-
18
- ## Gotchas
19
-
20
- ### Oauth 2.0
21
-
22
- Clients store the authentication details for the ledger. Given that Oauth 2.0 tokens can refresh during a request,
23
- these clients will handle saving credentials back to the client instance. Typically (though some clients offer
24
- more automated solutions), you will want to save any changes back to your database. You can use
25
- `client.ledger_attributes_to_save` to retrieve a hash of which attributes to save. Your code to do so could look like
26
- the following:
27
-
28
- {% highlight ruby linenos %}
29
- # Assuming `client` is defined as an instance of a ledger Client class
30
- client.ledger_attributes_to_save.each do |attribute_to_save, value|
31
- # Store value
32
- end
33
- {% endhighlight %}
@@ -1,14 +0,0 @@
1
- ---
2
- title: Architecture
3
- excerpt: Understand the high-level architecture of LedgerSync.
4
- layout: reference
5
- ---
6
-
7
- LedgerSync consists of the following high-level objects:
8
-
9
- - [Clients](/guides/architecture/clients)
10
- - [Resources](/guides/architecture/resources)
11
- - [Serialization](/guides/architecture/serialization)
12
- - [Operations](/guides/architecture/operations)
13
- - [Searchers](/guides/architecture/searchers)
14
- - [Results](/guides/architecture/results)
@@ -1,6 +0,0 @@
1
- ---
2
- title: Operations
3
- weight: 4
4
- layout: reference
5
- ---
6
-
@@ -1,38 +0,0 @@
1
- ---
2
- title: Resources
3
- weight: 2
4
- layout: reference
5
- ---
6
-
7
- ## Overview
8
-
9
- Resources are named ruby objects (e.g. `Customer`, `Payment`, etc.) with strict attributes (e.g. `name`, `amount`, etc.). LedgerSync provides resources specific to each ledger. While it is possible to create your own resources (see Customization for more details), this section refers to provided ledger-specific resources.
10
-
11
- The library strives to make each resource and attribute name match the ledger API. This naming convention will help you more readily match ledger documentation to LedgerSync resources.
12
-
13
- ## How to use
14
-
15
- Resources are primary used as the inputs and outputs of operations and searchers. A resource is passed to an operation along with a client. Once the operation is successfully performed, a duplicated and updated resource is returned.
16
-
17
- Resources have two layers of validation:
18
-
19
- 1. The Resource
20
- 2. Operations
21
-
22
- When instantiating a resource, validations are performed. These validations include class checks and, if necessary, value checks (e.g. enums). When performing an operation, validations are performed based on what attributes are required for the operation to be successful. For example, the `ledger_id` should be `nil` on `create`, but it should be present on `update`.
23
-
24
- ## Available resources
25
-
26
- You can see all resources available for a given ledger by calling `resources` on the ledger's `Client` like so:
27
-
28
- `LedgerSync::Ledgers::QuickBooksOnline::Client.resources`
29
-
30
- This returns a hash of resource types to classes, where the resource types are unique (e.g. `customer`, `vendor`, etc.).
31
-
32
- You can see all resources available in LedgerSync by calling `LedgerSync.resources`. This returns an array (note: not a hash as multiple ledgers have the same types) of resource classes that have been created inheriting the `LedgerSync::Resource` class.
33
-
34
- ## Resource Attributes
35
-
36
- 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 `Customer.attributes`.
37
-
38
- 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 `Customer.references`.
@@ -1,6 +0,0 @@
1
- ---
2
- title: Results
3
- weight: 6
4
- layout: reference
5
- ---
6
-
@@ -1,6 +0,0 @@
1
- ---
2
- title: Operations
3
- weight: 5
4
- layout: reference
5
- ---
6
-
@@ -1,6 +0,0 @@
1
- ---
2
- title: Serialization
3
- weight: 3
4
- layout: reference
5
- ---
6
-