class NetSuite::Actions::GetDeleted
Public Class Methods
new(object = nil, options = {})
click to toggle source
# File lib/netsuite/actions/get_deleted.rb, line 6 def initialize(object = nil, options = {}) @object = object @options = options end
Private Instance Methods
request(credentials={})
click to toggle source
# File lib/netsuite/actions/get_deleted.rb, line 13 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
request_body()
click to toggle source
<soap:Body>
<platformMsgs:getDeleted> <platformMsgs:pageIndex>1</platformMsgs:pageIndex> <platformMsgs:getDeletedFilter> <platformCore:deletedDate operator="within"> <platformCore:searchValue>2016-12-01T00:00:00</platformCore:searchValue> <platformCore:searchValue2>2016-12-20T00:00:00</platformCore:searchValue2> </platformCore:deletedDate> <platformCore:type operator="anyOf"> <platformCore:searchValue>invoice</platformCore:searchValue> </platformCore:type> </platformMsgs:getDeletedFilter> </platformMsgs:getDeleted>
</soap:Body>
# File lib/netsuite/actions/get_deleted.rb, line 40 def request_body criteria = @options[:criteria] || @options filter_elements = {} criteria.each do |c| searchValue = { "@operator" => c[:operator] } if c[:value].is_a?(Array) && c[:type] == 'SearchDateField' searchValue["platformCore:searchValue"] = c[:value][0].to_s searchValue["platformCore:searchValue2"] = c[:value][1].to_s else searchValue["platformCore:searchValue"] = c[:value] end filter_elements["platformCore:#{c[:field]}"] = searchValue end { 'platformMsgs:pageIndex' => @options.fetch(:page, 1), 'platformMsgs:getDeletedFilter' => filter_elements } end
response_body()
click to toggle source
# File lib/netsuite/actions/get_deleted.rb, line 71 def response_body @response_body ||= response_hash[:get_deleted_result] end
response_hash()
click to toggle source
# File lib/netsuite/actions/get_deleted.rb, line 63 def response_hash @response.body[:get_deleted_response] end
soap_type()
click to toggle source
# File lib/netsuite/actions/get_deleted.rb, line 22 def soap_type @object.class.to_s.split('::').last.lower_camelcase end
success?()
click to toggle source
# File lib/netsuite/actions/get_deleted.rb, line 67 def success? @success ||= response_body[:status][:@is_success] == 'true' end