Class: NetSuite::Records::RecordRef
- Inherits:
-
Object
- Object
- NetSuite::Records::RecordRef
- Includes:
- Namespaces::PlatformCore, Support::Fields, Support::Records
- Defined in:
- lib/netsuite/records/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 ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(attributes_or_record = {}) ⇒ RecordRef
constructor
A new instance of RecordRef.
- #method_missing(m, *args, &block) ⇒ Object
Methods included from Namespaces::PlatformCore
Methods included from Support::Records
#record_type, #refresh, #to_attributes!, #to_record
Methods included from Support::Attributes
#attributes, #attributes=, #initialize_from_attributes_hash
Methods included from Support::Fields
Constructor Details
#initialize(attributes_or_record = {}) ⇒ RecordRef
Returns a new instance of RecordRef.
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/netsuite/records/record_ref.rb', line 11 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 = attributes.delete(:type) || attributes.delete(:@type) || attributes.delete(:"@xsi:type") @attributes = 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 = record.class.to_s.split('::').last.lower_camelcase end end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(m, *args, &block) ⇒ Object
28 29 30 31 32 33 34 |
# File 'lib/netsuite/records/record_ref.rb', line 28 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/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/record_ref.rb', line 8 def internal_id @internal_id end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
8 9 10 |
# File 'lib/netsuite/records/record_ref.rb', line 8 def type @type end |