Class: Upkeep::Subscriptions::Subscription

Inherits:
Data
  • Object
show all
Defined in:
lib/upkeep/subscriptions/store.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#graphObject (readonly)

Returns the value of attribute graph

Returns:

  • (Object)

    the current value of graph



8
9
10
# File 'lib/upkeep/subscriptions/store.rb', line 8

def graph
  @graph
end

#idObject (readonly)

Returns the value of attribute id

Returns:

  • (Object)

    the current value of id



8
9
10
# File 'lib/upkeep/subscriptions/store.rb', line 8

def id
  @id
end

#metadataObject (readonly)

Returns the value of attribute metadata

Returns:

  • (Object)

    the current value of metadata



8
9
10
# File 'lib/upkeep/subscriptions/store.rb', line 8

def 
  @metadata
end

#recorderObject (readonly)

Returns the value of attribute recorder

Returns:

  • (Object)

    the current value of recorder



8
9
10
# File 'lib/upkeep/subscriptions/store.rb', line 8

def recorder
  @recorder
end

#subscriber_idObject (readonly)

Returns the value of attribute subscriber_id

Returns:

  • (Object)

    the current value of subscriber_id



8
9
10
# File 'lib/upkeep/subscriptions/store.rb', line 8

def subscriber_id
  @subscriber_id
end

Class Method Details

.from_h(snapshot) ⇒ Object



35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/upkeep/subscriptions/store.rb', line 35

def self.from_h(snapshot)
  snapshot = Dependencies.symbolize_keys(snapshot)
  recorder = Runtime::Recorder.from_h(snapshot.fetch(:recorder))

  new(
    snapshot.fetch(:id),
    snapshot.fetch(:subscriber_id),
    recorder,
    recorder.graph,
    snapshot.fetch(:metadata)
  )
end

Instance Method Details

#identity_signature(frame_id) ⇒ Object



9
10
11
# File 'lib/upkeep/subscriptions/store.rb', line 9

def identity_signature(frame_id)
  recorder.identity_signature(frame_id)
end

#replay_recipe(frame_id) ⇒ Object



13
14
15
# File 'lib/upkeep/subscriptions/store.rb', line 13

def replay_recipe(frame_id)
  graph.node(frame_id).payload[:recipe]
end

#to_hObject



17
18
19
20
21
22
23
24
# File 'lib/upkeep/subscriptions/store.rb', line 17

def to_h
  {
    id: id,
    subscriber_id: subscriber_id,
    recorder: recorder.to_h,
    metadata: 
  }
end

#to_persistent_hObject



26
27
28
29
30
31
32
33
# File 'lib/upkeep/subscriptions/store.rb', line 26

def to_persistent_h
  {
    id: id,
    subscriber_id: subscriber_id,
    recorder: recorder.to_persistent_h,
    metadata: 
  }
end