Module: ActiveCampaign::Attributes

Extended by:
ActiveSupport::Concern
Included in:
Model
Defined in:
lib/active_campaign/api_attributes.rb

Overview

:nodoc:

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#only_changes_to_paramsObject



7
8
9
10
11
12
13
14
15
# File 'lib/active_campaign/api_attributes.rb', line 7

def only_changes_to_params
  return nil unless changed?

  root, root_params = to_params.first

  {
    root => root_params.slice(*changed)
  }
end

#rollback!Object

def reload!

# get the values from the persistence layer
clear_changes_information

end



84
85
86
# File 'lib/active_campaign/api_attributes.rb', line 84

def rollback!
  restore_attributes
end

#to_paramsObject



17
18
19
20
21
22
23
# File 'lib/active_campaign/api_attributes.rb', line 17

def to_params
  iv = instance_variables - %i[@mutations_from_database @mutations_before_last_save]

  {
    self.class.root_element => iv.map { |v| [v.to_s.delete("@"), instance_variable_get(v)] }.to_h
  }
end