class NetSuite::Actions::GetAll

Public Class Methods

new(klass) click to toggle source
# File lib/netsuite/actions/get_all.rb, line 7
def initialize(klass)
  @klass   = klass
end

Private Instance Methods

request(credentials={}) click to toggle source
# File lib/netsuite/actions/get_all.rb, line 13
def request(credentials={})
  NetSuite::Configuration.connection(
    { element_form_default: :unqualified }, credentials
  ).call(:get_all, message: request_body)
end
request_body() click to toggle source

<soap:Body>

<platformMsgs:getAll>
  <record>
    <recordType>salesTaxItem</recordType>
  </record>
</platformMsgs:getAll>

</soap:Body>

# File lib/netsuite/actions/get_all.rb, line 26
def request_body
  type = @klass.to_s.split('::').last.sub(/[A-Z]/) { |m| m[0].downcase }

  {
    record: [
      record_type: type
    ]
  }
end
response_body() click to toggle source
# File lib/netsuite/actions/get_all.rb, line 40
def response_body
  @response_body ||= if success?
    array_wrap(response_hash[:record_list][:record])
  else
    nil
  end
end
response_hash() click to toggle source
# File lib/netsuite/actions/get_all.rb, line 48
def response_hash
  @response_hash ||= @response.body[:get_all_response][:get_all_result]
end
success?() click to toggle source
# File lib/netsuite/actions/get_all.rb, line 36
def success?
  @success ||= response_hash[:status][:@is_success] == 'true'
end