dear_inventory 0.7.5 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (80) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +15 -0
  3. data/README.md +70 -18
  4. data/dear_inventory.gemspec +1 -1
  5. data/docs/resources/advanced_purchase.md +25 -0
  6. data/docs/resources/customer.md +31 -0
  7. data/docs/resources/product.md +37 -0
  8. data/docs/resources/purchase.md +89 -0
  9. data/docs/resources/sale.md +89 -0
  10. data/lib/dear_inventory.rb +20 -8
  11. data/lib/dear_inventory/config.rb +17 -6
  12. data/lib/dear_inventory/errors/api_limit.rb +6 -0
  13. data/lib/dear_inventory/errors/no_more_pages.rb +6 -0
  14. data/lib/dear_inventory/lib/endpoint_class.rb +1 -1
  15. data/lib/dear_inventory/lib/request.rb +45 -8
  16. data/lib/dear_inventory/lib/strings/urlize.rb +18 -0
  17. data/lib/dear_inventory/model.rb +22 -9
  18. data/lib/dear_inventory/models/advanced_purchase.rb +176 -0
  19. data/lib/dear_inventory/models/customer.rb +1 -1
  20. data/lib/dear_inventory/models/customers.rb +1 -1
  21. data/lib/dear_inventory/models/products.rb +1 -1
  22. data/lib/dear_inventory/models/{purchase_list.rb → purchases.rb} +12 -2
  23. data/lib/dear_inventory/models/purchases/additional_charge.rb +1 -1
  24. data/lib/dear_inventory/models/purchases/advanced/credit_note.rb +21 -0
  25. data/lib/dear_inventory/models/purchases/advanced/invoice.rb +68 -0
  26. data/lib/dear_inventory/models/purchases/advanced/manual_journal.rb +21 -0
  27. data/lib/dear_inventory/models/purchases/advanced/put_away.rb +34 -0
  28. data/lib/dear_inventory/models/purchases/advanced/put_away_line.rb +21 -0
  29. data/lib/dear_inventory/models/purchases/advanced/stock.rb +30 -0
  30. data/lib/dear_inventory/models/purchases/advanced/stock_line.rb +61 -0
  31. data/lib/dear_inventory/models/purchases/credit_note.rb +1 -1
  32. data/lib/dear_inventory/models/purchases/inventory_movement.rb +1 -1
  33. data/lib/dear_inventory/models/purchases/invoice.rb +1 -1
  34. data/lib/dear_inventory/models/purchases/invoice_additional_charge.rb +1 -1
  35. data/lib/dear_inventory/models/purchases/invoice_line.rb +1 -1
  36. data/lib/dear_inventory/models/purchases/line.rb +1 -1
  37. data/lib/dear_inventory/models/purchases/manual_journal.rb +1 -1
  38. data/lib/dear_inventory/models/purchases/manual_journal_line.rb +1 -1
  39. data/lib/dear_inventory/models/purchases/order.rb +1 -1
  40. data/lib/dear_inventory/models/purchases/payment_line.rb +51 -0
  41. data/lib/dear_inventory/models/purchases/stock.rb +1 -1
  42. data/lib/dear_inventory/models/purchases/stock_line.rb +1 -1
  43. data/lib/dear_inventory/models/purchases/unstock_line.rb +1 -1
  44. data/lib/dear_inventory/models/{purchase_lists.rb → purchases_results.rb} +4 -4
  45. data/lib/dear_inventory/models/{sale_list.rb → sales.rb} +7 -2
  46. data/lib/dear_inventory/models/sales/additional_charge.rb +1 -1
  47. data/lib/dear_inventory/models/sales/credit_note.rb +1 -1
  48. data/lib/dear_inventory/models/sales/fulfilment.rb +1 -1
  49. data/lib/dear_inventory/models/sales/fulfilments/pick_pack.rb +1 -1
  50. data/lib/dear_inventory/models/sales/fulfilments/pick_pack_line.rb +1 -1
  51. data/lib/dear_inventory/models/sales/fulfilments/ship.rb +1 -1
  52. data/lib/dear_inventory/models/sales/fulfilments/ship_line.rb +1 -1
  53. data/lib/dear_inventory/models/sales/invoice.rb +1 -1
  54. data/lib/dear_inventory/models/sales/invoice_additional_charge.rb +1 -1
  55. data/lib/dear_inventory/models/sales/invoice_line.rb +1 -1
  56. data/lib/dear_inventory/models/sales/line.rb +1 -1
  57. data/lib/dear_inventory/models/sales/manual_journal.rb +1 -1
  58. data/lib/dear_inventory/models/sales/manual_journal_line.rb +1 -1
  59. data/lib/dear_inventory/models/sales/order.rb +1 -1
  60. data/lib/dear_inventory/models/sales/payment_line.rb +1 -1
  61. data/lib/dear_inventory/models/sales/quote.rb +1 -1
  62. data/lib/dear_inventory/models/{sale_lists.rb → sales_results.rb} +4 -4
  63. data/lib/dear_inventory/parameters/advanced_purchase/show.rb +25 -0
  64. data/lib/dear_inventory/parameters/purchase/index.rb +65 -6
  65. data/lib/dear_inventory/parameters/purchase/show.rb +25 -0
  66. data/lib/dear_inventory/parameters/sale/index.rb +95 -11
  67. data/lib/dear_inventory/parameters/sale/show.rb +35 -0
  68. data/lib/dear_inventory/resource.rb +8 -11
  69. data/lib/dear_inventory/resources/{purchase_list.rb → advanced_purchase.rb} +8 -5
  70. data/lib/dear_inventory/resources/customer.rb +2 -0
  71. data/lib/dear_inventory/resources/product.rb +2 -0
  72. data/lib/dear_inventory/resources/purchase.rb +38 -2
  73. data/lib/dear_inventory/resources/sale.rb +38 -2
  74. data/lib/dear_inventory/response.rb +118 -17
  75. data/lib/dear_inventory/version.rb +1 -1
  76. data/sorbet/rbi/hidden-definitions/hidden.rbi +0 -4
  77. metadata +29 -12
  78. data/lib/dear_inventory/parameters/purchase_list/index.rb +0 -84
  79. data/lib/dear_inventory/parameters/sale_list/index.rb +0 -119
  80. data/lib/dear_inventory/resources/sale_list.rb +0 -24
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9fd73bb4ad365b44049b2329bc8124e68814c8c253d5bcf8c79c7e3f1ee6d445
4
- data.tar.gz: 24787adfef1c7a1f059bec01f32a86034748ad57f2313d8cee10854b778181e0
3
+ metadata.gz: bbdd47a610c9e0211c3172dbefa7f7f01fd8b4f162d56a28278f918cdf5f410d
4
+ data.tar.gz: 35a216d5c1fef58b34cdeb5e270716b838bb150208c351c72b02efd51c0ddb19
5
5
  SHA512:
6
- metadata.gz: bcbb7d9c3d0915ed5c9b4c824fd8f8f0b646807c8718eec81810e7022578b8566a4d6b156ca6220fa93192a7017581b68e104c9cd880c17fa9a9184cedcbaa3a
7
- data.tar.gz: bb4dd0dc0e691e864d9f0a324e046f9f510ac194506a1c50812551b2f6bda15bd7a27bc0b37938ea4d9a61f3bafc7bdfa7ed9d7f71984358a9211d187074448b
6
+ metadata.gz: c367eb7bae39cc13c565b52276d11f108755648a07a975124a8781e104f7019966dbbddac9374bcdd4d06aada9a4ae123fac9202d026fdb7b7dc756108dc3e61
7
+ data.tar.gz: ab07f448af90b13057588b4cd5aaae384a731be266584c1382640c5666d45636581e867cc306d64b807199dad6d2e074f667e681f6febe6283fe3e9905f34f36
data/.rubocop.yml CHANGED
@@ -30,6 +30,12 @@ Lint/AmbiguousBlockAssociation:
30
30
  Exclude:
31
31
  - spec/**/*
32
32
 
33
+ Lint/RaiseException:
34
+ Enabled: true
35
+
36
+ Lint/StructNewOverride:
37
+ Enabled: true
38
+
33
39
  Metrics/BlockLength:
34
40
  Exclude:
35
41
  - dear_inventory.gemspec
@@ -64,6 +70,15 @@ Style/Documentation:
64
70
  Style/GuardClause:
65
71
  Enabled: false
66
72
 
73
+ Style/HashEachMethods:
74
+ Enabled: true
75
+
76
+ Style/HashTransformKeys:
77
+ Enabled: true
78
+
79
+ Style/HashTransformValues:
80
+ Enabled: true
81
+
67
82
  Style/LambdaCall:
68
83
  Enabled: false
69
84
 
data/README.md CHANGED
@@ -1,8 +1,8 @@
1
1
  # DearInventory
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/dear_inventory`. To experiment with that code, run `bin/console` for an interactive prompt.
3
+ A Ruby API client for connecting to DEAR Inventory. At this point, I have only been implementing the GET requests based upon our business needs but, if you like the look of this gem but require a missing endpoint, it would be quite easy to bolt on POST/PUT/Delete endpoints.
4
4
 
5
- TODO: Delete this and the text above, and describe your gem
5
+ Honestly, the DEAR API is a mess. Where possible, this gem attempts to hide the rampant inconsistencies and provide continuity but I'm afraid I'm no magician.
6
6
 
7
7
  ## Installation
8
8
 
@@ -22,10 +22,7 @@ Or install it yourself as:
22
22
 
23
23
  ## N.B for Ruby 2.7
24
24
 
25
- At time of writing, the Sorbet team has not yet accepted my pull request to fix
26
- deprecation warnings due to the use of the single splat operator. It can be
27
- quite frustrating to have your console flooded with warnings and so it may be
28
- worth your while specifying my fork of sorbet-runtime in your project's Gemfile:
25
+ At time of writing, the Sorbet team has not yet accepted my pull request to fix deprecation warnings due to the use of the single splat operator. It can be quite frustrating to have your console flooded with warnings and so it may be worth your while specifying my fork of sorbet-runtime in your project's Gemfile:
29
26
  ```
30
27
  gem "sorbet-runtime",
31
28
  git: "https://github.com/HashNotAdam/sorbet.git",
@@ -33,10 +30,9 @@ gem "sorbet-runtime",
33
30
  glob: "gems/sorbet-runtime/sorbet-runtime.gemspec"
34
31
  ```
35
32
 
36
- ## Usage
33
+ ## Configuration
37
34
 
38
- Before you begin, you will need to setup API credentials in DEAR Inventory at
39
- https://inventory.dearsystems.com/ExternalApi
35
+ Before you begin, you will need to setup API credentials in DEAR Inventory at https://inventory.dearsystems.com/ExternalApi
40
36
 
41
37
  Next you need to supply your API credentials:
42
38
  ```ruby
@@ -48,18 +44,75 @@ DearInventory.configure do |config|
48
44
  end
49
45
  ```
50
46
 
47
+ There is a default logger set to write to STDOUT which is also configurable
48
+
49
+ ```ruby
50
+ DearInventory.configure do |config|
51
+ ...
52
+ config.logger = CustomLogger.new
53
+ end
54
+ ```
55
+
56
+ ## Endpoints
57
+
58
+ [Customer](https://github.com/HashNotAdam/dear_inventory-ruby/docs/resources/customer.md)
59
+ [Product](https://github.com/HashNotAdam/dear_inventory-ruby/docs/resources/product.md)
60
+ [Purchase](https://github.com/HashNotAdam/dear_inventory-ruby/docs/resources/purchase.md)
61
+ [Advanced Purchase](https://github.com/HashNotAdam/dear_inventory-ruby/docs/resources/advanced_purchase.md)
62
+ [Sale](https://github.com/HashNotAdam/dear_inventory-ruby/docs/resources/sale.md)
63
+
64
+ ## Managing pagination
65
+
66
+ The response object for any endpoint that returns a paginated result set will include helper methods for retrieving the results.
67
+
68
+ ### each
69
+
70
+ `each` iterates over all the records as if they were not paginated, automatically retrieving subsequent pages.
71
+
72
+ ```ruby
73
+ DearInventory::Customer.().each do |record|
74
+ do_some_things(record)
75
+ end
76
+ ```
77
+
78
+ ### next_page
79
+
80
+ If you would like control over the pagination process, the paginated responses include a `next_page` method
81
+
82
+ ```ruby
83
+ response = DearInventory::Customer.()
84
+
85
+ loop do
86
+ do_some_things(response)
87
+ break unless response.next_page?
88
+ response = response.next_page
89
+ end
90
+ ```
91
+
92
+ ## Exceptions
93
+
94
+ Exceptions that occur while making a request to DEAR Inventory should be a subclass of DearInventory::RequestError. These errors include the DearInventory::Response instance which provides some flexibility in your error reporting.
95
+
96
+ ```ruby
97
+ def find_a_sale
98
+ DearInventory::Sale.(id: "incorrect")
99
+ rescue DearInventory::RequestError => e
100
+ message = [
101
+ e.message,
102
+ "URI: #{e.response.request.uri}",
103
+ "Params: #{e.response.request.params.to_h}"
104
+ ]
105
+ ErrorMonitoring.error(message.join("\n"))
106
+ end
107
+ ```
108
+
51
109
  ## Development
52
110
 
53
111
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
54
112
 
55
- 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
56
- git commits and tags, and push the `.gem` file to
57
- [rubygems.org](https://rubygems.org).
113
+ 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).
58
114
 
59
- Since it is necessary to authenticate with DEAR Inventory to test API resources,
60
- credentials are required. The dotenv gem is loaded when tests are run and will
61
- look for a .env file in the root directory. A .env.example file has been
62
- supplied so you copy it to .env and replace the example values:
115
+ Since it is necessary to authenticate with DEAR Inventory to test API resources, credentials are required. The dotenv gem is loaded when tests are run and will look for a .env file in the root directory. A .env.example file has been supplied so you copy it to .env and replace the example values:
63
116
 
64
117
  ```sh
65
118
  cp .env.example .env
@@ -67,8 +120,7 @@ cp .env.example .env
67
120
 
68
121
  ## Contributing
69
122
 
70
- Bug reports and pull requests are welcome on GitHub at https://github.com/HashNotAdam/dear_inventory. This project is intended to be a safe, welcoming
71
- space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
123
+ Bug reports and pull requests are welcome on GitHub at https://github.com/HashNotAdam/dear_inventory. 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.
72
124
 
73
125
  ## License
74
126
 
@@ -32,8 +32,8 @@ Gem::Specification.new do |spec|
32
32
  spec.add_dependency "sorbet-runtime"
33
33
 
34
34
  spec.add_development_dependency "bundler", "~> 2.0"
35
+ spec.add_development_dependency "byebug"
35
36
  spec.add_development_dependency "dotenv"
36
- spec.add_development_dependency "pry-byebug"
37
37
  spec.add_development_dependency "rake", ">= 12.3.3"
38
38
  spec.add_development_dependency "rspec", "~> 3.0"
39
39
  spec.add_development_dependency "rubocop", "~> 0.71"
@@ -0,0 +1,25 @@
1
+ # AdvancedPurchase resource
2
+
3
+ ## Show GET
4
+
5
+ ```ruby
6
+ DearInventory::AdvancedPurchase.show
7
+ ```
8
+
9
+ ### Parameters
10
+
11
+ | Name | Type | Required |
12
+ | --- | --- | --- |
13
+ | id | String | true |
14
+ | combine_additional_charges | Boolean | false |
15
+
16
+ ### Response
17
+
18
+ To see what data is available in the response, you can call the `field` method:
19
+
20
+ ```ruby
21
+ response = DearInventory::AdvancedPurchase.show(id: "abcdef01-2345-6789-abcd-ef0123456789")
22
+ response.fields # [:id, :supplier_id, :supplier, :contact, :phone, :inventory_account, :blind_receipt, :approach, :billing_address, :shipping_address, :base_currency, :supplier_currency, :tax_rule, :tax_calculation, :terms, :required_by, :location, :note, :order_number, :order_date, :combined_receiving_status, :combined_invoice_status, :combined_payment_status, :type, :is_service_only, :status, :related_drop_ship_sale_task, :currency_rate, :last_updated_date, :order, :stock_received, :put_away, :invoice, :credit_note, :manual_journals, :additional_attributes, :attachments, :inventory_movements]
23
+ id = response.id # abcdef01-2345-6789-abcd-ef0123456789
24
+ ```
25
+
@@ -0,0 +1,31 @@
1
+ # Customer resource
2
+
3
+ ## GET
4
+
5
+ ```ruby
6
+ DearInventory::Customer.index
7
+ DearInventory::Customer.()
8
+ ```
9
+
10
+ ### Parameters
11
+ | Name | Type | Required |
12
+ | --- | --- | --- |
13
+ | id | String | false |
14
+ | page | Integer | false |
15
+ | limit | Integer | false |
16
+ | name | String | false |
17
+ | modified_since | DateTime | false |
18
+ | include_deprecated | Boolean | false |
19
+
20
+ ### Response
21
+
22
+ The index endpoint returns a paginated set of records.
23
+
24
+ To see what data is available in the response, you can call the `field` method:
25
+
26
+ ```ruby
27
+ response = DearInventory::Customer.()
28
+ response.fields # [:records, :total, :page, :sale_list]
29
+ records = response.records
30
+ ```
31
+
@@ -0,0 +1,37 @@
1
+ # Product resource
2
+
3
+ ## GET
4
+
5
+ ```ruby
6
+ DearInventory::Product.index
7
+ DearInventory::Product.()
8
+ ```
9
+
10
+ ### Parameters
11
+ | Name | Type | Required |
12
+ | --- | --- | --- |
13
+ | id | String | false |
14
+ | page | Integer | false |
15
+ | limit | Integer | false |
16
+ | name | String | false |
17
+ | sku | String | false |
18
+ | modified_since | DateTime | false |
19
+ | include_attachments | Boolean | false |
20
+ | include_bom | Boolean | false |
21
+ | include_deprecated | Boolean | false |
22
+ | include_movements | Boolean | false |
23
+ | include_reorder_levels | Boolean | false |
24
+ | include_suppliers | Boolean | false |
25
+
26
+ ### Response
27
+
28
+ The index endpoint returns a paginated set of records.
29
+
30
+ To see what data is available in the response, you can call the `field` method:
31
+
32
+ ```ruby
33
+ response = DearInventory::Product.()
34
+ response.fields # [:records, :total, :page, :products]
35
+ records = response.records
36
+ ```
37
+
@@ -0,0 +1,89 @@
1
+ # Purchase resource
2
+
3
+ ## Index GET
4
+
5
+ ```ruby
6
+ DearInventory::Purchase.index
7
+ DearInventory::Purchase.()
8
+ ```
9
+
10
+ ### Parameters
11
+
12
+ | Name | Type | Required |
13
+ | ----------------------- | -------- | -------- |
14
+ | page | Integer | false |
15
+ | limit | Integer | false |
16
+ | search | String | false |
17
+ | required_by | DateTime | false |
18
+ | updated_since | DateTime | false |
19
+ | order_status | String | false |
20
+ | restock_received_status | String | false |
21
+ | invoice_status | String | false |
22
+ | credit_note_status | String | false |
23
+ | unstock_status | String | false |
24
+ | status | String | false |
25
+ | drop_ship_task_id | String | false |
26
+
27
+ ### Response
28
+
29
+ The index endpoint returns a paginated set of purchase summary records. If you would like to load the full purchase, you can either use the helper method, `full_record`, or call the appropriate resource directly, keeping in mind that Simple and Advanced/Service purchases have different resources... because DEAR :shrug:
30
+
31
+ ```ruby
32
+ DearInventory::Purchase.().records.each do |purchase_summary|
33
+ purchase = purchase_summary.full_record
34
+ end
35
+ ```
36
+
37
+ ```ruby
38
+ DearInventory::Purchase.().records.each do |purchase_summary|
39
+ purchase =
40
+ case purchase_summary.type
41
+ when "Advanced Purchase", "Service Purchase"
42
+ DearInventory::AdvancedPurchase.show(id: purchase_summary.id)
43
+ else
44
+ DearInventory::Purchase.show(id: purchase_summary.id)
45
+ end
46
+ end
47
+ ```
48
+
49
+ If you use the `each` helper method, it will automatically return the full record each time. Given it makes n+1 API requests, the time per iteration will be a lot slower than iterating over `records` directly, however, it's much nicer if you intend to load every record anway.
50
+
51
+ ```ruby
52
+ DearInventory::Purchase.().each do |purchase|
53
+ so_stuff_with_the_full_purchase_record(purchase)
54
+ end
55
+ ```
56
+
57
+ To see what data is available in the response, you can call the `field` method:
58
+
59
+ ```ruby
60
+ response = DearInventory::Purchase.()
61
+ response.fields # [:records, :total, :page, :purchases]
62
+ records = response.records
63
+ ```
64
+
65
+
66
+
67
+ ## Show GET
68
+
69
+ ```ruby
70
+ DearInventory::Purchase.show
71
+ ```
72
+
73
+ ### Parameters
74
+
75
+ | Name | Type | Required |
76
+ | --- | --- | --- |
77
+ | id | String | true |
78
+ | combine_additional_charges | Boolean | false |
79
+
80
+ ### Response
81
+
82
+ To see what data is available in the response, you can call the `field` method:
83
+
84
+ ```ruby
85
+ response = DearInventory::Purchase.show(id: "abcdef01-2345-6789-abcd-ef0123456789")
86
+ response.fields # [:id, :supplier_id, :supplier, :contact, :phone, :inventory_account, :blind_receipt, :approach, :billing_address, :shipping_address, :base_currency, :supplier_currency, :tax_rule, :tax_calculation, :terms, :required_by, :location, :note, :order_number, :order_date, :status, :related_drop_ship_sale_task, :currency_rate, :last_updated_date, :order, :stock_received, :invoice, :credit_note, :manual_journals, :additional_attributes, :attachments, :inventory_movements]
87
+ id = response.id # abcdef01-2345-6789-abcd-ef0123456789
88
+ ```
89
+
@@ -0,0 +1,89 @@
1
+ # Sale resource
2
+
3
+ ## Index GET
4
+
5
+ ```ruby
6
+ DearInventory::Sale.index
7
+ DearInventory::Sale.()
8
+ ```
9
+
10
+ ### Parameters
11
+
12
+ | Name | Type | Required |
13
+ | ----------------------- | -------- | -------- |
14
+ | page | Integer | false |
15
+ | limit | Integer | false |
16
+ | search | String | false |
17
+ | created_since | DateTime | false |
18
+ | updated_since | DateTime | false |
19
+ | ship_by | DateTime | false |
20
+ | quote_status | String | false |
21
+ | order_status | String | false |
22
+ | combined_invoice_status | String | false |
23
+ | combined_pick_status | String | false |
24
+ | combined_pack_status | String | false |
25
+ | combined_shipp_status | String | false |
26
+ | credit_note_status | String | false |
27
+ | external_id | String | false |
28
+ | status | String | false |
29
+ | ready_for_shipping | Boolean | false |
30
+
31
+ ### Response
32
+
33
+ The index endpoint returns a paginated set of sale summary records. If you would like to load the full purchase, you can either use the helper method, `full_record`, or call `DearInventory::Sale.show` resource.
34
+
35
+ ```ruby
36
+ DearInventory::Sale.().records.each do |sale_summary|
37
+ sale = sale_summary.full_record
38
+ end
39
+ ```
40
+
41
+ ```ruby
42
+ DearInventory::Sale.().records.each do |sale_summary|
43
+ sale = DearInventory::Sale.show(id: sale_summary.id)
44
+ end
45
+ ```
46
+
47
+ If you use the `each` helper method, it will automatically return the full record each time. Given it makes n+1 API requests, the time per iteration will be a lot slower than iterating over `records` directly, however, it's much nicer if you intend to load every record anway.
48
+
49
+ ```ruby
50
+ DearInventory::Sale.().each do |sale|
51
+ so_stuff_with_the_full_sale_record(sale)
52
+ end
53
+ ```
54
+
55
+ To see what data is available in the response, you can call the `field` method:
56
+
57
+ ```ruby
58
+ response = DearInventory::Sale.()
59
+ response.fields # [:records, :total, :page, :sales]
60
+ records = response.records
61
+ ```
62
+
63
+
64
+
65
+ ## Show GET
66
+
67
+ ```ruby
68
+ DearInventory::Sale.show
69
+ ```
70
+
71
+ ### Parameters
72
+
73
+ | Name | Type | Required |
74
+ | --- | --- | --- |
75
+ | id | String | true |
76
+ | combine_additional_charges | Boolean | false |
77
+ | hide_inventory_movements | Boolean | false |
78
+ | include_transactions | Boolean | false |
79
+
80
+ ### Response
81
+
82
+ To see what data is available in the response, you can call the `field` method:
83
+
84
+ ```ruby
85
+ response = DearInventory::Sale.show(id: "abcdef01-2345-6789-abcd-ef0123456789")
86
+ response.fields # [:id, :customer, :customer_id, :contact, :phone, :email, :default_account, :skip_quote, :billing_address, :shipping_address, :base_currency, :customer_currency, :tax_rule, :tax_calculation, :terms, :price_tier, :ship_by, :location, :sale_order_date, :last_modified_on, :note, :customer_reference, :cogs_amount, :status, :combined_picking_status, :combined_packing_status, :combined_shipping_status, :fulfilment_status, :combined_invoice_status, :combined_payment_status, :combined_tracking_numbers, :carrier, :currency_rate, :sales_representative, :type, :source_channel, :external_id, :service_only, :quote, :order, :fulfilments, :invoices, :credit_notes, :manual_journals, :additional_attributes, :attachments, :inventory_movements, :transactions]
87
+ id = response.id # abcdef01-2345-6789-abcd-ef0123456789
88
+ ```
89
+