Module: NetSuite::Actions::SearchMoreWithId::Support::ClassMethods

Defined in:
lib/netsuite/actions/search_more_with_id.rb

Overview

TODO: Rename page_index to page

Instance Method Summary collapse

Instance Method Details

#search_more_with_id(options = { }) ⇒ Object

Preconditions

> options is a string

> options, optional, is an integer

Postconditions

> Hash with the following keys:

* page_index which is an integer
* total_pages which is an integer
* search_results containing array of SearchResult's


75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# File 'lib/netsuite/actions/search_more_with_id.rb', line 75

def search_more_with_id(options = { })
  response = NetSuite::Actions::SearchMoreWithId.call(self, options)

  response_hash = { }

  if response.success?
    search_results = []

    if response.body[:search_row_list].present?
      response.body[:search_row_list][:search_row].each do |record|
        search_result = NetSuite::Support::SearchResult.new(record)

        search_results << search_result
      end
    end

    page_index = response.body[:page_index]
    total_pages = response.body[:total_pages]

    response_hash[:page_index] = page_index
    response_hash[:total_pages] = total_pages
    response_hash[:search_results] = search_results

    response_hash
  else
    raise ArgumentError
  end
end