Class: Retab::DeclarativePlanChange

Inherits:
Types::BaseModel show all
Defined in:
lib/retab/workflow_specs/declarative_plan_change.rb

Constant Summary collapse

HASH_ATTRS =
{
  before: :before,
  after: :after,
  before_sensitive: :before_sensitive,
  after_sensitive: :after_sensitive,
  field_changes: :field_changes
}.freeze

Instance Attribute Summary collapse

Attributes inherited from Types::BaseModel

#last_response

Instance Method Summary collapse

Methods inherited from Types::BaseModel

#inspect, normalize, #to_h, #to_json

Constructor Details

#initialize(json) ⇒ DeclarativePlanChange

Returns a new instance of DeclarativePlanChange.



23
24
25
26
27
28
29
30
# File 'lib/retab/workflow_specs/declarative_plan_change.rb', line 23

def initialize(json)
  hash = self.class.normalize(json)
  @before = hash[:before]
  @after = hash[:after]
  @before_sensitive = hash[:before_sensitive]
  @after_sensitive = hash[:after_sensitive]
  @field_changes = (hash[:field_changes] || []).map { |item| item ? Retab::DeclarativePlanFieldChange.new(item) : nil }
end

Instance Attribute Details

#afterObject

Returns the value of attribute after.



16
17
18
# File 'lib/retab/workflow_specs/declarative_plan_change.rb', line 16

def after
  @after
end

#after_sensitiveObject

Returns the value of attribute after_sensitive.



16
17
18
# File 'lib/retab/workflow_specs/declarative_plan_change.rb', line 16

def after_sensitive
  @after_sensitive
end

#beforeObject

Returns the value of attribute before.



16
17
18
# File 'lib/retab/workflow_specs/declarative_plan_change.rb', line 16

def before
  @before
end

#before_sensitiveObject

Returns the value of attribute before_sensitive.



16
17
18
# File 'lib/retab/workflow_specs/declarative_plan_change.rb', line 16

def before_sensitive
  @before_sensitive
end

#field_changesObject

Returns the value of attribute field_changes.



16
17
18
# File 'lib/retab/workflow_specs/declarative_plan_change.rb', line 16

def field_changes
  @field_changes
end