netsuite 0.8.8 → 0.8.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/FUNDING.yml +1 -0
- data/.github/dependabot.yml +14 -0
- data/.github/workflows/codeql-analysis.yml +70 -0
- data/.github/workflows/main.yml +7 -4
- data/Gemfile +5 -3
- data/HISTORY.md +42 -5
- data/README.md +18 -20
- data/lib/netsuite/actions/add.rb +5 -1
- data/lib/netsuite/actions/attach_file.rb +87 -0
- data/lib/netsuite/actions/search.rb +19 -6
- data/lib/netsuite/records/account.rb +0 -1
- data/lib/netsuite/records/accounting_period.rb +1 -1
- data/lib/netsuite/records/assembly_component.rb +0 -2
- data/lib/netsuite/records/assembly_item.rb +0 -1
- data/lib/netsuite/records/assembly_unbuild.rb +1 -4
- data/lib/netsuite/records/cash_refund.rb +0 -1
- data/lib/netsuite/records/cash_sale.rb +1 -2
- data/lib/netsuite/records/contact.rb +0 -1
- data/lib/netsuite/records/credit_memo.rb +0 -1
- data/lib/netsuite/records/currency_rate.rb +1 -2
- data/lib/netsuite/records/custom_record.rb +1 -1
- data/lib/netsuite/records/customer.rb +0 -1
- data/lib/netsuite/records/customer_deposit.rb +0 -1
- data/lib/netsuite/records/customer_payment.rb +0 -1
- data/lib/netsuite/records/customer_refund.rb +0 -1
- data/lib/netsuite/records/deposit.rb +0 -1
- data/lib/netsuite/records/deposit_application.rb +0 -1
- data/lib/netsuite/records/description_item.rb +1 -1
- data/lib/netsuite/records/estimate.rb +95 -15
- data/lib/netsuite/records/inbound_shipment.rb +0 -1
- data/lib/netsuite/records/inventory_item.rb +239 -40
- data/lib/netsuite/records/inventory_number.rb +1 -2
- data/lib/netsuite/records/inventory_transfer.rb +1 -0
- data/lib/netsuite/records/invoice.rb +7 -8
- data/lib/netsuite/records/invoice_item.rb +1 -1
- data/lib/netsuite/records/item_fulfillment.rb +0 -1
- data/lib/netsuite/records/item_fulfillment_item.rb +1 -1
- data/lib/netsuite/records/item_group.rb +1 -1
- data/lib/netsuite/records/item_option_custom_field.rb +52 -0
- data/lib/netsuite/records/item_receipt.rb +0 -1
- data/lib/netsuite/records/item_receipt_item.rb +3 -2
- data/lib/netsuite/records/item_vendor.rb +10 -1
- data/lib/netsuite/records/job.rb +0 -1
- data/lib/netsuite/records/kit_item.rb +1 -1
- data/lib/netsuite/records/location.rb +0 -1
- data/lib/netsuite/records/lot_numbered_inventory_item.rb +225 -81
- data/lib/netsuite/records/matrix_option_list.rb +16 -0
- data/lib/netsuite/records/member_list.rb +0 -2
- data/lib/netsuite/records/non_inventory_purchase_item.rb +1 -1
- data/lib/netsuite/records/non_inventory_resale_item.rb +156 -20
- data/lib/netsuite/records/non_inventory_sale_item.rb +133 -21
- data/lib/netsuite/records/opportunity.rb +2 -3
- data/lib/netsuite/records/other_charge_sale_item.rb +1 -1
- data/lib/netsuite/records/payment_item.rb +1 -1
- data/lib/netsuite/records/payroll_item.rb +0 -1
- data/lib/netsuite/records/phone_call.rb +1 -1
- data/lib/netsuite/records/purchase_order.rb +0 -1
- data/lib/netsuite/records/return_authorization.rb +1 -0
- data/lib/netsuite/records/sales_order.rb +1 -2
- data/lib/netsuite/records/serialized_assembly_item.rb +0 -1
- data/lib/netsuite/records/serialized_inventory_item.rb +1 -1
- data/lib/netsuite/records/serialized_inventory_item_location.rb +0 -1
- data/lib/netsuite/records/service_resale_item.rb +123 -19
- data/lib/netsuite/records/service_sale_item.rb +1 -2
- data/lib/netsuite/records/subsidiary.rb +0 -1
- data/lib/netsuite/records/subtotal_item.rb +1 -1
- data/lib/netsuite/records/transfer_order.rb +0 -1
- data/lib/netsuite/records/transfer_order_item.rb +1 -1
- data/lib/netsuite/records/translation.rb +17 -0
- data/lib/netsuite/records/translation_list.rb +11 -0
- data/lib/netsuite/records/vendor.rb +4 -5
- data/lib/netsuite/records/vendor_bill.rb +0 -1
- data/lib/netsuite/records/work_order.rb +0 -1
- data/lib/netsuite/records/work_order_item.rb +0 -1
- data/lib/netsuite/support/actions.rb +2 -0
- data/lib/netsuite/support/fields.rb +3 -0
- data/lib/netsuite/support/records.rb +9 -1
- data/lib/netsuite/utilities.rb +5 -0
- data/lib/netsuite/version.rb +1 -1
- data/lib/netsuite.rb +4 -0
- data/netsuite.gemspec +4 -3
- data/spec/netsuite/actions/add_spec.rb +36 -0
- data/spec/netsuite/actions/attach_file_spec.rb +59 -0
- data/spec/netsuite/actions/search_spec.rb +205 -0
- data/spec/netsuite/records/estimate_spec.rb +103 -13
- data/spec/netsuite/records/inventory_item_spec.rb +242 -25
- data/spec/netsuite/records/invoice_spec.rb +30 -1
- data/spec/netsuite/records/item_option_custom_field_spec.rb +27 -0
- data/spec/netsuite/records/item_vendor_list_spec.rb +2 -5
- data/spec/netsuite/records/item_vendor_spec.rb +14 -2
- data/spec/netsuite/records/lot_numbered_inventory_item_spec.rb +247 -0
- data/spec/netsuite/records/matrix_option_list_spec.rb +26 -0
- data/spec/netsuite/records/non_inventory_resale_item_spec.rb +159 -24
- data/spec/netsuite/records/non_inventory_sale_item_spec.rb +135 -22
- data/spec/netsuite/records/return_authorization_spec.rb +62 -0
- data/spec/netsuite/records/sales_order_spec.rb +29 -0
- data/spec/netsuite/records/service_resale_item_spec.rb +122 -17
- data/spec/netsuite/records/translation_list_spec.rb +34 -0
- data/spec/netsuite/records/translation_spec.rb +28 -0
- data/spec/netsuite/support/fields_spec.rb +48 -1
- data/spec/netsuite/support/search_result_spec.rb +12 -0
- data/spec/netsuite/utilities_spec.rb +10 -2
- data/spec/support/field_matcher.rb +8 -6
- data/spec/support/fixtures/add/add_file.xml +20 -0
- data/spec/support/fixtures/attach/attach_file_to_sales_order.xml +16 -0
- data/spec/support/fixtures/attach/attach_file_to_sales_order_error.xml +20 -0
- data/spec/support/fixtures/search/basic_search_contact.xml +39 -0
- data/spec/support/fixtures/search/single_search_result.xml +46 -0
- metadata +39 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6137faebee57aa9e3bdaa9cca35d82765f5e9943075eb09bc8bd867b1893ad6b
|
4
|
+
data.tar.gz: 8ee0308ee67c2dcd440ea17a1107220e394b5b1e15829f76b47ca2769d4be9f2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a297cc64a543bdf34c086432c78a36b038205998794ae67a968c3c9bdd506a99bfd7a1048bb8aec821fd2edd1c2d89ce715719f035e1a09e5f4b38b560df98b6
|
7
|
+
data.tar.gz: a536956ed7da89d0fa0e7ec2dcaeba3539ec5dcbddbb3c9249a3b17b93caadaa13b9cba9b7cbe6f0a9b9de786541e4bc190e2771bef03c6cec71d1881c79f7e9
|
data/.github/FUNDING.yml
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
github: [NetSweet]
|
@@ -0,0 +1,14 @@
|
|
1
|
+
version: 2
|
2
|
+
updates:
|
3
|
+
|
4
|
+
# Maintain dependencies for GitHub Actions
|
5
|
+
- package-ecosystem: "github-actions"
|
6
|
+
directory: "/"
|
7
|
+
schedule:
|
8
|
+
interval: "daily"
|
9
|
+
|
10
|
+
# Maintain dependencies for rubygems
|
11
|
+
- package-ecosystem: "bundler"
|
12
|
+
directory: "/"
|
13
|
+
schedule:
|
14
|
+
interval: "daily"
|
@@ -0,0 +1,70 @@
|
|
1
|
+
# For most projects, this workflow file will not need changing; you simply need
|
2
|
+
# to commit it to your repository.
|
3
|
+
#
|
4
|
+
# You may wish to alter this file to override the set of languages analyzed,
|
5
|
+
# or to provide custom queries or build logic.
|
6
|
+
#
|
7
|
+
# ******** NOTE ********
|
8
|
+
# We have attempted to detect the languages in your repository. Please check
|
9
|
+
# the `language` matrix defined below to confirm you have the correct set of
|
10
|
+
# supported CodeQL languages.
|
11
|
+
#
|
12
|
+
name: "CodeQL"
|
13
|
+
|
14
|
+
on:
|
15
|
+
push:
|
16
|
+
branches: [ master ]
|
17
|
+
pull_request:
|
18
|
+
# The branches below must be a subset of the branches above
|
19
|
+
branches: [ master ]
|
20
|
+
schedule:
|
21
|
+
- cron: '32 15 * * 6'
|
22
|
+
|
23
|
+
jobs:
|
24
|
+
analyze:
|
25
|
+
name: Analyze
|
26
|
+
runs-on: ubuntu-latest
|
27
|
+
permissions:
|
28
|
+
actions: read
|
29
|
+
contents: read
|
30
|
+
security-events: write
|
31
|
+
|
32
|
+
strategy:
|
33
|
+
fail-fast: false
|
34
|
+
matrix:
|
35
|
+
language: [ 'ruby' ]
|
36
|
+
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
|
37
|
+
# Learn more about CodeQL language support at https://git.io/codeql-language-support
|
38
|
+
|
39
|
+
steps:
|
40
|
+
- name: Checkout repository
|
41
|
+
uses: actions/checkout@v2
|
42
|
+
|
43
|
+
# Initializes the CodeQL tools for scanning.
|
44
|
+
- name: Initialize CodeQL
|
45
|
+
uses: github/codeql-action/init@v1
|
46
|
+
with:
|
47
|
+
languages: ${{ matrix.language }}
|
48
|
+
# If you wish to specify custom queries, you can do so here or in a config file.
|
49
|
+
# By default, queries listed here will override any specified in a config file.
|
50
|
+
# Prefix the list here with "+" to use these queries and those in the config file.
|
51
|
+
# queries: ./path/to/local/query, your-org/your-repo/queries@main
|
52
|
+
|
53
|
+
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
54
|
+
# If this step fails, then you should remove it and run the build manually (see below)
|
55
|
+
- name: Autobuild
|
56
|
+
uses: github/codeql-action/autobuild@v1
|
57
|
+
|
58
|
+
# ℹ️ Command-line programs to run using the OS shell.
|
59
|
+
# 📚 https://git.io/JvXDl
|
60
|
+
|
61
|
+
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
|
62
|
+
# and modify them (or add more) to build your code if your project
|
63
|
+
# uses a compiled language
|
64
|
+
|
65
|
+
#- run: |
|
66
|
+
# make bootstrap
|
67
|
+
# make release
|
68
|
+
|
69
|
+
- name: Perform CodeQL Analysis
|
70
|
+
uses: github/codeql-action/analyze@v1
|
data/.github/workflows/main.yml
CHANGED
@@ -1,15 +1,18 @@
|
|
1
1
|
name: Ruby
|
2
2
|
|
3
|
-
on: [push,pull_request]
|
3
|
+
on: [push, pull_request]
|
4
4
|
|
5
5
|
jobs:
|
6
6
|
build:
|
7
7
|
runs-on: ubuntu-latest
|
8
8
|
strategy:
|
9
9
|
matrix:
|
10
|
-
ruby-version: [2.7, 2.6, 2.5, 2.4, 2.3, 2.2, 2.1]
|
10
|
+
ruby-version: [3.1, 3.0, 2.7, 2.6, 2.5, 2.4, 2.3, 2.2, 2.1]
|
11
|
+
bundle-tzinfo: [true, false]
|
12
|
+
env:
|
13
|
+
BUNDLE_TZINFO: "${{ matrix.bundle-tzinfo }}"
|
11
14
|
steps:
|
12
|
-
- uses: actions/checkout@
|
15
|
+
- uses: actions/checkout@v3
|
13
16
|
- name: Set up Ruby ${{ matrix.ruby-version }}
|
14
17
|
uses: ruby/setup-ruby@v1
|
15
18
|
with:
|
@@ -17,4 +20,4 @@ jobs:
|
|
17
20
|
- name: Install dependencies
|
18
21
|
run: bundle install
|
19
22
|
- name: Run tests
|
20
|
-
run: bundle exec rake
|
23
|
+
run: bundle exec rake
|
data/Gemfile
CHANGED
@@ -6,6 +6,8 @@ gem 'simplecov', :require => false
|
|
6
6
|
gem 'pry-nav'
|
7
7
|
gem 'pry-rescue'
|
8
8
|
|
9
|
-
|
10
|
-
|
11
|
-
#
|
9
|
+
|
10
|
+
if ENV.fetch('BUNDLE_TZINFO', 'false') == 'true'
|
11
|
+
# optional dependency for more accurate timezone conversion
|
12
|
+
gem 'tzinfo', '>= 1.2.5'
|
13
|
+
end
|
data/HISTORY.md
CHANGED
@@ -2,13 +2,50 @@
|
|
2
2
|
|
3
3
|
### Added
|
4
4
|
|
5
|
-
|
6
|
-
|
5
|
+
### Fixed
|
6
|
+
|
7
|
+
## 0.8.11
|
8
|
+
|
9
|
+
### Added
|
10
|
+
|
11
|
+
* Update ServiceResaleItem record fields/record refs for 2021.2. `item_options_list`, `presentation_item_list`, `site_category_list`, `translations_list` were all removed as fields as the are not simple fields, they require special classes. (#500)
|
12
|
+
* Dependabot to CI
|
13
|
+
* CI run for Ruby 3.0 & 3.1
|
14
|
+
* Add CI run for an environment with and without `tzinfo` installed
|
15
|
+
* Update NonInventorySaleItem record fields/record refs for 2021.2. `item_options_list`, `presentation_item_list`, `product_feed_list`, `site_category_list`, `translations_list` were all removed as fields as the are not simple fields, they require special classes. (#503)
|
16
|
+
* Implement MatrixOptionList#to_record (#504)
|
17
|
+
* Update ItemVendor record fields/record refs for 2021.1. `vendor` is now a record_ref instead of a field. (#505)
|
18
|
+
* Update InventoryItem record fields/record refs for 2021.2. `member_list` was removed as a field as it doesn't belong to InventoryItem. (#506)
|
19
|
+
* Update LotNumberedInventoryItem record fields/record refs for 2021.2. (#507)
|
20
|
+
* Update NonInventoryResaleItem record fields/record refs for 2021.2. `item_options_list`, `presentation_item_list`, `product_feed_list`, `site_category_list`, `translations_list` were all removed as fields as the are not simple fields, they require special classes. (#508)
|
21
|
+
* Add `attach_file` action for Invoice and SalesOrder. (#509)
|
22
|
+
* Add ItemOptionCustomField recrd (#512)
|
23
|
+
* Add Ship Address to Return Authorization (#525)
|
24
|
+
* Support translations records (#516)
|
25
|
+
|
26
|
+
### Fixed
|
27
|
+
|
28
|
+
* Fix "undefined method `[]` for #<Nori::StringIOFile>" when adding File (#495)
|
29
|
+
* Moved definition of `search_joins` attribute from records to search action. The attribute was removed for AssemblyComponent, SerializedInventoryItemLocation, and WorkOrderItem as they don't offer the search action. (#511)
|
30
|
+
* Consider externalId in search criteria when using RecordRef as value (#517)
|
31
|
+
* Retry http client error subclasses
|
32
|
+
* Add upsert list action for cash sales (#523)
|
33
|
+
|
34
|
+
## 0.8.10
|
35
|
+
|
36
|
+
### Added
|
37
|
+
|
38
|
+
* Update Estimate record fields/record refs for 2021.2. `balance`, `bill_address`, `bill_is_residential`, and `is_multi_ship_to` were all removed as fields as either being incorrect, outdated, or a search-only field. (#496)
|
39
|
+
|
40
|
+
### Fixed
|
41
|
+
|
42
|
+
* Savon 2.12 supported
|
43
|
+
|
44
|
+
## 0.8.9
|
7
45
|
|
8
46
|
### Fixed
|
9
47
|
|
10
|
-
*
|
11
|
-
*
|
48
|
+
* Fixed issue where search only fields could be specified when an existing field exists. https://github.com/NetSweet/netsuite/pull/488
|
12
49
|
|
13
50
|
## 0.8.8
|
14
51
|
|
@@ -23,4 +60,4 @@
|
|
23
60
|
* Fix accessing custom field values returned in advanced search results (#480)
|
24
61
|
* Fixing bug where single-selection custom multi select fields would incorrectly be parsed 3377c971d0cb727d81f4b4bc6e30edfbdfaccfd1
|
25
62
|
* Fixed some field definitions on serialized assembly item
|
26
|
-
* Properly extract external_id from advanced search results (#478)
|
63
|
+
* Properly extract external_id from advanced search results (#478)
|
data/README.md
CHANGED
@@ -1,21 +1,3 @@
|
|
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
1
|
[![Ruby](https://github.com/NetSweet/netsuite/actions/workflows/main.yml/badge.svg)](https://github.com/NetSweet/netsuite/actions/workflows/main.yml)
|
20
2
|
[![Slack Status](https://opensuite-slackin.herokuapp.com/badge.svg)](http://opensuite-slackin.herokuapp.com)
|
21
3
|
[![Gem Version](https://badge.fury.io/rb/netsuite.svg)](http://badge.fury.io/rb/netsuite)
|
@@ -215,7 +197,7 @@ task.update(message: 'New Message')
|
|
215
197
|
task.delete
|
216
198
|
|
217
199
|
# refresh/reload a record (helpful after adding the record for the first time)
|
218
|
-
task.
|
200
|
+
task.refresh
|
219
201
|
|
220
202
|
# using get_select_value with a standard record
|
221
203
|
NetSuite::Records::BaseRefList.get_select_value(
|
@@ -238,6 +220,19 @@ options = NetSuite::Records::BaseRefList.get_select_value(
|
|
238
220
|
options.base_refs.map(&:name)
|
239
221
|
```
|
240
222
|
|
223
|
+
## Uploading/Attaching Files
|
224
|
+
|
225
|
+
```ruby
|
226
|
+
file = NetSuite::Records::File.new(
|
227
|
+
content: Base64.encode64(File.read('/path/to/file')),
|
228
|
+
name: 'Invoice.pdf',
|
229
|
+
)
|
230
|
+
file.add
|
231
|
+
|
232
|
+
invoice = NetSuite::Records::Invoice.get(internal_id: 1)
|
233
|
+
invoice.attach_file(NetSuite::Records::RecordRef.new(internal_id: file.internal_id))
|
234
|
+
```
|
235
|
+
|
241
236
|
## Custom Records & Fields
|
242
237
|
|
243
238
|
```ruby
|
@@ -421,7 +416,10 @@ NetSuite::Records::SalesOrder.search({
|
|
421
416
|
'tranSales:basic' => [
|
422
417
|
'platformCommon:internalId/' => {},
|
423
418
|
'platformCommon:email/' => {},
|
424
|
-
'platformCommon:tranDate/' => {}
|
419
|
+
'platformCommon:tranDate/' => {},
|
420
|
+
# If you include columns that are only part of the *SearchRowBasic (ie. TransactionSearchRowBasic),
|
421
|
+
# they'll be readable on the resulting record just like regular fields (my_record.close_date).
|
422
|
+
'platformCommon:closeDate/' => {}
|
425
423
|
],
|
426
424
|
'tranSales:accountJoin' => [
|
427
425
|
'platformCommon:internalId/' => {}
|
data/lib/netsuite/actions/add.rb
CHANGED
@@ -49,7 +49,11 @@ module NetSuite
|
|
49
49
|
end
|
50
50
|
|
51
51
|
def response_body
|
52
|
-
@response_body ||= response_hash[:base_ref]
|
52
|
+
@response_body ||= if response_hash[:base_ref].is_a?(Nori::StringIOFile)
|
53
|
+
{ :@internal_id => Nokogiri::XML(@response.to_s).remove_namespaces!.at_xpath('//baseRef')[:internalId] }
|
54
|
+
else
|
55
|
+
response_hash[:base_ref]
|
56
|
+
end
|
53
57
|
end
|
54
58
|
|
55
59
|
def response_errors
|
@@ -0,0 +1,87 @@
|
|
1
|
+
module NetSuite
|
2
|
+
module Actions
|
3
|
+
class AttachFile
|
4
|
+
include Support::Requests
|
5
|
+
|
6
|
+
def initialize(object, file)
|
7
|
+
@object = object
|
8
|
+
@file = file
|
9
|
+
end
|
10
|
+
|
11
|
+
private
|
12
|
+
|
13
|
+
def request(credentials = {})
|
14
|
+
NetSuite::Configuration.connection({}, credentials).call(:attach, :message => request_body)
|
15
|
+
end
|
16
|
+
|
17
|
+
# <soap:Body>
|
18
|
+
# <platformMsgs:attach>
|
19
|
+
# <platformCore:attachReference xsi:type="platformCore:AttachContactReference">
|
20
|
+
# <platformCore::attachTo internalId="176" type="customer" xsi:type="platformCore::RecordRef">
|
21
|
+
# </platformCore:attachTo>
|
22
|
+
# <platformCore:attachRecord internalId="1467" type="file" xsi:type="platformCore:RecordRef"/>
|
23
|
+
# </platformCore:attachReference>
|
24
|
+
# </platformMsgs:attach>
|
25
|
+
# </soap:Body>
|
26
|
+
|
27
|
+
def request_body
|
28
|
+
{
|
29
|
+
'platformCore:attachReference' => {
|
30
|
+
'@xsi:type' => 'platformCore:AttachBasicReference',
|
31
|
+
'platformCore:attachTo' => {
|
32
|
+
'@internalId' => @object.internal_id,
|
33
|
+
'@type' => @object.netsuite_type,
|
34
|
+
'@xsi:type' => 'platformCore:RecordRef'
|
35
|
+
},
|
36
|
+
'platformCore:attachedRecord' => {
|
37
|
+
'@internalId' => @file.internal_id,
|
38
|
+
'@type' => 'file',
|
39
|
+
'@xsi:type' => 'platformCore:RecordRef'
|
40
|
+
}
|
41
|
+
}
|
42
|
+
}
|
43
|
+
end
|
44
|
+
|
45
|
+
def success?
|
46
|
+
@success ||= response_hash[:status][:@is_success] == 'true'
|
47
|
+
end
|
48
|
+
|
49
|
+
def response_body
|
50
|
+
@response_body ||= response_hash[:base_ref]
|
51
|
+
end
|
52
|
+
|
53
|
+
def response_errors
|
54
|
+
if response_hash[:status] && response_hash[:status][:status_detail]
|
55
|
+
@response_errors ||= errors
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
def response_hash
|
60
|
+
@response_hash ||= @response.to_hash[:attach_response][:write_response]
|
61
|
+
end
|
62
|
+
|
63
|
+
def errors
|
64
|
+
error_obj = response_hash[:status][:status_detail]
|
65
|
+
error_obj = [error_obj] if error_obj.class == Hash
|
66
|
+
error_obj.map do |error|
|
67
|
+
NetSuite::Error.new(error)
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
module Support
|
72
|
+
def attach_file(file, credentials = {})
|
73
|
+
response = NetSuite::Actions::AttachFile.call([self, file], credentials)
|
74
|
+
|
75
|
+
@errors = response.errors
|
76
|
+
|
77
|
+
if response.success?
|
78
|
+
@internal_id = response.body[:@internal_id]
|
79
|
+
true
|
80
|
+
else
|
81
|
+
false
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
@@ -144,12 +144,23 @@ module NetSuite
|
|
144
144
|
h[element_name] = {
|
145
145
|
'@operator' => condition[:operator],
|
146
146
|
'@xsi:type' => 'platformCore:SearchMultiSelectField',
|
147
|
-
"platformCore:searchValue" =>
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
147
|
+
"platformCore:searchValue" => condition[:value].map do |value|
|
148
|
+
search_value = {
|
149
|
+
:content! => value.to_record,
|
150
|
+
'@xsi:type' => 'platformCore:RecordRef',
|
151
|
+
'@type' => 'account'
|
152
|
+
}
|
153
|
+
|
154
|
+
if value.internal_id
|
155
|
+
search_value['@internalId'] = value.internal_id
|
156
|
+
end
|
157
|
+
|
158
|
+
if value.external_id
|
159
|
+
search_value['@externalId'] = value.external_id
|
160
|
+
end
|
161
|
+
|
162
|
+
search_value
|
163
|
+
end
|
153
164
|
}
|
154
165
|
elsif condition[:value].is_a?(Array) && condition[:type] == 'SearchDateField'
|
155
166
|
# date ranges are handled via searchValue (start range) and searchValue2 (end range)
|
@@ -235,6 +246,8 @@ module NetSuite
|
|
235
246
|
module Support
|
236
247
|
def self.included(base)
|
237
248
|
base.extend(ClassMethods)
|
249
|
+
|
250
|
+
attr_accessor :search_joins
|
238
251
|
end
|
239
252
|
|
240
253
|
module ClassMethods
|
@@ -13,7 +13,7 @@ module NetSuite
|
|
13
13
|
record_refs :parent
|
14
14
|
|
15
15
|
attr_reader :internal_id
|
16
|
-
attr_accessor :external_id
|
16
|
+
attr_accessor :external_id
|
17
17
|
|
18
18
|
def initialize(attributes = {})
|
19
19
|
@internal_id = attributes.delete(:internal_id) || attributes.delete(:@internal_id)
|
@@ -15,7 +15,6 @@ module NetSuite
|
|
15
15
|
|
16
16
|
attr_reader :internal_id
|
17
17
|
attr_accessor :external_id
|
18
|
-
attr_accessor :search_joins
|
19
18
|
|
20
19
|
def initialize(attributes = {})
|
21
20
|
@internal_id = attributes.delete(:internal_id) || attributes.delete(:@internal_id)
|
@@ -25,4 +24,3 @@ module NetSuite
|
|
25
24
|
end
|
26
25
|
end
|
27
26
|
end
|
28
|
-
|
@@ -12,7 +12,7 @@ module NetSuite
|
|
12
12
|
:search
|
13
13
|
|
14
14
|
fields :bin_numbers, :built, :created_date, :expiration_date,
|
15
|
-
:last_modified_date, :memo, :quantity, :serial_numbers,
|
15
|
+
:last_modified_date, :memo, :quantity, :serial_numbers,
|
16
16
|
:tran_date, :tran_id
|
17
17
|
|
18
18
|
read_only_fields :total
|
@@ -26,7 +26,6 @@ module NetSuite
|
|
26
26
|
|
27
27
|
attr_reader :internal_id
|
28
28
|
attr_accessor :external_id
|
29
|
-
attr_accessor :search_joins
|
30
29
|
|
31
30
|
def initialize(attributes = {})
|
32
31
|
@internal_id = attributes.delete(:internal_id) || attributes.delete(:@internal_id)
|
@@ -36,5 +35,3 @@ module NetSuite
|
|
36
35
|
end
|
37
36
|
end
|
38
37
|
end
|
39
|
-
|
40
|
-
|
@@ -7,7 +7,7 @@ module NetSuite
|
|
7
7
|
include Support::Actions
|
8
8
|
include Namespaces::TranSales
|
9
9
|
|
10
|
-
actions :get, :add, :initialize, :delete, :update, :upsert, :search
|
10
|
+
actions :get, :add, :initialize, :delete, :update, :upsert, :upsert_list, :search
|
11
11
|
|
12
12
|
fields :alt_handling_cost, :alt_shipping_cost, :auth_code, :bill_address, :cc_approved, :cc_expire_date, :cc_is_purchase_card_bin,
|
13
13
|
:cc_name, :cc_number, :cc_process_as_purchas_card, :cc_security_code, :cc_street, :cc_zip_code, :charge_it, :contrib_pct, :created_date,
|
@@ -36,7 +36,6 @@ module NetSuite
|
|
36
36
|
|
37
37
|
attr_reader :internal_id
|
38
38
|
attr_accessor :external_id
|
39
|
-
attr_accessor :search_joins
|
40
39
|
|
41
40
|
def initialize(attributes = {})
|
42
41
|
@internal_id = attributes.delete(:internal_id) || attributes.delete(:@internal_id)
|
@@ -12,7 +12,7 @@ module NetSuite
|
|
12
12
|
|
13
13
|
actions :get, :get_list, :search
|
14
14
|
|
15
|
-
fields :
|
15
|
+
fields :effective_date, :exchange_rate
|
16
16
|
|
17
17
|
record_refs :base_currency, :transaction_currency
|
18
18
|
|
@@ -21,7 +21,6 @@ module NetSuite
|
|
21
21
|
|
22
22
|
attr_reader :internal_id
|
23
23
|
attr_accessor :external_id
|
24
|
-
attr_accessor :search_joins
|
25
24
|
|
26
25
|
def initialize(attributes = {})
|
27
26
|
@internal_id = attributes.delete(:internal_id) || attributes.delete(:@internal_id)
|
@@ -17,12 +17,12 @@ module NetSuite
|
|
17
17
|
:show_last_modified, :show_notes, :show_owner, :show_owner_allow_change, :show_owner_on_list, :use_permissions
|
18
18
|
|
19
19
|
field :custom_field_list, CustomFieldList
|
20
|
+
field :translations_list, TranslationList
|
20
21
|
|
21
22
|
record_refs :custom_form, :owner, :rec_type, :parent
|
22
23
|
|
23
24
|
attr_reader :internal_id
|
24
25
|
attr_accessor :external_id
|
25
|
-
attr_accessor :search_joins
|
26
26
|
|
27
27
|
def initialize(attributes = {})
|
28
28
|
@internal_id = attributes.delete(:internal_id) || attributes.delete(:@internal_id)
|
@@ -15,7 +15,7 @@ module NetSuite
|
|
15
15
|
|
16
16
|
field :custom_field_list, CustomFieldList
|
17
17
|
field :subsidiary_list, RecordRefList
|
18
|
-
|
18
|
+
field :translations_list, TranslationList
|
19
19
|
|
20
20
|
attr_reader :internal_id
|
21
21
|
attr_accessor :external_id
|