netsuite 0.8.2 → 0.8.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (143) hide show
  1. checksums.yaml +5 -5
  2. data/.gitignore +1 -0
  3. data/.ruby-version +1 -1
  4. data/.tool-versions +1 -0
  5. data/Gemfile +4 -3
  6. data/README.md +129 -38
  7. data/circle.yml +36 -13
  8. data/lib/netsuite.rb +40 -19
  9. data/lib/netsuite/actions/login.rb +20 -1
  10. data/lib/netsuite/actions/search.rb +1 -6
  11. data/lib/netsuite/actions/update.rb +6 -2
  12. data/lib/netsuite/actions/update_list.rb +109 -0
  13. data/lib/netsuite/actions/upsert.rb +2 -0
  14. data/lib/netsuite/configuration.rb +34 -4
  15. data/lib/netsuite/errors.rb +1 -0
  16. data/lib/netsuite/records/accounting_period.rb +2 -2
  17. data/lib/netsuite/records/assembly_build.rb +4 -1
  18. data/lib/netsuite/records/assembly_item.rb +1 -0
  19. data/lib/netsuite/records/assembly_unbuild.rb +3 -0
  20. data/lib/netsuite/records/bin_number.rb +18 -0
  21. data/lib/netsuite/records/bin_number_list.rb +1 -20
  22. data/lib/netsuite/records/bin_transfer.rb +38 -0
  23. data/lib/netsuite/records/bin_transfer_inventory.rb +20 -0
  24. data/lib/netsuite/records/bin_transfer_inventory_list.rb +10 -0
  25. data/lib/netsuite/records/cash_refund_item.rb +1 -1
  26. data/lib/netsuite/records/classification.rb +5 -2
  27. data/lib/netsuite/records/contact.rb +1 -1
  28. data/lib/netsuite/records/credit_memo.rb +1 -1
  29. data/lib/netsuite/records/custom_field_list.rb +10 -2
  30. data/lib/netsuite/records/custom_record.rb +3 -3
  31. data/lib/netsuite/records/custom_record_ref.rb +1 -0
  32. data/lib/netsuite/records/customer.rb +5 -4
  33. data/lib/netsuite/records/customer_credit_cards.rb +36 -0
  34. data/lib/netsuite/records/customer_credit_cards_list.rb +10 -0
  35. data/lib/netsuite/records/customer_deposit.rb +9 -6
  36. data/lib/netsuite/records/customer_payment.rb +6 -2
  37. data/lib/netsuite/records/customer_payment_credit.rb +17 -0
  38. data/lib/netsuite/records/customer_payment_credit_list.rb +12 -0
  39. data/lib/netsuite/records/customer_sales_team.rb +24 -0
  40. data/lib/netsuite/records/customer_sales_team_list.rb +9 -0
  41. data/lib/netsuite/records/customer_status.rb +29 -0
  42. data/lib/netsuite/records/customer_subscription.rb +18 -0
  43. data/lib/netsuite/records/customer_subscriptions_list.rb +10 -0
  44. data/lib/netsuite/records/employee.rb +1 -1
  45. data/lib/netsuite/records/entity_custom_field.rb +53 -0
  46. data/lib/netsuite/records/estimate.rb +42 -0
  47. data/lib/netsuite/records/estimate_item.rb +40 -0
  48. data/lib/netsuite/records/estimate_item_list.rb +11 -0
  49. data/lib/netsuite/records/inbound_shipment.rb +33 -0
  50. data/lib/netsuite/records/inbound_shipment_item.rb +39 -0
  51. data/lib/netsuite/records/inbound_shipment_item_list.rb +11 -0
  52. data/lib/netsuite/records/inter_company_journal_entry.rb +48 -0
  53. data/lib/netsuite/records/inter_company_journal_entry_line.rb +28 -0
  54. data/lib/netsuite/records/inter_company_journal_entry_line_list.rb +14 -0
  55. data/lib/netsuite/records/inventory_item.rb +3 -2
  56. data/lib/netsuite/records/invoice.rb +1 -1
  57. data/lib/netsuite/records/item_fulfillment.rb +1 -1
  58. data/lib/netsuite/records/lot_numbered_inventory_item.rb +116 -0
  59. data/lib/netsuite/records/matrix_option_list.rb +12 -4
  60. data/lib/netsuite/records/message.rb +30 -0
  61. data/lib/netsuite/records/non_inventory_resale_item.rb +3 -2
  62. data/lib/netsuite/records/non_inventory_sale_item.rb +1 -1
  63. data/lib/netsuite/records/other_charge_sale_item.rb +2 -2
  64. data/lib/netsuite/records/partner.rb +7 -5
  65. data/lib/netsuite/records/price.rb +17 -0
  66. data/lib/netsuite/records/price_level.rb +26 -0
  67. data/lib/netsuite/records/price_list.rb +9 -0
  68. data/lib/netsuite/records/pricing.rb +20 -0
  69. data/lib/netsuite/records/pricing_matrix.rb +2 -2
  70. data/lib/netsuite/records/promotions.rb +26 -0
  71. data/lib/netsuite/records/promotions_list.rb +9 -0
  72. data/lib/netsuite/records/return_authorization_item.rb +1 -1
  73. data/lib/netsuite/records/sales_order.rb +1 -0
  74. data/lib/netsuite/records/sales_order_item.rb +12 -5
  75. data/lib/netsuite/records/sales_role.rb +26 -0
  76. data/lib/netsuite/records/sales_tax_item.rb +3 -1
  77. data/lib/netsuite/records/serialized_assembly_item.rb +239 -0
  78. data/lib/netsuite/records/service_resale_item.rb +1 -1
  79. data/lib/netsuite/records/service_sale_item.rb +1 -1
  80. data/lib/netsuite/records/support_case.rb +1 -1
  81. data/lib/netsuite/records/support_case_type.rb +26 -0
  82. data/lib/netsuite/records/tax_group.rb +2 -2
  83. data/lib/netsuite/records/transaction_body_custom_field.rb +61 -0
  84. data/lib/netsuite/records/transaction_column_custom_field.rb +59 -0
  85. data/lib/netsuite/records/vendor.rb +2 -1
  86. data/lib/netsuite/records/vendor_credit.rb +2 -0
  87. data/lib/netsuite/records/vendor_currency.rb +26 -0
  88. data/lib/netsuite/records/vendor_currency_list.rb +9 -0
  89. data/lib/netsuite/records/work_order.rb +8 -0
  90. data/lib/netsuite/support/actions.rb +2 -0
  91. data/lib/netsuite/support/country.rb +27 -15
  92. data/lib/netsuite/support/search_result.rb +20 -5
  93. data/lib/netsuite/utilities.rb +83 -21
  94. data/lib/netsuite/version.rb +1 -1
  95. data/netsuite.gemspec +4 -3
  96. data/spec/netsuite/actions/login_spec.rb +23 -0
  97. data/spec/netsuite/actions/update_list_spec.rb +107 -0
  98. data/spec/netsuite/actions/update_spec.rb +42 -0
  99. data/spec/netsuite/configuration_spec.rb +111 -6
  100. data/spec/netsuite/records/address_spec.rb +10 -0
  101. data/spec/netsuite/records/basic_record_spec.rb +19 -2
  102. data/spec/netsuite/records/bin_number_spec.rb +23 -0
  103. data/spec/netsuite/records/classification_spec.rb +10 -1
  104. data/spec/netsuite/records/custom_field_list_spec.rb +39 -4
  105. data/spec/netsuite/records/custom_record_spec.rb +1 -1
  106. data/spec/netsuite/records/customer_credit_cards_list_spec.rb +23 -0
  107. data/spec/netsuite/records/customer_payment_credit_list_spec.rb +26 -0
  108. data/spec/netsuite/records/customer_payment_spec.rb +1 -6
  109. data/spec/netsuite/records/customer_sales_team_list_spec.rb +41 -0
  110. data/spec/netsuite/records/customer_spec.rb +44 -2
  111. data/spec/netsuite/records/customer_subscription_spec.rb +41 -0
  112. data/spec/netsuite/records/customer_subscriptions_list_spec.rb +19 -0
  113. data/spec/netsuite/records/employee_spec.rb +2 -2
  114. data/spec/netsuite/records/entity_custom_field_spec.rb +34 -0
  115. data/spec/netsuite/records/estimate_item_list_spec.rb +26 -0
  116. data/spec/netsuite/records/estimate_item_spec.rb +40 -0
  117. data/spec/netsuite/records/estimate_spec.rb +216 -0
  118. data/spec/netsuite/records/inter_company_journal_entry_line_list_spec.rb +26 -0
  119. data/spec/netsuite/records/inter_company_journal_entry_line_spec.rb +60 -0
  120. data/spec/netsuite/records/inter_company_journal_entry_spec.rb +156 -0
  121. data/spec/netsuite/records/inventory_item_spec.rb +57 -0
  122. data/spec/netsuite/records/matrix_option_list_spec.rb +15 -5
  123. data/spec/netsuite/records/message_spec.rb +49 -0
  124. data/spec/netsuite/records/non_inventory_resale_item_spec.rb +165 -0
  125. data/spec/netsuite/records/non_inventory_sale_item_spec.rb +1 -1
  126. data/spec/netsuite/records/partner_spec.rb +143 -0
  127. data/spec/netsuite/records/price_level_spec.rb +16 -0
  128. data/spec/netsuite/records/pricing_matrix_spec.rb +15 -13
  129. data/spec/netsuite/records/return_authorization_item_spec.rb +1 -1
  130. data/spec/netsuite/records/sales_order_item_spec.rb +11 -5
  131. data/spec/netsuite/records/service_resale_item_spec.rb +134 -0
  132. data/spec/netsuite/records/support_case_type_spec.rb +22 -0
  133. data/spec/netsuite/records/transaction_body_custom_field_spec.rb +32 -0
  134. data/spec/netsuite/records/transaction_column_custom_field_spec.rb +32 -0
  135. data/spec/netsuite/records/vendor_credit_spec.rb +29 -0
  136. data/spec/netsuite/records/vendor_spec.rb +1 -1
  137. data/spec/netsuite/support/search_result_spec.rb +24 -0
  138. data/spec/netsuite/utilities_spec.rb +44 -6
  139. data/spec/spec_helper.rb +5 -4
  140. data/spec/support/fixtures/update_list/update_list_items.xml +22 -0
  141. data/spec/support/fixtures/update_list/update_list_one_item.xml +18 -0
  142. data/spec/support/fixtures/update_list/update_list_with_errors.xml +32 -0
  143. metadata +111 -11
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 797165a82ff004915fd35446c562b168fef1d8a8
4
- data.tar.gz: 361bb3b3119d401e475df8c89e32a4c943b4f3eb
2
+ SHA256:
3
+ metadata.gz: dbeff776d5c83998c7a1f32ede92f9dc5e23dc9779edb7f468c9069f78d45e2c
4
+ data.tar.gz: ae0a8d348549c9bfbdd069b2430ceb14d4d9934e5f3af32a2b9cfd4841c7a03b
5
5
  SHA512:
6
- metadata.gz: c91ea28fb5fe26b22bfb01fa5db2006cc18cfe7c2a6957cfe87d3b08b2a734ea091bbfccd2f430eb1ceb7cc8f95c809f67feb451c4ae7681c4f4de236e752fec
7
- data.tar.gz: 5d70ad8c9b507230a4f2a7db2a114eb15ea92d46801d84d89de7b002adf1f65f75e4698f869ddb6a59b570a994896b15b42ce90088e78548850581a46e0670ec
6
+ metadata.gz: e832952fe6eba8acb9f2126d6bc378a534a7d081c0f0007c995eebb9d4fe6c11e16a4a5ed8cacfb9135f2e4309d74ffa8535cb6e5825606788f9acff7f980e7b
7
+ data.tar.gz: 104588f1bba07662f374d67940ff06fb0cb9b8ffc30cebf402791113d2d8eda023812978025a07dfabd1677108228d6810564c5638fd87cffb1bbc4bb7c04c7b
data/.gitignore CHANGED
@@ -16,3 +16,4 @@ test/tmp
16
16
  test/version_tmp
17
17
  tmp
18
18
  vendor/
19
+ .tags*
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.3.0
1
+ 2.7.3
data/.tool-versions ADDED
@@ -0,0 +1 @@
1
+ ruby 2.7.3
data/Gemfile CHANGED
@@ -2,10 +2,11 @@ source 'https://rubygems.org'
2
2
  gemspec
3
3
 
4
4
  gem 'simplecov', :require => false
5
+ gem 'rspec_junit_formatter'
5
6
 
6
7
  gem 'pry-nav'
7
8
  gem 'pry-rescue'
8
9
 
9
- # required for CircleCI to build properly with ruby 1.9.3
10
- gem 'json', '~> 1.8.3'
11
- gem 'rack', '~> 1.6.4'
10
+ # optional dependency for more accurate timezone conversion
11
+ gem 'tzinfo', '1.2.5'
12
+ # gem 'tzinfo', '2.0.0'
data/README.md CHANGED
@@ -1,34 +1,50 @@
1
- [![Circle CI](https://circleci.com/gh/NetSweet/netsuite/tree/master.svg?style=svg)](https://circleci.com/gh/NetSweet/netsuite/tree/master)
2
- [![Slack Status](https://opensuite-slackin.herokuapp.com/badge.svg)](http://opensuite-slackin.herokuapp.com)
3
- [![Gem Version](https://badge.fury.io/rb/netsuite.svg)](http://badge.fury.io/rb/netsuite)
4
- [![Dependency Status](https://gemnasium.com/roidrage/lograge.svg)](https://gemnasium.com/netsweet/netsuite)
5
-
6
- # NetSuite Ruby SuiteTalk API Gem
1
+ <!-- START doctoc generated TOC please keep comment here to allow auto update -->
2
+ <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
3
+ **Table of Contents**
4
+
5
+ - [NetSuite SuiteTalk API Ruby Gem](#netsuite-suitetalk-api-ruby-gem)
6
+ - [Help & Support](#help--support)
7
+ - [Testing](#testing)
8
+ - [Installation](#installation)
9
+ - [Configuration](#configuration)
10
+ - [Token based Authentication](#token-based-authentication)
11
+ - [Usage](#usage)
12
+ - [CRUD Operations](#crud-operations)
13
+ - [Custom Records & Fields](#custom-records--fields)
14
+ - [Searching](#searching)
15
+ - [Non-standard Operations](#non-standard-operations)
16
+
17
+ <!-- END doctoc generated TOC please keep comment here to allow auto update -->
18
+
19
+ [![Circle CI](https://circleci.com/gh/NetSweet/netsuite/tree/master.svg?style=svg)](https://circleci.com/gh/NetSweet/netsuite/tree/master)
20
+ [![Slack Status](https://opensuite-slackin.herokuapp.com/badge.svg)](http://opensuite-slackin.herokuapp.com)
21
+ [![Gem Version](https://badge.fury.io/rb/netsuite.svg)](http://badge.fury.io/rb/netsuite)
22
+
23
+ # NetSuite SuiteTalk API Ruby Gem
7
24
 
8
25
  * This gem will act as a wrapper around the NetSuite SuiteTalk WebServices API.
9
- * The gem does not cover the entire API, only the subset contributors have used so far.
10
- * NetSuite is a huge complex system. There's a lot to learn and sparse resources available to learn from. Here's a list of [NetSuite Development Resources](https://github.com/NetSweet/netsuite/wiki/NetSuite-Development-Resources) that might make things a bit less painful.
26
+ * The gem does not cover the entire API, only the subset contributors have used so far. Please submit a PR for any functionality that's missing!
27
+ * NetSuite is a complex system. There's a lot to learn and sparse resources available to learn from. Here's a list of [NetSuite Development Resources](https://github.com/NetSweet/netsuite/wiki/NetSuite-Development-Resources).
11
28
 
12
29
  # Help & Support
13
30
 
14
- Join the [slack channel](http://opensuite-slackin.herokuapp.com) for help with any NetSuite issues.
31
+ Join the [slack channel](http://opensuite-slackin.herokuapp.com) for help with any NetSuite issues. Please do not post usage questions as issues in GitHub.
15
32
 
16
- Please do not post usage questions as issues in GitHub.
33
+ There is some additional helpful resources for NetSuite development [listed here](https://dashboard.suitesync.io/docs/resources#netsuite).
17
34
 
18
- ## Testing
35
+ # Testing
19
36
 
20
37
  Before contributing a patch make sure all existing tests pass.
21
38
 
22
- ```
39
+ ```shell
23
40
  git clone git://github.com/NetSweet/netsuite.git
24
41
  cd netsuite
42
+
25
43
  bundle
26
44
  bundle exec rspec
27
45
  ```
28
46
 
29
- ## Usage
30
-
31
- ### Installation
47
+ # Installation
32
48
 
33
49
  Add this line to your application's Gemfile:
34
50
 
@@ -36,41 +52,89 @@ Add this line to your application's Gemfile:
36
52
  gem 'netsuite'
37
53
  ```
38
54
 
39
- This gem is built for ruby 1.9.x+, checkout the [1-8-stable](https://github.com/NetSweet/netsuite/tree/1-8-stable) branch for ruby 1.8.x support.
55
+ If you'd like more accurate time conversion support, include the `tzinfo` gem.
56
+
57
+ This gem is built for ruby 2.6.x+, but should work on older versions down to 1.9. There's a [1-8-stable](https://github.com/NetSweet/netsuite/tree/1-8-stable) branch for ruby 1.8.x support.
40
58
 
41
- ### Configuration
59
+ ## Configuration
42
60
 
43
- Not sure how to find your account id? Search for "web service preferences" in the NetSuite global search.
61
+ The most important thing you'll need is your NetSuite account ID. Not sure how to find your account id? [Here's a guide.](http://mikebian.co/find-netsuite-web-services-account-number/)
62
+
63
+ How you connect to NetSuite has changed a lot over the years and differs between API versions. For instance:
64
+
65
+ * Older API versions (~2015) allowed authentication via username and password
66
+ * Newever API versions (> 2016) still allowed for username and password authentication, but required an application ID
67
+ * "OAuth", which requires four separate keys to be manually generated, was supported sometime after 2015
68
+ * API versions greater than 2018_2 require `endpoint` to be set directly ([more info](https://github.com/NetSweet/netsuite/pull/473))
69
+
70
+ Here's an example connection configuration. You don't want to actually use username + password config; token based authentication is detailed below in a separate section:
44
71
 
45
72
  ```ruby
46
73
  NetSuite.configure do
47
74
  reset!
48
75
 
49
- # optional, defaults to 2011_2
50
- api_version '2012_1'
76
+ # production & sandbox account numbers will differ
77
+ account 'TSTDRV1576318'
78
+ api_version '2018_2'
79
+
80
+ # password-based login information
81
+ # in most cases you should use token based authentication instead
82
+ email 'email@example.com'
83
+ password 'password'
84
+ role 10
85
+
86
+ # recent API versions require a account-specific endpoint o be set
87
+ # use `NetSuite::Utilities.data_center_url('TSTDRV1576318')` to retrieve wsdl URL
88
+ # you'll want to do this in a background process and strip the protocol out of the return string
89
+ wsdl_domain 'tstdrv1576318.suitetalk.api.netsuite.com'
90
+
91
+ # the endpoint indicated in the > 2018_2 wsdl is invalid
92
+ # you must set the endpoint directly
93
+ # https://github.com/NetSweet/netsuite/pull/473
94
+ endpoint "#{wsdl_domain}/services/NetSuitePort_#{api_version}"
95
+ end
96
+ ```
97
+
98
+ The `wsdl_domain` configuration is most important. Note that if you use `wsdl` or other configuration options below, you'll want to look at the configuration source to understand more about how the different options interact with each other. Some of the configuration options will mutate the state of other options.
99
+
100
+ Here's the various options that are are available for configuration:
101
+
102
+ ```ruby
103
+ NetSuite.configure do
104
+ reset!
105
+
106
+ api_version '2018_2'
51
107
 
52
108
  # optionally specify full wsdl URL (to switch to sandbox, for example)
53
109
  wsdl "https://webservices.sandbox.netsuite.com/wsdl/v#{api_version}_0/netsuite.wsdl"
54
110
 
55
111
  # if your datacenter is being switched, you'll have to manually set your wsdl location
56
- wsdl "https://webservices.na2.netsuite.com/wsdl/v#{api_version}_0/netsuite.wsdl"
112
+ wsdl "https://webservices.na2.netsuite.com/wsdl/v#{api_version}_0/netsuite.wsdl"
57
113
 
58
- # or specify the sandbox flag if you don't want to deal with specifying a full URL
59
- sandbox true
114
+ # or specify the wsdl_domain if you want to specify the datacenter and let the configuration
115
+ # construct the full wsdl location - e.g. "https://#{wsdl_domain}/wsdl/v#{api_version}_0/netsuite.wsdl"
116
+ wsdl_domain "webservices.na2.netsuite.com"
60
117
 
61
118
  # often the netsuite servers will hang which would cause a timeout exception to be raised
62
- # if you don't mind waiting (e.g. processing NS via DJ), increasing the timeout should fix the issue
63
- read_timeout 100000
119
+ # if you don't mind waiting (e.g. processing NS via a background worker), increasing the timeout should fix the issue
120
+ read_timeout 100_000
64
121
 
65
122
  # you can specify a file or file descriptor to send the log output to (defaults to STDOUT)
123
+ # If using within a Rails app, consider setting to `Rails.logger` to leverage existing
124
+ # application-level log configuration
66
125
  log File.join(Rails.root, 'log/netsuite.log')
67
126
 
68
- # login information
69
- email 'email@domain.com'
70
- password 'password'
127
+ # Defaults to :debug level logging for Savon API calls. Decrease the verbosity
128
+ # by setting log_level to `:info`, for example
129
+ # log_level :debug
130
+
131
+ # password-based login information
132
+ # in most cases you should use token based authentication instead
133
+ email 'email@domain.com'
134
+ password 'password'
71
135
  account '12345'
72
- role 1111
73
-
136
+ role 1111
137
+
74
138
  # optional, ensures that read-only fields don't cause API errors
75
139
  soap_header 'platformMsgs:preferences' => {
76
140
  'platformMsgs:ignoreReadOnlyFields' => true,
@@ -78,9 +142,9 @@ NetSuite.configure do
78
142
  end
79
143
  ```
80
144
 
81
- If you'd like to use a API endpoints greater than 2015_1 you'll need to specify an application ID:
145
+ If are using username + password authentication (which you shouldn't be!) *and* you'd like to use a API endpoints greater than 2015_1 you'll need to specify an application ID:
82
146
 
83
- ```
147
+ ```ruby
84
148
  NetSuite::Configuration.soap_header = {
85
149
  'platformMsgs:ApplicationInfo' => {
86
150
  'platformMsgs:applicationId' => 'your-netsuite-app-id'
@@ -88,7 +152,9 @@ NetSuite::Configuration.soap_header = {
88
152
  }
89
153
  ```
90
154
 
91
- OAuth credentials are also supported. [Learn more about how to set up token based authentication here](http://mikebian.co/using-netsuites-token-based-authentication-with-suitetalk/).
155
+ ### Token based Authentication
156
+
157
+ OAuth credentials are supported and the recommended authentication approach. [Learn more about how to set up token based authentication here](http://mikebian.co/using-netsuites-token-based-authentication-with-suitetalk/).
92
158
 
93
159
  ```ruby
94
160
  NetSuite.configure do
@@ -103,12 +169,17 @@ NetSuite.configure do
103
169
 
104
170
  # oauth does not work with API versions less than 2015_2
105
171
  api_version '2016_2'
172
+
173
+ # the endpoint indicated in the > 2018_2 wsdl is invalid
174
+ # you must set the endpoint directly
175
+ # https://github.com/NetSweet/netsuite/pull/473
176
+ endpoint "#{wsdl_domain}/services/NetSuitePort_#{api_version}"
106
177
  end
107
178
  ```
108
179
 
109
- ### Examples
180
+ # Usage
110
181
 
111
- #### CRUD Operations
182
+ ## CRUD Operations
112
183
 
113
184
  ```ruby
114
185
  # get a customer
@@ -167,7 +238,7 @@ options = NetSuite::Records::BaseRefList.get_select_value(
167
238
  options.base_refs.map(&:name)
168
239
  ```
169
240
 
170
- #### Custom Records & Fields
241
+ ## Custom Records & Fields
171
242
 
172
243
  ```ruby
173
244
  # updating a custom field list on a record
@@ -218,7 +289,7 @@ NetSuite::Records::BaseRefList.get_select_value(
218
289
  )
219
290
  ```
220
291
 
221
- #### Searching
292
+ ## Searching
222
293
 
223
294
  ```ruby
224
295
  # basic search
@@ -379,6 +450,26 @@ NetSuite::Records::SalesOrder.search({
379
450
  }
380
451
  }).results
381
452
 
453
+ # Search for SalesOrder records with a "Pending Approval" status using the TransactionStatus enum value.
454
+ # https://system.netsuite.com/help/helpcenter/en_US/srbrowser/Browser2016_2/schema/enum/transactionstatus.html
455
+
456
+ NetSuite::Records::SalesOrder.search(
457
+ criteria: {
458
+ basic: [
459
+ {
460
+ field: 'type',
461
+ operator: 'anyOf',
462
+ value: ['_salesOrder'],
463
+ },
464
+ {
465
+ field: 'status',
466
+ operator: 'anyOf',
467
+ value: ['_salesOrderPendingApproval'],
468
+ },
469
+ ],
470
+ },
471
+ )
472
+
382
473
  NetSuite::Records::ItemFulfillment.search({
383
474
  criteria: {
384
475
  basic: [
@@ -502,7 +593,7 @@ deposit.payment = 20
502
593
  deposit.add
503
594
  ```
504
595
 
505
- #### Non-standard Operations
596
+ ## Non-standard Operations
506
597
 
507
598
  ```ruby
508
599
  # making a call that hasn't been implemented yet
data/circle.yml CHANGED
@@ -1,16 +1,39 @@
1
- # https://leonid.shevtsov.me/post/multiple-rubies-on-circleci/
1
+ version: 2.1
2
2
 
3
- machine:
4
- environment:
5
- RUBY_VERSIONS: 2.0.0,2.1.10,2.2.5,2.3.1,2.4.0
3
+ orbs:
4
+ # orbs are basically bundles of pre-written build scripts that work for common cases
5
+ # https://github.com/CircleCI-Public/ruby-orb
6
+ ruby: circleci/ruby@1.1.2
6
7
 
7
- dependencies:
8
- override:
9
- - rvm get head
10
- - rvm install $RUBY_VERSIONS
11
- - rvm $RUBY_VERSIONS --verbose do gem install bundler
12
- - rvm $RUBY_VERSIONS --verbose do bundle install
8
+ jobs:
9
+ # skipping build step because Gemfile.lock is not included in the source
10
+ # this makes the bundler caching step a noop
11
+ test:
12
+ parameters:
13
+ ruby-version:
14
+ type: string
15
+ docker:
16
+ - image: cimg/ruby:<< parameters.ruby-version >>
17
+ steps:
18
+ - checkout
19
+ - ruby/install-deps:
20
+ bundler-version: '2.1.4'
21
+ with-cache: false
22
+ # without specifying a non-standard path `--deployment` will be used when running bundler
23
+ # which causes the bundler to fail
24
+ path: './vendor/custom_bundle'
25
+ - ruby/rspec-test
13
26
 
14
- test:
15
- override:
16
- - rvm $RUBY_VERSIONS --verbose do bundle exec rspec spec
27
+ # strangely, there seems to be very little documentation about exactly how martix builds work.
28
+ # By defining a param inside your job definition, Circle CI will automatically spawn a job for
29
+ # unique param value passed via `matrix`. Neat!
30
+ # https://circleci.com/blog/circleci-matrix-jobs/
31
+ workflows:
32
+ build_and_test:
33
+ jobs:
34
+ - test:
35
+ matrix:
36
+ parameters:
37
+ # https://github.com/CircleCI-Public/cimg-ruby
38
+ # only supports the last three ruby versions
39
+ ruby-version: ["2.5", "2.6", "2.7"]
data/lib/netsuite.rb CHANGED
@@ -58,6 +58,7 @@ module NetSuite
58
58
  autoload :GetSelectValue, 'netsuite/actions/get_select_value'
59
59
  autoload :Initialize, 'netsuite/actions/initialize'
60
60
  autoload :Update, 'netsuite/actions/update'
61
+ autoload :UpdateList, 'netsuite/actions/update_list'
61
62
  autoload :Upsert, 'netsuite/actions/upsert'
62
63
  autoload :UpsertList, 'netsuite/actions/upsert_list'
63
64
  autoload :Search, 'netsuite/actions/search'
@@ -81,7 +82,11 @@ module NetSuite
81
82
  autoload :BillingScheduleRecurrence, 'netsuite/records/billing_schedule_recurrence'
82
83
  autoload :BillingScheduleRecurrenceList, 'netsuite/records/billing_schedule_recurrence_list'
83
84
  autoload :Bin, 'netsuite/records/bin'
85
+ autoload :BinNumber, 'netsuite/records/bin_number'
84
86
  autoload :BinNumberList, 'netsuite/records/bin_number_list'
87
+ autoload :BinTransfer, 'netsuite/records/bin_transfer'
88
+ autoload :BinTransferInventory, 'netsuite/records/bin_transfer_inventory'
89
+ autoload :BinTransferInventoryList, 'netsuite/records/bin_transfer_inventory_list'
85
90
  autoload :CashSale, 'netsuite/records/cash_sale'
86
91
  autoload :CashSaleItem, 'netsuite/records/cash_sale_item'
87
92
  autoload :CashSaleItemList, 'netsuite/records/cash_sale_item_list'
@@ -107,6 +112,8 @@ module NetSuite
107
112
  autoload :CustomerAddressbook, 'netsuite/records/customer_addressbook'
108
113
  autoload :CustomerAddressbookList, 'netsuite/records/customer_addressbook_list'
109
114
  autoload :CustomerCategory, 'netsuite/records/customer_category'
115
+ autoload :CustomerCreditCards, 'netsuite/records/customer_credit_cards'
116
+ autoload :CustomerCreditCardsList, 'netsuite/records/customer_credit_cards_list'
110
117
  autoload :CustomerCurrency, 'netsuite/records/customer_currency'
111
118
  autoload :CustomerCurrencyList, 'netsuite/records/customer_currency_list'
112
119
  autoload :CustomerDeposit, 'netsuite/records/customer_deposit'
@@ -116,12 +123,20 @@ module NetSuite
116
123
  autoload :CustomerPayment, 'netsuite/records/customer_payment'
117
124
  autoload :CustomerPaymentApply, 'netsuite/records/customer_payment_apply'
118
125
  autoload :CustomerPaymentApplyList, 'netsuite/records/customer_payment_apply_list'
126
+ autoload :CustomerPaymentCredit, 'netsuite/records/customer_payment_credit'
127
+ autoload :CustomerPaymentCreditList, 'netsuite/records/customer_payment_credit_list'
128
+ autoload :CustomerPartner, 'netsuite/records/customer_partner'
119
129
  autoload :CustomerRefund, 'netsuite/records/customer_refund'
120
130
  autoload :CustomerRefundApply, 'netsuite/records/customer_refund_apply'
121
131
  autoload :CustomerRefundApplyList, 'netsuite/records/customer_refund_apply_list'
122
132
  autoload :CustomerRefundDeposit, 'netsuite/records/customer_refund_deposit'
123
133
  autoload :CustomerRefundDepositList, 'netsuite/records/customer_refund_deposit_list'
134
+ autoload :CustomerSubscription, 'netsuite/records/customer_subscription'
135
+ autoload :CustomerSubscriptionsList, 'netsuite/records/customer_subscriptions_list'
136
+ autoload :CustomerStatus, 'netsuite/records/customer_status'
124
137
  autoload :CustomerPartner, 'netsuite/records/customer_partner'
138
+ autoload :CustomerSalesTeam, 'netsuite/records/customer_sales_team'
139
+ autoload :CustomerSalesTeamList, 'netsuite/records/customer_sales_team_list'
125
140
  autoload :ContactList, 'netsuite/records/contact_list'
126
141
  autoload :Contact, 'netsuite/records/contact'
127
142
  autoload :ContactAddressbook, 'netsuite/records/contact_addressbook'
@@ -144,12 +159,22 @@ module NetSuite
144
159
  autoload :DiscountItem, 'netsuite/records/discount_item'
145
160
  autoload :Duration, 'netsuite/records/duration'
146
161
  autoload :Employee, 'netsuite/records/employee'
162
+ autoload :EntityCustomField, 'netsuite/records/entity_custom_field'
163
+ autoload :Estimate, 'netsuite/records/estimate'
164
+ autoload :EstimateItem, 'netsuite/records/estimate_item'
165
+ autoload :EstimateItemList, 'netsuite/records/estimate_item_list'
147
166
  autoload :File, 'netsuite/records/file'
148
167
  autoload :GiftCertificate, 'netsuite/records/gift_certificate'
149
168
  autoload :GiftCertificateItem, 'netsuite/records/gift_certificate_item'
150
169
  autoload :GiftCertRedemption, 'netsuite/records/gift_cert_redemption'
151
170
  autoload :GiftCertRedemptionList, 'netsuite/records/gift_cert_redemption_list'
152
171
  autoload :Folder, 'netsuite/records/folder'
172
+ autoload :InboundShipment, 'netsuite/records/inbound_shipment'
173
+ autoload :InboundShipmentItem, 'netsuite/records/inbound_shipment_item'
174
+ autoload :InboundShipmentItemList, 'netsuite/records/inbound_shipment_item_list'
175
+ autoload :InterCompanyJournalEntry, 'netsuite/records/inter_company_journal_entry'
176
+ autoload :InterCompanyJournalEntryLine, 'netsuite/records/inter_company_journal_entry_line'
177
+ autoload :InterCompanyJournalEntryLineList, 'netsuite/records/inter_company_journal_entry_line_list'
153
178
  autoload :InventoryAdjustment, 'netsuite/records/inventory_adjustment'
154
179
  autoload :InventoryAdjustmentInventory, 'netsuite/records/inventory_adjustment_inventory'
155
180
  autoload :InventoryAdjustmentInventoryList, 'netsuite/records/inventory_adjustment_inventory_list'
@@ -188,8 +213,10 @@ module NetSuite
188
213
  autoload :Location, 'netsuite/records/location'
189
214
  autoload :LocationsList, 'netsuite/records/locations_list'
190
215
  autoload :LotNumberedAssemblyItem, 'netsuite/records/lot_numbered_assembly_item'
216
+ autoload :LotNumberedInventoryItem, 'netsuite/records/lot_numbered_inventory_item'
191
217
  autoload :MatrixOptionList, 'netsuite/records/matrix_option_list'
192
218
  autoload :MemberList, 'netsuite/records/member_list'
219
+ autoload :Message, 'netsuite/records/message'
193
220
  autoload :NonInventorySaleItem, 'netsuite/records/non_inventory_sale_item'
194
221
  autoload :NonInventoryPurchaseItem, 'netsuite/records/non_inventory_purchase_item'
195
222
  autoload :NonInventoryResaleItem, 'netsuite/records/non_inventory_resale_item'
@@ -204,8 +231,14 @@ module NetSuite
204
231
  autoload :PaymentMethod, 'netsuite/records/payment_method'
205
232
  autoload :PayrollItem, 'netsuite/records/payroll_item'
206
233
  autoload :PhoneCall, 'netsuite/records/phone_call'
234
+ autoload :Price, 'netsuite/records/price'
235
+ autoload :PriceLevel, 'netsuite/records/price_level'
236
+ autoload :PriceList, 'netsuite/records/price_list'
237
+ autoload :Pricing, 'netsuite/records/pricing'
207
238
  autoload :PricingMatrix, 'netsuite/records/pricing_matrix'
208
239
  autoload :PromotionCode, 'netsuite/records/promotion_code'
240
+ autoload :PromotionsList, 'netsuite/records/promotions_list'
241
+ autoload :Promotions, 'netsuite/records/promotions'
209
242
  autoload :PurchaseOrder, 'netsuite/records/purchase_order'
210
243
  autoload :PurchaseOrderItemList, 'netsuite/records/purchase_order_item_list'
211
244
  autoload :PurchaseOrderItem, 'netsuite/records/purchase_order_item'
@@ -222,9 +255,11 @@ module NetSuite
222
255
  autoload :SalesOrderShipGroupList, 'netsuite/records/sales_order_ship_group_list'
223
256
  autoload :SalesOrderItem, 'netsuite/records/sales_order_item'
224
257
  autoload :SalesOrderItemList, 'netsuite/records/sales_order_item_list'
258
+ autoload :SalesRole, 'netsuite/records/sales_role'
225
259
  autoload :SalesTaxItem, 'netsuite/records/sales_tax_item'
226
260
  autoload :ServiceResaleItem, 'netsuite/records/service_resale_item'
227
261
  autoload :ServiceSaleItem, 'netsuite/records/service_sale_item'
262
+ autoload :SerializedAssemblyItem, 'netsuite/records/serialized_assembly_item'
228
263
  autoload :SerializedInventoryItem, 'netsuite/records/serialized_inventory_item'
229
264
  autoload :SerializedInventoryItemNumbers, 'netsuite/records/serialized_inventory_item_numbers'
230
265
  autoload :SerializedInventoryItemNumbersList, 'netsuite/records/serialized_inventory_item_numbers_list'
@@ -235,11 +270,14 @@ module NetSuite
235
270
  autoload :Subsidiary, 'netsuite/records/subsidiary'
236
271
  autoload :SubtotalItem, 'netsuite/records/subtotal_item'
237
272
  autoload :SupportCase, 'netsuite/records/support_case'
273
+ autoload :SupportCaseType, 'netsuite/records/support_case_type'
238
274
  autoload :TaxType, 'netsuite/records/tax_type'
239
275
  autoload :TaxGroup, 'netsuite/records/tax_group'
240
276
  autoload :Task, 'netsuite/records/task'
241
277
  autoload :Term, 'netsuite/records/term'
242
278
  autoload :TimeBill, 'netsuite/records/time_bill'
279
+ autoload :TransactionBodyCustomField, 'netsuite/records/transaction_body_custom_field'
280
+ autoload :TransactionColumnCustomField, 'netsuite/records/transaction_column_custom_field'
243
281
  autoload :TransactionShipGroup, 'netsuite/records/transaction_ship_group'
244
282
  autoload :TransferOrder, 'netsuite/records/transfer_order'
245
283
  autoload :TransferOrderItemList, 'netsuite/records/transfer_order_item_list'
@@ -261,6 +299,8 @@ module NetSuite
261
299
  autoload :VendorCreditItemList, 'netsuite/records/vendor_credit_item_list'
262
300
  autoload :VendorCreditExpense, 'netsuite/records/vendor_credit_expense'
263
301
  autoload :VendorCreditExpenseList, 'netsuite/records/vendor_credit_expense_list'
302
+ autoload :VendorCurrencyList, 'netsuite/records/vendor_currency_list'
303
+ autoload :VendorCurrency, 'netsuite/records/vendor_currency'
264
304
  autoload :VendorReturnAuthorization, 'netsuite/records/vendor_return_authorization'
265
305
  autoload :VendorReturnAuthorizationItem, 'netsuite/records/vendor_return_authorization_item'
266
306
  autoload :VendorReturnAuthorizationItemList, 'netsuite/records/vendor_return_authorization_item_list'
@@ -281,23 +321,4 @@ module NetSuite
281
321
  NetSuite::Configuration.instance_eval(&block)
282
322
  end
283
323
 
284
- def self.configure_from_env(&block)
285
- NetSuite.configure do
286
- reset!
287
-
288
- email ENV['NETSUITE_EMAIL'] unless ENV['NETSUITE_EMAIL'].nil?
289
- password ENV['NETSUITE_PASSWORD'] unless ENV['NETSUITE_PASSWORD'].nil?
290
- account ENV['NETSUITE_ACCOUNT'] unless ENV['NETSUITE_ACCOUNT'].nil?
291
- role ENV['NETSUITE_ROLE'] unless ENV['NETSUITE_ROLE'].nil?
292
- api_version ENV['NETSUITE_API'] unless ENV['NETSUITE_API'].nil?
293
- sandbox (ENV['NETSUITE_PRODUCTION'].nil? || ENV['NETSUITE_PRODUCTION'] != 'true')
294
- wsdl ENV['NETSUITE_WSDL'] unless ENV['NETSUITE_WSDL'].nil?
295
- silent (!ENV['NETSUITE_SILENT'].nil? && ENV['NETSUITE_SILENT'] == 'true')
296
-
297
- read_timeout 100_000
298
- end
299
-
300
- self.configure(&block) if block
301
- end
302
-
303
324
  end