Sha256: 0c92aacfd3a36ac8cb4b4ad9dbb29bf6bc2f820abbf55d12c3f8da22b7af63f3
Contents?: true
Size: 1.87 KB
Versions: 5
Compression:
Stored size: 1.87 KB
Contents
module NetSuite module Actions class GetSelectValue include Support::Requests def initialize(klass, options = {}) @klass = klass @options = options end private def request 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" }, ).call :get_select_value, :message => @options end def success? @success ||= response_hash[:status][:@is_success] == 'true' end def response_body @response_body ||= response_hash[:base_ref_list] end def response_hash @response_hash = @response.body[:get_select_value_response][:get_select_value_result] end module Support def self.included(base) base.extend(ClassMethods) end module ClassMethods def get_select_value(options = {}) message = { pageIndex: (options.delete(:pageIndex) || 1), fieldDescription: field_description(options) } response = NetSuite::Actions::GetSelectValue.call(self, message) if response.success? new(response.body) else raise RecordNotFound, "#{self} with OPTIONS=#{options.inspect} could not be found" end end private # TODO this goes against the design of the rest of the gem; should be removed in the future def field_description(options) options.inject({}) do |h, (k, v)| h["platformCore:#{k}"] = v h end end end end end end end
Version data entries
5 entries across 5 versions & 1 rubygems