Module: NetSuiteRails::RecordSync::ClassMethods
- Defined in:
- lib/netsuite_rails/record_sync.rb
Instance Attribute Summary collapse
-
#netsuite_custom_record_type_id ⇒ Object
Returns the value of attribute netsuite_custom_record_type_id.
-
#netsuite_sync_options ⇒ Object
Returns the value of attribute netsuite_sync_options.
Instance Method Summary collapse
- #after_netsuite_pull(callback = nil, &block) ⇒ Object
- #after_netsuite_push(callback = nil, &block) ⇒ Object
-
#before_netsuite_push(callback = nil, &block) ⇒ Object
TODO is there a better way to implement callback chains? github.com/rails/rails/blob/0c0f278ab20f3042cdb69604166e18a61f8605ad/activesupport/lib/active_support/callbacks.rb#L491.
-
#netsuite_custom_record? ⇒ Boolean
there is a model level of this method in order to be based on the model level record class.
- #netsuite_field_hints(list = nil) ⇒ Object
- #netsuite_field_map(field_mapping = nil) ⇒ Object
- #netsuite_poll(opts = {}) ⇒ Object
-
#netsuite_record_class(record_class = nil, custom_record_type_id = nil) ⇒ Object
TODO persist type for CustomRecordRef.
-
#netsuite_sync(flag = nil, opts = {}) ⇒ Object
:read, :write_only, :read_write.
Instance Attribute Details
#netsuite_custom_record_type_id ⇒ Object
Returns the value of attribute netsuite_custom_record_type_id.
37 38 39 |
# File 'lib/netsuite_rails/record_sync.rb', line 37 def netsuite_custom_record_type_id @netsuite_custom_record_type_id end |
#netsuite_sync_options ⇒ Object
Returns the value of attribute netsuite_sync_options.
38 39 40 |
# File 'lib/netsuite_rails/record_sync.rb', line 38 def @netsuite_sync_options end |
Instance Method Details
#after_netsuite_pull(callback = nil, &block) ⇒ Object
53 54 55 56 |
# File 'lib/netsuite_rails/record_sync.rb', line 53 def after_netsuite_pull(callback = nil, &block) self.netsuite_settings[:after_netsuite_pull] << (callback || block) if callback || block self.netsuite_settings[:after_netsuite_pull] end |
#after_netsuite_push(callback = nil, &block) ⇒ Object
48 49 50 51 |
# File 'lib/netsuite_rails/record_sync.rb', line 48 def after_netsuite_push(callback = nil, &block) self.netsuite_settings[:after_netsuite_push] << (callback || block) if callback || block self.netsuite_settings[:after_netsuite_push] end |
#before_netsuite_push(callback = nil, &block) ⇒ Object
TODO is there a better way to implement callback chains?
https://github.com/rails/rails/blob/0c0f278ab20f3042cdb69604166e18a61f8605ad/activesupport/lib/active_support/callbacks.rb#L491
43 44 45 46 |
# File 'lib/netsuite_rails/record_sync.rb', line 43 def before_netsuite_push(callback = nil, &block) self.netsuite_settings[:before_netsuite_push] << (callback || block) if callback || block self.netsuite_settings[:before_netsuite_push] end |
#netsuite_custom_record? ⇒ Boolean
there is a model level of this method in order to be based on the model level record class
85 86 87 |
# File 'lib/netsuite_rails/record_sync.rb', line 85 def netsuite_custom_record? self.netsuite_record_class == NetSuite::Records::CustomRecord end |
#netsuite_field_hints(list = nil) ⇒ Object
66 67 68 69 70 71 72 |
# File 'lib/netsuite_rails/record_sync.rb', line 66 def netsuite_field_hints(list = nil) if !list.nil? self.netsuite_settings[:netsuite_field_hints] = list end self.netsuite_settings[:netsuite_field_hints] end |
#netsuite_field_map(field_mapping = nil) ⇒ Object
58 59 60 61 62 63 64 |
# File 'lib/netsuite_rails/record_sync.rb', line 58 def netsuite_field_map(field_mapping = nil) if !field_mapping.nil? self.netsuite_settings[:netsuite_field_map] = field_mapping end self.netsuite_settings[:netsuite_field_map] end |
#netsuite_poll(opts = {}) ⇒ Object
33 34 35 |
# File 'lib/netsuite_rails/record_sync.rb', line 33 def netsuite_poll(opts = {}) RecordSync::PollManager.poll(self, opts) end |
#netsuite_record_class(record_class = nil, custom_record_type_id = nil) ⇒ Object
TODO persist type for CustomRecordRef
75 76 77 78 79 80 81 82 |
# File 'lib/netsuite_rails/record_sync.rb', line 75 def netsuite_record_class(record_class = nil, custom_record_type_id = nil) if !record_class.nil? self.netsuite_settings[:netsuite_record_class] = record_class self.netsuite_custom_record_type_id = custom_record_type_id end self.netsuite_settings[:netsuite_record_class] end |
#netsuite_sync(flag = nil, opts = {}) ⇒ Object
:read, :write_only, :read_write
90 91 92 93 94 95 96 97 |
# File 'lib/netsuite_rails/record_sync.rb', line 90 def netsuite_sync(flag = nil, opts = {}) if !flag.nil? self. = opts self.netsuite_settings[:netsuite_sync] = flag end self.netsuite_settings[:netsuite_sync] end |