Class: NetSuite::Records::ItemAvailability

Inherits:
Object
  • Object
show all
Includes:
Support::Fields, Support::RecordRefs, Support::Records
Defined in:
lib/netsuite/records/item_availability.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Support::Records

#netsuite_type, netsuite_type, #record_type, #record_type_without_namespace, record_type_without_namespace, #refresh, #to_attributes!, #to_record

Methods included from Namespaces::PlatformCore

#record_namespace

Methods included from Support::Attributes

#attributes, #attributes=, #initialize_from_attributes_hash

Methods included from Support::RecordRefs

included

Methods included from Support::Fields

included

Constructor Details

#initialize(attributes = {}) ⇒ ItemAvailability

Returns a new instance of ItemAvailability.



41
42
43
# File 'lib/netsuite/records/item_availability.rb', line 41

def initialize(attributes = {})
  initialize_from_attributes_hash(attributes)
end

Class Method Details

.get_item_availability(ref_list, credentials = {}) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/netsuite/records/item_availability.rb', line 19

def self.get_item_availability(ref_list, credentials={})
  connection = NetSuite::Configuration.connection({}, credentials)
  response = connection.call :get_item_availability, message: {
    "platformMsgs:itemAvailabilityFilter" => {
      "platformCore:item" => ref_list.to_record
    }
  }
  return false unless response.success?

  result = response.body[:get_item_availability_response][:get_item_availability_result]
  unless result[:status][:@is_success] == "true"
    return false
  end
  if result[:item_availability_list]
    result[:item_availability_list][:item_availability].map do |row|
      NetSuite::Records::ItemAvailability.new(row)
    end
  else
    []
  end
end