netsuite 0.8.6 → 0.8.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/.tool-versions +1 -0
- data/Gemfile +1 -5
- data/README.md +33 -17
- data/circle.yml +5 -2
- data/lib/netsuite.rb +4 -0
- data/lib/netsuite/configuration.rb +13 -0
- data/lib/netsuite/records/accounting_period.rb +2 -2
- data/lib/netsuite/records/contact.rb +1 -1
- data/lib/netsuite/records/credit_memo.rb +1 -1
- data/lib/netsuite/records/customer_deposit.rb +5 -5
- data/lib/netsuite/records/customer_payment.rb +5 -2
- data/lib/netsuite/records/customer_payment_credit.rb +17 -0
- data/lib/netsuite/records/customer_payment_credit_list.rb +12 -0
- data/lib/netsuite/records/inventory_item.rb +2 -1
- data/lib/netsuite/records/partner.rb +7 -5
- data/lib/netsuite/records/vendor.rb +2 -1
- data/lib/netsuite/records/vendor_currency.rb +26 -0
- data/lib/netsuite/records/vendor_currency_list.rb +9 -0
- data/lib/netsuite/version.rb +1 -1
- data/spec/netsuite/configuration_spec.rb +32 -0
- data/spec/netsuite/records/basic_record_spec.rb +8 -1
- data/spec/netsuite/records/customer_payment_credit_list_spec.rb +26 -0
- data/spec/netsuite/records/customer_payment_spec.rb +1 -6
- data/spec/netsuite/records/partner_spec.rb +6 -4
- data/spec/netsuite/records/vendor_spec.rb +1 -1
- metadata +13 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dbeff776d5c83998c7a1f32ede92f9dc5e23dc9779edb7f468c9069f78d45e2c
|
4
|
+
data.tar.gz: ae0a8d348549c9bfbdd069b2430ceb14d4d9934e5f3af32a2b9cfd4841c7a03b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e832952fe6eba8acb9f2126d6bc378a534a7d081c0f0007c995eebb9d4fe6c11e16a4a5ed8cacfb9135f2e4309d74ffa8535cb6e5825606788f9acff7f980e7b
|
7
|
+
data.tar.gz: 104588f1bba07662f374d67940ff06fb0cb9b8ffc30cebf402791113d2d8eda023812978025a07dfabd1677108228d6810564c5638fd87cffb1bbc4bb7c04c7b
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.7.3
|
data/.tool-versions
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
ruby 2.7.3
|
data/Gemfile
CHANGED
@@ -9,8 +9,4 @@ gem 'pry-rescue'
|
|
9
9
|
|
10
10
|
# optional dependency for more accurate timezone conversion
|
11
11
|
gem 'tzinfo', '1.2.5'
|
12
|
-
# gem 'tzinfo', '2.0.0'
|
13
|
-
|
14
|
-
# required for CircleCI to build properly with ruby 1.9.3
|
15
|
-
gem 'json', '~> 2.3.0'
|
16
|
-
gem 'rack', '~> 2.1.4'
|
12
|
+
# gem 'tzinfo', '2.0.0'
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
|
2
2
|
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
|
3
|
-
**Table of Contents**
|
3
|
+
**Table of Contents**
|
4
4
|
|
5
5
|
- [NetSuite SuiteTalk API Ruby Gem](#netsuite-suitetalk-api-ruby-gem)
|
6
6
|
- [Help & Support](#help--support)
|
@@ -13,7 +13,6 @@
|
|
13
13
|
- [Custom Records & Fields](#custom-records--fields)
|
14
14
|
- [Searching](#searching)
|
15
15
|
- [Non-standard Operations](#non-standard-operations)
|
16
|
-
- [About SuiteSync](#about-suitesync)
|
17
16
|
|
18
17
|
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
|
19
18
|
|
@@ -24,24 +23,23 @@
|
|
24
23
|
# NetSuite SuiteTalk API Ruby Gem
|
25
24
|
|
26
25
|
* This gem will act as a wrapper around the NetSuite SuiteTalk WebServices API.
|
27
|
-
* The gem does not cover the entire API, only the subset contributors have used so far.
|
28
|
-
* 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)
|
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).
|
29
28
|
|
30
29
|
# Help & Support
|
31
30
|
|
32
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.
|
33
32
|
|
34
|
-
Messages in the Slack ground are [archived here](https://suitechat.slackarchive.io). Search the archives to see if your question has been answered before.
|
35
|
-
|
36
33
|
There is some additional helpful resources for NetSuite development [listed here](https://dashboard.suitesync.io/docs/resources#netsuite).
|
37
34
|
|
38
35
|
# Testing
|
39
36
|
|
40
37
|
Before contributing a patch make sure all existing tests pass.
|
41
38
|
|
42
|
-
```
|
39
|
+
```shell
|
43
40
|
git clone git://github.com/NetSweet/netsuite.git
|
44
41
|
cd netsuite
|
42
|
+
|
45
43
|
bundle
|
46
44
|
bundle exec rspec
|
47
45
|
```
|
@@ -56,28 +54,44 @@ gem 'netsuite'
|
|
56
54
|
|
57
55
|
If you'd like more accurate time conversion support, include the `tzinfo` gem.
|
58
56
|
|
59
|
-
This gem is built for ruby
|
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.
|
60
58
|
|
61
59
|
## Configuration
|
62
60
|
|
63
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/)
|
64
62
|
|
65
|
-
|
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:
|
66
71
|
|
67
72
|
```ruby
|
68
73
|
NetSuite.configure do
|
69
74
|
reset!
|
70
75
|
|
76
|
+
# production & sandbox account numbers will differ
|
71
77
|
account 'TSTDRV1576318'
|
72
78
|
api_version '2018_2'
|
73
79
|
|
80
|
+
# password-based login information
|
81
|
+
# in most cases you should use token based authentication instead
|
74
82
|
email 'email@example.com'
|
75
83
|
password 'password'
|
76
84
|
role 10
|
77
85
|
|
78
|
-
#
|
86
|
+
# recent API versions require a account-specific endpoint o be set
|
87
|
+
# use `NetSuite::Utilities.data_center_url('TSTDRV1576318')` to retrieve wsdl URL
|
79
88
|
# you'll want to do this in a background process and strip the protocol out of the return string
|
80
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}"
|
81
95
|
end
|
82
96
|
```
|
83
97
|
|
@@ -115,6 +129,7 @@ NetSuite.configure do
|
|
115
129
|
# log_level :debug
|
116
130
|
|
117
131
|
# password-based login information
|
132
|
+
# in most cases you should use token based authentication instead
|
118
133
|
email 'email@domain.com'
|
119
134
|
password 'password'
|
120
135
|
account '12345'
|
@@ -127,9 +142,9 @@ NetSuite.configure do
|
|
127
142
|
end
|
128
143
|
```
|
129
144
|
|
130
|
-
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:
|
131
146
|
|
132
|
-
```
|
147
|
+
```ruby
|
133
148
|
NetSuite::Configuration.soap_header = {
|
134
149
|
'platformMsgs:ApplicationInfo' => {
|
135
150
|
'platformMsgs:applicationId' => 'your-netsuite-app-id'
|
@@ -139,7 +154,7 @@ NetSuite::Configuration.soap_header = {
|
|
139
154
|
|
140
155
|
### Token based Authentication
|
141
156
|
|
142
|
-
OAuth credentials are
|
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/).
|
143
158
|
|
144
159
|
```ruby
|
145
160
|
NetSuite.configure do
|
@@ -154,6 +169,11 @@ NetSuite.configure do
|
|
154
169
|
|
155
170
|
# oauth does not work with API versions less than 2015_2
|
156
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}"
|
157
177
|
end
|
158
178
|
```
|
159
179
|
|
@@ -593,7 +613,3 @@ states = NetSuite::Configuration.connection.call(:get_all, message: {
|
|
593
613
|
})
|
594
614
|
states.to_array.first[:get_all_response][:get_all_result][:record_list][:record].map { |r| { country: r[:country], abbr: r[:shortname], name: r[:full_name] } }
|
595
615
|
```
|
596
|
-
|
597
|
-
# About SuiteSync
|
598
|
-
|
599
|
-
[SuiteSync, the Stripe-NetSuite integration](http://suitesync.io) uses this gem and funds the majority of it's development and maintenance.
|
data/circle.yml
CHANGED
@@ -3,7 +3,7 @@ version: 2.1
|
|
3
3
|
orbs:
|
4
4
|
# orbs are basically bundles of pre-written build scripts that work for common cases
|
5
5
|
# https://github.com/CircleCI-Public/ruby-orb
|
6
|
-
ruby: circleci/ruby@1.1
|
6
|
+
ruby: circleci/ruby@1.1.2
|
7
7
|
|
8
8
|
jobs:
|
9
9
|
# skipping build step because Gemfile.lock is not included in the source
|
@@ -17,8 +17,11 @@ jobs:
|
|
17
17
|
steps:
|
18
18
|
- checkout
|
19
19
|
- ruby/install-deps:
|
20
|
-
bundler-version: '1.
|
20
|
+
bundler-version: '2.1.4'
|
21
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'
|
22
25
|
- ruby/rspec-test
|
23
26
|
|
24
27
|
# strangely, there seems to be very little documentation about exactly how martix builds work.
|
data/lib/netsuite.rb
CHANGED
@@ -123,6 +123,8 @@ module NetSuite
|
|
123
123
|
autoload :CustomerPayment, 'netsuite/records/customer_payment'
|
124
124
|
autoload :CustomerPaymentApply, 'netsuite/records/customer_payment_apply'
|
125
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'
|
126
128
|
autoload :CustomerPartner, 'netsuite/records/customer_partner'
|
127
129
|
autoload :CustomerRefund, 'netsuite/records/customer_refund'
|
128
130
|
autoload :CustomerRefundApply, 'netsuite/records/customer_refund_apply'
|
@@ -297,6 +299,8 @@ module NetSuite
|
|
297
299
|
autoload :VendorCreditItemList, 'netsuite/records/vendor_credit_item_list'
|
298
300
|
autoload :VendorCreditExpense, 'netsuite/records/vendor_credit_expense'
|
299
301
|
autoload :VendorCreditExpenseList, 'netsuite/records/vendor_credit_expense_list'
|
302
|
+
autoload :VendorCurrencyList, 'netsuite/records/vendor_currency_list'
|
303
|
+
autoload :VendorCurrency, 'netsuite/records/vendor_currency'
|
300
304
|
autoload :VendorReturnAuthorization, 'netsuite/records/vendor_return_authorization'
|
301
305
|
autoload :VendorReturnAuthorizationItem, 'netsuite/records/vendor_return_authorization_item'
|
302
306
|
autoload :VendorReturnAuthorizationItemList, 'netsuite/records/vendor_return_authorization_item_list'
|
@@ -17,6 +17,7 @@ module NetSuite
|
|
17
17
|
def connection(params={}, credentials={})
|
18
18
|
client = Savon.client({
|
19
19
|
wsdl: cached_wsdl || wsdl,
|
20
|
+
endpoint: endpoint,
|
20
21
|
read_timeout: read_timeout,
|
21
22
|
open_timeout: open_timeout,
|
22
23
|
namespaces: namespaces,
|
@@ -94,6 +95,18 @@ module NetSuite
|
|
94
95
|
attributes[:api_version] = version
|
95
96
|
end
|
96
97
|
|
98
|
+
def endpoint=(endpoint)
|
99
|
+
attributes[:endpoint] = endpoint
|
100
|
+
end
|
101
|
+
|
102
|
+
def endpoint(endpoint=nil)
|
103
|
+
if endpoint
|
104
|
+
self.endpoint = endpoint
|
105
|
+
else
|
106
|
+
attributes[:endpoint]
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
97
110
|
def sandbox=(flag)
|
98
111
|
if attributes[:sandbox] != flag
|
99
112
|
attributes[:wsdl] = nil
|
@@ -8,12 +8,12 @@ module NetSuite
|
|
8
8
|
|
9
9
|
actions :get, :get_list, :add, :delete, :upsert, :search
|
10
10
|
|
11
|
-
fields :allow_non_gl_changes, :end_date, :is_adjust, :is_quarter, :is_year, :period_name, :start_date
|
11
|
+
fields :allow_non_gl_changes, :end_date, :is_adjust, :is_quarter, :is_year, :period_name, :start_date, :closed
|
12
12
|
|
13
13
|
record_refs :parent
|
14
14
|
|
15
15
|
attr_reader :internal_id
|
16
|
-
attr_accessor :external_id
|
16
|
+
attr_accessor :external_id, :search_joins
|
17
17
|
|
18
18
|
def initialize(attributes = {})
|
19
19
|
@internal_id = attributes.delete(:internal_id) || attributes.delete(:@internal_id)
|
@@ -7,7 +7,7 @@ module NetSuite
|
|
7
7
|
include Support::Actions
|
8
8
|
include Namespaces::ListRel
|
9
9
|
|
10
|
-
actions :get, :get_list, :add, :delete, :delete_list, :search, :update, :upsert
|
10
|
+
actions :get, :get_deleted, :get_list, :add, :delete, :delete_list, :search, :update, :upsert, :upsert_list
|
11
11
|
|
12
12
|
fields :salutation, :first_name, :middle_name, :last_name, :title, :phone, :fax, :email, :default_address,
|
13
13
|
:entity_id, :phonetic_name, :alt_email, :office_phone, :home_phone, :mobile_phone, :supervisor_phone,
|
@@ -17,7 +17,7 @@ module NetSuite
|
|
17
17
|
:sales_effective_date, :shipping_cost, :shipping_tax1_rate, :shipping_tax2_rate, :source, :status,
|
18
18
|
:sync_partner_teams, :sync_sales_teams, :tax2_total, :tax_rate, :to_be_emailed, :to_be_faxed,
|
19
19
|
:to_be_printed, :total_cost_estimate, :tran_date, :tran_id, :tran_is_vsoe_bundle, :vat_reg_num,
|
20
|
-
:vsoe_auto_calc
|
20
|
+
:vsoe_auto_calc, :tax_details_override, :tax_reg_override
|
21
21
|
|
22
22
|
field :custom_field_list, CustomFieldList
|
23
23
|
field :item_list, CreditMemoItemList
|
@@ -21,11 +21,11 @@ module NetSuite
|
|
21
21
|
field :apply_list, CustomerDepositApplyList
|
22
22
|
# accountingBookDetailList
|
23
23
|
|
24
|
-
record_refs :customer, :sales_order, :account, :department,
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
24
|
+
record_refs :customer, :sales_order, :account, :department,
|
25
|
+
:payment_method, :payment_option, :custom_form, :currency,
|
26
|
+
:posting_period, :subsidiary, :location,
|
27
|
+
# only available in an advanced search result
|
28
|
+
:deposit_transaction
|
29
29
|
|
30
30
|
attr_reader :internal_id
|
31
31
|
attr_accessor :external_id
|
@@ -17,11 +17,14 @@ module NetSuite
|
|
17
17
|
|
18
18
|
field :custom_field_list, CustomFieldList
|
19
19
|
field :apply_list, CustomerPaymentApplyList
|
20
|
+
field :credit_list, CustomerPaymentCreditList
|
20
21
|
|
21
22
|
read_only_fields :applied, :balance, :pending, :total, :unapplied
|
22
23
|
|
23
|
-
record_refs :account, :ar_acct, :credit_card, :credit_card_processor,
|
24
|
-
:
|
24
|
+
record_refs :account, :ar_acct, :credit_card, :credit_card_processor,
|
25
|
+
:custom_form, :customer, :department, :klass, :location,
|
26
|
+
:payment_method, :payment_option, :posting_period, :subsidiary,
|
27
|
+
:currency
|
25
28
|
|
26
29
|
attr_reader :internal_id
|
27
30
|
attr_accessor :external_id
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module NetSuite
|
2
|
+
module Records
|
3
|
+
class CustomerPaymentCredit
|
4
|
+
include Support::Fields
|
5
|
+
include Support::Records
|
6
|
+
include Namespaces::TranCust
|
7
|
+
|
8
|
+
fields :amount, :applied_to, :apply, :credit_date, :currency, :doc, :due, :line,
|
9
|
+
:ref_num, :total, :type
|
10
|
+
|
11
|
+
def initialize(attributes = {})
|
12
|
+
initialize_from_attributes_hash(attributes)
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -51,7 +51,8 @@ module NetSuite
|
|
51
51
|
:parent, :preferred_location, :pricing_group, :purchase_price_variance_acct, :purchase_tax_code, :purchase_unit,
|
52
52
|
:quantity_pricing_schedule, :rev_rec_schedule, :sale_unit, :sales_tax_code, :ship_package, :soft_descriptor,
|
53
53
|
:stock_unit, :store_display_image, :store_display_thumbnail, :store_item_template, :supply_lot_sizing_method,
|
54
|
-
:supply_replenishment_method, :supply_type, :tax_schedule, :units_type, :vendor
|
54
|
+
:supply_replenishment_method, :supply_type, :tax_schedule, :units_type, :vendor, :create_revenue_plans_on,
|
55
|
+
:revenue_recognition_rule, :rev_rec_forecast_rule
|
55
56
|
|
56
57
|
field :pricing_matrix, PricingMatrix
|
57
58
|
field :custom_field_list, CustomFieldList
|
@@ -8,15 +8,17 @@ module NetSuite
|
|
8
8
|
include Support::RecordRefs
|
9
9
|
include Namespaces::ListRel
|
10
10
|
|
11
|
-
# https://system.netsuite.com/help/helpcenter/en_US/srbrowser/
|
11
|
+
# https://system.netsuite.com/help/helpcenter/en_US/srbrowser/Browser2020_2/schema/record/partner.html
|
12
12
|
|
13
13
|
actions :get, :get_list, :add, :update, :upsert, :upsert_list, :delete, :search
|
14
14
|
|
15
|
-
fields :
|
16
|
-
:
|
17
|
-
:
|
15
|
+
fields :alt_email, :alt_name, :bcn, :comments, :company_name, :date_created, :default_address,
|
16
|
+
:eligible_for_commission, :email, :entity_id, :fax, :first_name, :give_access, :home_phone, :is_inactive,
|
17
|
+
:is_person, :last_modified_date, :last_name, :login_as, :middle_name, :mobile_phone, :partner_code,
|
18
|
+
:password, :password2, :phone, :phonetic_name, :print_on_check_as, :referring_url, :require_pwd_change,
|
19
|
+
:salutation, :send_email, :sub_partner_login, :tax_id_num, :title, :url, :vat_reg_number
|
18
20
|
|
19
|
-
record_refs :klass, :
|
21
|
+
record_refs :access_role, :klass, :custom_form, :default_tax_reg, :department, :image, :location, :parent, :subsidiary
|
20
22
|
|
21
23
|
attr_reader :internal_id
|
22
24
|
attr_accessor :external_id
|
@@ -11,7 +11,7 @@ module NetSuite
|
|
11
11
|
|
12
12
|
fields :account_number, :alt_email, :alt_name, :alt_phone, :balance,
|
13
13
|
:balance_primary, :bcn, :bill_pay, :comments, :company_name, :credit_limit,
|
14
|
-
:
|
14
|
+
:date_created, :default_address, :eligible_for_commission,
|
15
15
|
:email, :email_preference, :email_transactions, :entity_id, :fax, :fax_transactions,
|
16
16
|
:first_name, :give_access, :global_subscription_status, :home_phone, :is1099_eligible,
|
17
17
|
:is_accountant, :is_inactive, :is_job_resource_vend, :is_person, :labor_cost,
|
@@ -22,6 +22,7 @@ module NetSuite
|
|
22
22
|
:url, :vat_reg_number
|
23
23
|
|
24
24
|
field :custom_field_list, CustomFieldList
|
25
|
+
field :currency_list, VendorCurrencyList
|
25
26
|
# TODO should change name to VendorAddressBookList
|
26
27
|
field :addressbook_list, CustomerAddressbookList
|
27
28
|
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module NetSuite
|
2
|
+
module Records
|
3
|
+
class VendorCurrency
|
4
|
+
include Support::Fields
|
5
|
+
include Support::RecordRefs
|
6
|
+
include Support::Records
|
7
|
+
include Namespaces::ListRel
|
8
|
+
|
9
|
+
fields :balance, :consol_balance, :consol_deposit_balance, :consol_overdue_balance,
|
10
|
+
:consol_unbilled_orders, :deposit_balance, :display_symbol, :overdue_balance,
|
11
|
+
:override_currency_format, :symbol_placement, :unbilled_orders
|
12
|
+
|
13
|
+
record_refs :currency
|
14
|
+
|
15
|
+
def initialize(attributes_or_record = {})
|
16
|
+
case attributes_or_record
|
17
|
+
when Hash
|
18
|
+
initialize_from_attributes_hash(attributes_or_record)
|
19
|
+
when self.class
|
20
|
+
initialize_from_record(attributes_or_record)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
data/lib/netsuite/version.rb
CHANGED
@@ -29,10 +29,12 @@ describe NetSuite::Configuration do
|
|
29
29
|
end
|
30
30
|
|
31
31
|
describe '#connection' do
|
32
|
+
EXAMPLE_ENDPOINT = 'https://1023.suitetalk.api.netsuite.com/services/NetSuitePort_2020_2'
|
32
33
|
before(:each) do
|
33
34
|
# reset clears out the password info
|
34
35
|
config.email 'me@example.com'
|
35
36
|
config.password 'me@example.com'
|
37
|
+
config.endpoint EXAMPLE_ENDPOINT
|
36
38
|
config.account 1023
|
37
39
|
config.wsdl "my_wsdl"
|
38
40
|
config.api_version "2012_2"
|
@@ -57,6 +59,19 @@ describe NetSuite::Configuration do
|
|
57
59
|
|
58
60
|
expect(config).to have_received(:cached_wsdl)
|
59
61
|
end
|
62
|
+
|
63
|
+
it 'sets the endpoint on the Savon client' do
|
64
|
+
# this is ugly/brittle, but it's hard to see how else to test this
|
65
|
+
savon_configs = config.connection.globals.instance_eval {@options}
|
66
|
+
expect(savon_configs.fetch(:endpoint)).to eq(EXAMPLE_ENDPOINT)
|
67
|
+
end
|
68
|
+
|
69
|
+
it 'handles a nil endpoint' do
|
70
|
+
config.endpoint = nil
|
71
|
+
# this is ugly/brittle, but it's hard to see how else to test this
|
72
|
+
savon_configs = config.connection.globals.instance_eval {@options}
|
73
|
+
expect(savon_configs.fetch(:endpoint)).to eq(nil)
|
74
|
+
end
|
60
75
|
end
|
61
76
|
|
62
77
|
describe '#wsdl' do
|
@@ -166,6 +181,23 @@ describe NetSuite::Configuration do
|
|
166
181
|
end
|
167
182
|
end
|
168
183
|
|
184
|
+
describe '#endpoint' do
|
185
|
+
it 'can be set with endpoint=' do
|
186
|
+
config.endpoint = 42
|
187
|
+
expect(config.endpoint).to eq(42)
|
188
|
+
end
|
189
|
+
|
190
|
+
it 'can be set with just endpoint(value)' do
|
191
|
+
config.endpoint(42)
|
192
|
+
expect(config.endpoint).to eq(42)
|
193
|
+
end
|
194
|
+
|
195
|
+
it 'supports nil endpoints' do
|
196
|
+
config.endpoint = nil
|
197
|
+
expect(config.endpoint).to eq(nil)
|
198
|
+
end
|
199
|
+
end
|
200
|
+
|
169
201
|
describe '#auth_header' do
|
170
202
|
context 'when doing user authentication' do
|
171
203
|
before do
|
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe 'basic records' do
|
4
|
+
# all records with internal IDs should be added to this list
|
4
5
|
let(:basic_record_list) {
|
5
6
|
[
|
6
7
|
NetSuite::Records::Currency,
|
@@ -49,6 +50,7 @@ describe 'basic records' do
|
|
49
50
|
NetSuite::Records::SerializedInventoryItem,
|
50
51
|
NetSuite::Records::DepositApplication,
|
51
52
|
NetSuite::Records::InventoryAdjustment,
|
53
|
+
NetSuite::Records::Vendor,
|
52
54
|
NetSuite::Records::VendorReturnAuthorization,
|
53
55
|
NetSuite::Records::AssemblyBuild,
|
54
56
|
NetSuite::Records::AssemblyUnbuild,
|
@@ -61,6 +63,7 @@ describe 'basic records' do
|
|
61
63
|
NetSuite::Records::BinTransfer,
|
62
64
|
NetSuite::Records::SerializedAssemblyItem,
|
63
65
|
NetSuite::Records::CustomerStatus,
|
66
|
+
NetSuite::Records::CustomerPayment,
|
64
67
|
NetSuite::Records::TransactionBodyCustomField,
|
65
68
|
NetSuite::Records::TransactionColumnCustomField,
|
66
69
|
NetSuite::Records::EntityCustomField
|
@@ -108,8 +111,12 @@ describe 'basic records' do
|
|
108
111
|
|
109
112
|
if !sublist_fields.empty?
|
110
113
|
sublist_fields.each do |sublist_field|
|
114
|
+
sublist = record_instance.send(sublist_field)
|
115
|
+
|
111
116
|
# TODO make a sublist entry with some fields valid for that sublist item
|
112
|
-
|
117
|
+
sublist << {}
|
118
|
+
|
119
|
+
expect(sublist.send(sublist.sublist_key).count).to be(1)
|
113
120
|
end
|
114
121
|
end
|
115
122
|
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe NetSuite::Records::CustomerPaymentCreditList do
|
4
|
+
let(:list) { NetSuite::Records::CustomerPaymentCreditList.new }
|
5
|
+
let(:apply) { NetSuite::Records::CustomerPaymentCredit.new }
|
6
|
+
|
7
|
+
it 'can have credits be added to it' do
|
8
|
+
list.credits << apply
|
9
|
+
credit_list = list.credits
|
10
|
+
expect(credit_list).to be_kind_of(Array)
|
11
|
+
expect(credit_list.length).to eql(1)
|
12
|
+
credit_list.each { |i| expect(i).to be_kind_of(NetSuite::Records::CustomerPaymentCredit) }
|
13
|
+
end
|
14
|
+
|
15
|
+
describe '#to_record' do
|
16
|
+
it 'can represent itself as a SOAP record' do
|
17
|
+
record = {
|
18
|
+
'tranCust:credit' => [{},{}]
|
19
|
+
}
|
20
|
+
|
21
|
+
list.credits.concat([apply, apply])
|
22
|
+
expect(list.to_record).to eql(record)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
@@ -18,7 +18,7 @@ describe NetSuite::Records::CustomerPayment do
|
|
18
18
|
|
19
19
|
it 'has all the right record refs' do
|
20
20
|
[
|
21
|
-
:account, :ar_acct, :credit_card, :credit_card_processor, :custom_form, :customer, :department, :klass, :location, :payment_method, :posting_period, :subsidiary
|
21
|
+
:account, :ar_acct, :credit_card, :credit_card_processor, :custom_form, :customer, :department, :klass, :location, :payment_method, :payment_option, :posting_period, :subsidiary
|
22
22
|
].each do |record_ref|
|
23
23
|
expect(payment).to have_record_ref(record_ref)
|
24
24
|
end
|
@@ -49,11 +49,6 @@ describe NetSuite::Records::CustomerPayment do
|
|
49
49
|
it 'can be set from a CustomerPaymentApplyList object'
|
50
50
|
end
|
51
51
|
|
52
|
-
describe '#credit_list' do
|
53
|
-
it 'can be set from attributes'
|
54
|
-
it 'can be set from a CustomerPaymentCreditList object'
|
55
|
-
end
|
56
|
-
|
57
52
|
describe '#deposit_list' do
|
58
53
|
it 'can be set from attributes'
|
59
54
|
it 'can be set from a CustomerPaymentDepositList object'
|
@@ -5,9 +5,11 @@ describe NetSuite::Records::Partner do
|
|
5
5
|
|
6
6
|
it 'has all the right fields' do
|
7
7
|
[
|
8
|
-
:
|
9
|
-
:
|
10
|
-
:
|
8
|
+
:alt_email, :alt_name, :bcn, :comments, :company_name, :date_created, :default_address,
|
9
|
+
:eligible_for_commission, :email, :entity_id, :fax, :first_name, :give_access, :home_phone, :is_inactive,
|
10
|
+
:is_person, :last_modified_date, :last_name, :login_as, :middle_name, :mobile_phone, :partner_code,
|
11
|
+
:password, :password2, :phone, :phonetic_name, :print_on_check_as, :referring_url, :require_pwd_change,
|
12
|
+
:salutation, :send_email, :sub_partner_login, :tax_id_num, :title, :url, :vat_reg_number
|
11
13
|
].each do |field|
|
12
14
|
expect(partner).to have_field(field)
|
13
15
|
end
|
@@ -15,7 +17,7 @@ describe NetSuite::Records::Partner do
|
|
15
17
|
|
16
18
|
it 'has all the right record refs' do
|
17
19
|
[
|
18
|
-
:klass, :
|
20
|
+
:access_role, :klass, :custom_form, :default_tax_reg, :department, :image, :location, :parent, :subsidiary
|
19
21
|
].each do |record_ref|
|
20
22
|
expect(partner).to have_record_ref(record_ref)
|
21
23
|
end
|
@@ -7,7 +7,7 @@ describe NetSuite::Records::Vendor do
|
|
7
7
|
[
|
8
8
|
:account_number, :alt_email, :alt_name, :alt_phone, :balance,
|
9
9
|
:balance_primary, :bcn, :bill_pay, :comments, :company_name, :credit_limit,
|
10
|
-
:
|
10
|
+
:date_created, :default_address, :eligible_for_commission,
|
11
11
|
:email, :email_preference, :email_transactions, :entity_id, :fax, :fax_transactions,
|
12
12
|
:first_name, :give_access, :global_subscription_status, :home_phone, :is1099_eligible,
|
13
13
|
:is_accountant, :is_inactive, :is_job_resource_vend, :is_person, :labor_cost,
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: netsuite
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Moran
|
8
8
|
- Michael Bianco
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2021-05-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: savon
|
@@ -56,6 +56,7 @@ files:
|
|
56
56
|
- ".gitignore"
|
57
57
|
- ".rspec"
|
58
58
|
- ".ruby-version"
|
59
|
+
- ".tool-versions"
|
59
60
|
- Gemfile
|
60
61
|
- LICENSE
|
61
62
|
- README.md
|
@@ -168,6 +169,8 @@ files:
|
|
168
169
|
- lib/netsuite/records/customer_payment.rb
|
169
170
|
- lib/netsuite/records/customer_payment_apply.rb
|
170
171
|
- lib/netsuite/records/customer_payment_apply_list.rb
|
172
|
+
- lib/netsuite/records/customer_payment_credit.rb
|
173
|
+
- lib/netsuite/records/customer_payment_credit_list.rb
|
171
174
|
- lib/netsuite/records/customer_refund.rb
|
172
175
|
- lib/netsuite/records/customer_refund_apply.rb
|
173
176
|
- lib/netsuite/records/customer_refund_apply_list.rb
|
@@ -331,6 +334,8 @@ files:
|
|
331
334
|
- lib/netsuite/records/vendor_credit_expense_list.rb
|
332
335
|
- lib/netsuite/records/vendor_credit_item.rb
|
333
336
|
- lib/netsuite/records/vendor_credit_item_list.rb
|
337
|
+
- lib/netsuite/records/vendor_currency.rb
|
338
|
+
- lib/netsuite/records/vendor_currency_list.rb
|
334
339
|
- lib/netsuite/records/vendor_payment.rb
|
335
340
|
- lib/netsuite/records/vendor_payment_apply.rb
|
336
341
|
- lib/netsuite/records/vendor_payment_apply_list.rb
|
@@ -407,6 +412,7 @@ files:
|
|
407
412
|
- spec/netsuite/records/customer_addressbook_spec.rb
|
408
413
|
- spec/netsuite/records/customer_credit_cards_list_spec.rb
|
409
414
|
- spec/netsuite/records/customer_payment_apply_list_spec.rb
|
415
|
+
- spec/netsuite/records/customer_payment_credit_list_spec.rb
|
410
416
|
- spec/netsuite/records/customer_payment_spec.rb
|
411
417
|
- spec/netsuite/records/customer_refund_apply_list_spec.rb
|
412
418
|
- spec/netsuite/records/customer_refund_apply_spec.rb
|
@@ -556,7 +562,7 @@ homepage: https://github.com/NetSweet/netsuite
|
|
556
562
|
licenses:
|
557
563
|
- MIT
|
558
564
|
metadata: {}
|
559
|
-
post_install_message:
|
565
|
+
post_install_message:
|
560
566
|
rdoc_options: []
|
561
567
|
require_paths:
|
562
568
|
- lib
|
@@ -571,8 +577,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
571
577
|
- !ruby/object:Gem::Version
|
572
578
|
version: '0'
|
573
579
|
requirements: []
|
574
|
-
rubygems_version: 3.
|
575
|
-
signing_key:
|
580
|
+
rubygems_version: 3.1.6
|
581
|
+
signing_key:
|
576
582
|
specification_version: 4
|
577
583
|
summary: NetSuite SuiteTalk API (SOAP) Wrapper
|
578
584
|
test_files:
|
@@ -627,6 +633,7 @@ test_files:
|
|
627
633
|
- spec/netsuite/records/customer_addressbook_spec.rb
|
628
634
|
- spec/netsuite/records/customer_credit_cards_list_spec.rb
|
629
635
|
- spec/netsuite/records/customer_payment_apply_list_spec.rb
|
636
|
+
- spec/netsuite/records/customer_payment_credit_list_spec.rb
|
630
637
|
- spec/netsuite/records/customer_payment_spec.rb
|
631
638
|
- spec/netsuite/records/customer_refund_apply_list_spec.rb
|
632
639
|
- spec/netsuite/records/customer_refund_apply_spec.rb
|