Class: NetSuite::Records::CustomRecordRef
- Inherits:
-
Object
- Object
- NetSuite::Records::CustomRecordRef
- Includes:
- Namespaces::PlatformCore, Support::Fields, Support::Records
- Defined in:
- lib/netsuite/records/custom_record_ref.rb
Instance Attribute Summary collapse
-
#external_id ⇒ Object
Returns the value of attribute external_id.
-
#internal_id ⇒ Object
readonly
Returns the value of attribute internal_id.
-
#type_id ⇒ Object
Returns the value of attribute type_id.
Instance Method Summary collapse
-
#initialize(attributes_or_record = {}) ⇒ CustomRecordRef
constructor
A new instance of CustomRecordRef.
- #method_missing(m, *args, &block) ⇒ Object
- #to_record ⇒ Object
Methods included from Namespaces::PlatformCore
Methods included from Support::Records
#record_type, #refresh, #to_attributes!
Methods included from Support::Attributes
#attributes, #attributes=, #initialize_from_attributes_hash
Methods included from Support::Fields
Constructor Details
#initialize(attributes_or_record = {}) ⇒ CustomRecordRef
Returns a new instance of CustomRecordRef.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/netsuite/records/custom_record_ref.rb', line 13 def initialize(attributes_or_record = {}) case attributes_or_record when Hash attributes = attributes_or_record attributes.delete(:"@xmlns:platform_core") @internal_id = attributes.delete(:internal_id) || attributes.delete(:@internal_id) @external_id = attributes.delete(:external_id) || attributes.delete(:@external_id) @type_id = attributes.delete(:type_id) || attributes.delete(:@type_id) @type_id = @type_id.to_s if @type_id initialize_from_attributes_hash(attributes) else record = attributes_or_record @internal_id = record.internal_id if record.respond_to?(:internal_id) @external_id = record.external_id if record.respond_to?(:external_id) @type_id = record.class.type_id if record.class.respond_to?(:type_id) && record.class.type_id @type_id = @type_id.to_s if @type_id end end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(m, *args, &block) ⇒ Object
32 33 34 35 36 37 38 |
# File 'lib/netsuite/records/custom_record_ref.rb', line 32 def method_missing(m, *args, &block) if attributes.keys.map(&:to_sym).include?(m.to_sym) attributes[m.to_sym] else super end end |
Instance Attribute Details
#external_id ⇒ Object
Returns the value of attribute external_id.
9 10 11 |
# File 'lib/netsuite/records/custom_record_ref.rb', line 9 def external_id @external_id end |
#internal_id ⇒ Object (readonly)
Returns the value of attribute internal_id.
8 9 10 |
# File 'lib/netsuite/records/custom_record_ref.rb', line 8 def internal_id @internal_id end |
#type_id ⇒ Object
Returns the value of attribute type_id.
9 10 11 |
# File 'lib/netsuite/records/custom_record_ref.rb', line 9 def type_id @type_id end |
Instance Method Details
#to_record ⇒ Object
40 41 42 43 44 45 |
# File 'lib/netsuite/records/custom_record_ref.rb', line 40 def to_record rec = super rec[:@internalId] = @internal_id if @internal_id rec[:@typeId] = @type_id if @type_id rec end |