Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
ericcj committed Oct 13, 2023
2 parents 785e288 + f853c94 commit 874b31e
Show file tree
Hide file tree
Showing 41 changed files with 431 additions and 176 deletions.
2 changes: 1 addition & 1 deletion .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
github: [NetSweet]
github: [iloveitaly]
2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
ruby-version: [3.1, 3.0, 2.7, 2.6, 2.5, 2.4, 2.3, 2.2, 2.1]
ruby-version: [3.2, 3.1, 3.0, 2.7, 2.6, 2.5, 2.4, 2.3]
bundle-tzinfo: [true, false]
env:
BUNDLE_TZINFO: "${{ matrix.bundle-tzinfo }}"
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Ruby ${{ matrix.ruby-version }}
uses: ruby/setup-ruby@v1
with:
Expand Down
28 changes: 28 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,36 @@
## Unreleased

### Added
* Add `get_deleted` action to `CustomerCategory` (#595)

### Fixed
* Revert recent proxy changes which breaks proxy usage by @andrewdicken-stripe in https://github.com/NetSweet/netsuite/pull/579

### Breaking Changes

## v0.9.3

### Added
* Create abstract action parent class by @andrewdicken-stripe in https://github.com/NetSweet/netsuite/pull/568

### Fixed
* Add department, klass and location EstimateItem/record_refs by @nickdufresne in https://github.com/NetSweet/netsuite/pull/572
* Invoice shipping_tax_code should be a record_ref by @stevewoodcock in https://github.com/NetSweet/netsuite/pull/573
* dont crash if suitetalk returns empty <platformCore:searchRowList/> by @ericcj in https://github.com/NetSweet/netsuite/pull/574
* Add :klass field to record VendorReturnAuthorizationItem & VendorReturnAuthorization by @shubhrathasetty in https://github.com/NetSweet/netsuite/pull/576
* Optionally pass in `proxy` parameter to Savon by @dbecker-stripe in https://github.com/NetSweet/netsuite/pull/548

## v0.9.2

### Fixed

* Update rspec requirement from ~> 3.11.0 to ~> 3.12.0 by @dependabot in https://github.com/NetSweet/netsuite/pull/567
* [Adding UK country mapping](https://github.com/NetSweet/netsuite/commit/5fe96ed28fb8341b6926e169cf50d817632b5b8d)

### Breaking Changes

* [remove country mapping hack for old API versions](https://github.com/NetSweet/netsuite/commit/a0357f0a9e08eb3a4a80f1d1e7a37f95bcb17d4f)

## v0.9.1

### Added
Expand All @@ -30,6 +55,9 @@ The following were removed as `fields` since their sublist class is not yet impl
* Add `update` action to `File` records (#544)
* Expose `errors` after calls to `delete` action (#545)
* Add `update_list` action where missing on supported item records (#546)
* Add `proxy` attribute to `NetSuite::Configuration` to set a proxy used by the savon client (#547)

### Fixed
* Ignore `after_submit_failed` status details (>= 2018.2) when collating errors in add action (#550)
* Add `NullFieldList` to `SalesOrder` (#552)
* Add thread safety to NetSuite configuration and utilities (#549)
Expand Down
1 change: 1 addition & 0 deletions lib/netsuite.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ module Support
end

module Actions
autoload :AbstractAction, 'netsuite/actions/abstract_action'
autoload :Add, 'netsuite/actions/add'
autoload :AttachFile, 'netsuite/actions/attach_file'
autoload :Delete, 'netsuite/actions/delete'
Expand Down
32 changes: 32 additions & 0 deletions lib/netsuite/actions/abstract_action.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
module NetSuite
module Actions
class AbstractAction
def request(credentials={})
NetSuite::Configuration.connection(request_options, credentials, soap_header_extra_info).call(action_name, message: request_body)
end

protected

def action_name
raise NotImplementedError, 'Not implemented on abstract class'
end

def initialize
raise NotImplementedError, 'Not implemented on abstract class'
end

def request_body
raise NotImplementedError, 'Not implemented on abstract class'
end

def request_options
{}
end

def soap_header_extra_info
{}
end
end
end
end

10 changes: 5 additions & 5 deletions lib/netsuite/actions/add.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# https://system.netsuite.com/help/helpcenter/en_US/Output/Help/SuiteCloudCustomizationScriptingWebServices/SuiteTalkWebServices/add.html
module NetSuite
module Actions
class Add
class Add < AbstractAction
include Support::Requests

attr_reader :response_hash
Expand All @@ -12,10 +12,6 @@ def initialize(object = nil)

private

def request(credentials={})
NetSuite::Configuration.connection({}, credentials).call(:add, :message => request_body)
end

# <soap:Body>
# <platformMsgs:add>
# <platformMsgs:record xsi:type="listRel:Customer">
Expand Down Expand Up @@ -66,6 +62,10 @@ def response_hash
@response_hash ||= @response.to_hash[:add_response][:write_response]
end

def action_name
:add
end

def errors
error_obj = response_hash[:status][:status_detail]
error_obj = [error_obj] if error_obj.class == Hash
Expand Down
10 changes: 5 additions & 5 deletions lib/netsuite/actions/attach_file.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module NetSuite
module Actions
class AttachFile
class AttachFile < AbstractAction
include Support::Requests

def initialize(object, file)
Expand All @@ -10,10 +10,6 @@ def initialize(object, file)

private

def request(credentials = {})
NetSuite::Configuration.connection({}, credentials).call(:attach, :message => request_body)
end

# <soap:Body>
# <platformMsgs:attach>
# <platformCore:attachReference xsi:type="platformCore:AttachContactReference">
Expand Down Expand Up @@ -60,6 +56,10 @@ def response_hash
@response_hash ||= @response.to_hash[:attach_response][:write_response]
end

def action_name
:attach
end

def errors
error_obj = response_hash[:status][:status_detail]
error_obj = [error_obj] if error_obj.class == Hash
Expand Down
24 changes: 14 additions & 10 deletions lib/netsuite/actions/delete.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# https://system.netsuite.com/help/helpcenter/en_US/Output/Help/SuiteCloudCustomizationScriptingWebServices/SuiteTalkWebServices/delete.html
module NetSuite
module Actions
class Delete
class Delete < AbstractAction
include Support::Requests

def initialize(object = nil, options = {})
Expand All @@ -11,15 +11,6 @@ def initialize(object = nil, options = {})

private

def request(credentials={})
NetSuite::Configuration.connection(
{namespaces: {
'xmlns:platformMsgs' => "urn:messages_#{NetSuite::Configuration.api_version}.platform.webservices.netsuite.com",
'xmlns:platformCore' => "urn:core_#{NetSuite::Configuration.api_version}.platform.webservices.netsuite.com"
}}, credentials
).call :delete, message: request_body
end

def soap_type
NetSuite::Support::Records.netsuite_type(@object)
end
Expand Down Expand Up @@ -71,6 +62,19 @@ def response_errors
end
end

def request_options
{
namespaces: {
'xmlns:platformMsgs' => "urn:messages_#{NetSuite::Configuration.api_version}.platform.webservices.netsuite.com",
'xmlns:platformCore' => "urn:core_#{NetSuite::Configuration.api_version}.platform.webservices.netsuite.com"
}
}
end

def action_name
:delete
end

def errors
error_obj = response_hash[:status][:status_detail]
error_obj = [error_obj] if error_obj.class == Hash
Expand Down
24 changes: 14 additions & 10 deletions lib/netsuite/actions/delete_list.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module NetSuite
module Actions
class DeleteList
class DeleteList < AbstractAction
include Support::Requests

def initialize(klass, options = { })
Expand All @@ -10,15 +10,6 @@ def initialize(klass, options = { })

private

def request(credentials={})
NetSuite::Configuration.connection(
{namespaces: {
'xmlns:platformMsgs' => "urn:messages_#{NetSuite::Configuration.api_version}.platform.webservices.netsuite.com",
'xmlns:platformCore' => "urn:core_#{NetSuite::Configuration.api_version}.platform.webservices.netsuite.com"
}}, credentials
).call :delete_list, message: request_body
end

# <soap:Body>
# <platformMsgs:deleteList>
# <platformMsgs:baseRef internalId="1" type="customer" xsi:type="platformCore:RecordRef"/>
Expand Down Expand Up @@ -71,6 +62,19 @@ def response_errors
end
end

def request_options
{
namespaces: {
'xmlns:platformMsgs' => "urn:messages_#{NetSuite::Configuration.api_version}.platform.webservices.netsuite.com",
'xmlns:platformCore' => "urn:core_#{NetSuite::Configuration.api_version}.platform.webservices.netsuite.com"
}
}
end

def action_name
:delete_list
end

def errors
errors = response_list.select { |r| r[:status] && r[:status][:status_detail] }.map do |obj|
error_obj = obj[:status][:status_detail]
Expand Down
24 changes: 14 additions & 10 deletions lib/netsuite/actions/get.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# https://system.netsuite.com/help/helpcenter/en_US/Output/Help/SuiteCloudCustomizationScriptingWebServices/SuiteTalkWebServices/get.html
module NetSuite
module Actions
class Get
class Get < AbstractAction
include Support::Requests

def initialize(klass, options = {})
Expand All @@ -11,15 +11,6 @@ def initialize(klass, options = {})

private

def request(credentials={})
NetSuite::Configuration.connection(
{namespaces: {
'xmlns:platformMsgs' => "urn:messages_#{NetSuite::Configuration.api_version}.platform.webservices.netsuite.com",
'xmlns:platformCore' => "urn:core_#{NetSuite::Configuration.api_version}.platform.webservices.netsuite.com"
}}, credentials
).call :get, message: request_body
end

def soap_type
NetSuite::Support::Records.netsuite_type(@klass)
end
Expand Down Expand Up @@ -56,6 +47,19 @@ def response_hash
@response_hash = @response.body[:get_response][:read_response]
end

def request_options
{
namespaces: {
'xmlns:platformMsgs' => "urn:messages_#{NetSuite::Configuration.api_version}.platform.webservices.netsuite.com",
'xmlns:platformCore' => "urn:core_#{NetSuite::Configuration.api_version}.platform.webservices.netsuite.com"
}
}
end

def action_name
:get
end

module Support

def self.included(base)
Expand Down
18 changes: 11 additions & 7 deletions lib/netsuite/actions/get_all.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# https://system.netsuite.com/help/helpcenter/en_US/Output/Help/SuiteCloudCustomizationScriptingWebServices/SuiteTalkWebServices/getAll.html
module NetSuite
module Actions
class GetAll
class GetAll < AbstractAction
include Support::Requests

def initialize(klass)
Expand All @@ -10,12 +10,6 @@ def initialize(klass)

private

def request(credentials={})
NetSuite::Configuration.connection(
{ element_form_default: :unqualified }, credentials
).call(:get_all, message: request_body)
end

# <soap:Body>
# <platformMsgs:getAll>
# <record>
Expand Down Expand Up @@ -49,6 +43,16 @@ def response_hash
@response_hash ||= @response.body[:get_all_response][:get_all_result]
end

def request_options
{
element_form_default: :unqualified
}
end

def action_name
:get_all
end

module Support

def self.included(base)
Expand Down
24 changes: 14 additions & 10 deletions lib/netsuite/actions/get_deleted.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module NetSuite
module Actions
class GetDeleted
class GetDeleted < AbstractAction
include Support::Requests

def initialize(object = nil, options = {})
Expand All @@ -10,15 +10,6 @@ def initialize(object = nil, options = {})

private

def request(credentials={})
NetSuite::Configuration.connection(
{namespaces: {
'xmlns:platformMsgs' => "urn:messages_#{NetSuite::Configuration.api_version}.platform.webservices.netsuite.com",
'xmlns:platformCore' => "urn:core_#{NetSuite::Configuration.api_version}.platform.webservices.netsuite.com"
}}, credentials
).call :get_deleted, message: request_body
end

def soap_type
NetSuite::Support::Records.netsuite_type(@object)
end
Expand Down Expand Up @@ -72,6 +63,19 @@ def response_body
@response_body ||= response_hash[:get_deleted_result]
end

def request_options
{
namespaces: {
'xmlns:platformMsgs' => "urn:messages_#{NetSuite::Configuration.api_version}.platform.webservices.netsuite.com",
'xmlns:platformCore' => "urn:core_#{NetSuite::Configuration.api_version}.platform.webservices.netsuite.com"
}
}
end

def action_name
:get_deleted
end

module Support
def self.included(base)
base.extend(ClassMethods)
Expand Down
Loading

0 comments on commit 874b31e

Please sign in to comment.