Class: Icalia::Event::Deserializer

Inherits:
Object
  • Object
show all
Defined in:
lib/icalia-sdk-event-core/serialization/deserializer.rb

Defined Under Namespace

Classes: StandInReplacement

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(jsonapi_data) ⇒ Deserializer

Returns a new instance of Deserializer.



20
21
22
23
24
# File 'lib/icalia-sdk-event-core/serialization/deserializer.rb', line 20

def initialize(jsonapi_data)
  @jsonapi_data = jsonapi_data
  @objects = {}
  @pending_stand_in_replacements = []
end

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data.



7
8
9
# File 'lib/icalia-sdk-event-core/serialization/deserializer.rb', line 7

def data
  @data
end

Instance Method Details

#inspectObject



48
49
50
# File 'lib/icalia-sdk-event-core/serialization/deserializer.rb', line 48

def inspect
  '(...inspect...)'
end

#performObject



26
27
28
29
30
31
32
33
# File 'lib/icalia-sdk-event-core/serialization/deserializer.rb', line 26

def perform
  return @data if @data
  deserialize_included
  deserialize_data
  replace_stand_ins
  finalize
  @data
end

#register_stand_in(model:, association:, stand_in:, index: nil) ⇒ Object



35
36
37
38
39
40
41
42
# File 'lib/icalia-sdk-event-core/serialization/deserializer.rb', line 35

def register_stand_in(model:, association:, stand_in:, index: nil)
  @pending_stand_in_replacements << StandInReplacement.new(
    model: model,
    association: association,
    stand_in: stand_in,
    index: index
  )
end

#to_sObject



44
45
46
# File 'lib/icalia-sdk-event-core/serialization/deserializer.rb', line 44

def to_s
  '(...to_s...)'
end