Module: NetSuite::Support::Attributes

Included in:
Fields, Records
Defined in:
lib/netsuite/support/attributes.rb

Instance Method Summary collapse

Instance Method Details

#attributesObject



5
6
7
# File 'lib/netsuite/support/attributes.rb', line 5

def attributes
  @attributes ||= {}
end

#attributes=(attributes) ⇒ Object



9
10
11
# File 'lib/netsuite/support/attributes.rb', line 9

def attributes=(attributes)
  @attributes = attributes
end

#initialize_from_attributes_hash(attributes = {}) ⇒ Object



13
14
15
16
17
18
# File 'lib/netsuite/support/attributes.rb', line 13

def initialize_from_attributes_hash(attributes = {})
  attributes.select { |k,v| self.class.fields.include?(k) }.each do |k,v|
    send("#{k}=", v)
  end
  self.klass = attributes[:class] if attributes[:class]
end