Class: DomainEvent

Inherits:
Object
  • Object
show all
Defined in:
lib/apollo_commons_ruby/DomainEvent.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(configuration_json, view_group_definition, view_group_component, topic, event_name) ⇒ DomainEvent

Returns a new instance of DomainEvent.



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/apollo_commons_ruby/DomainEvent.rb', line 32

def initialize(configuration_json, view_group_definition, view_group_component, topic, event_name)
    @tenantId = configuration_json["tenantId"]
    @projectId = configuration_json["projectId"]
    @viewGroupDefinition = view_group_definition
    @viewGroupComponent = view_group_component
    @topic = topic
    @eventName = event_name
    @location = "./configs/" + view_group_definition + "/" + view_group_component + "/" + topic + "/" + event_name
    begin 
        domain_event_properties = File.read(location + "/domain_event_properties.json")
        @requestBody = JSON.parse domain_event_properties
    rescue
        @requestBody = JSON.parse '{}'
    end
    @requestBody["tenantId"] = configuration_json["tenantId"]
    @requestBody["projectId"] = configuration_json["projectId"]
    @requestBody["viewGroupDefinition"] = view_group_definition
    @requestBody["component"] = view_group_component
    @requestBody["topic"] = topic
    @requestBody["domainEventName"] = event_name
end

Instance Attribute Details

#eventNameObject (readonly)

Returns the value of attribute eventName.



28
29
30
# File 'lib/apollo_commons_ruby/DomainEvent.rb', line 28

def eventName
  @eventName
end

#locationObject (readonly)

Returns the value of attribute location.



30
31
32
# File 'lib/apollo_commons_ruby/DomainEvent.rb', line 30

def location
  @location
end

#projectIdObject (readonly)

Returns the value of attribute projectId.



24
25
26
# File 'lib/apollo_commons_ruby/DomainEvent.rb', line 24

def projectId
  @projectId
end

#requestBodyObject (readonly)

Returns the value of attribute requestBody.



29
30
31
# File 'lib/apollo_commons_ruby/DomainEvent.rb', line 29

def requestBody
  @requestBody
end

#tenantIdObject (readonly)

Returns the value of attribute tenantId.



23
24
25
# File 'lib/apollo_commons_ruby/DomainEvent.rb', line 23

def tenantId
  @tenantId
end

#topicObject (readonly)

Returns the value of attribute topic.



27
28
29
# File 'lib/apollo_commons_ruby/DomainEvent.rb', line 27

def topic
  @topic
end

#viewGroupComponentObject (readonly)

Returns the value of attribute viewGroupComponent.



26
27
28
# File 'lib/apollo_commons_ruby/DomainEvent.rb', line 26

def viewGroupComponent
  @viewGroupComponent
end

#viewGroupDefinitionObject (readonly)

Returns the value of attribute viewGroupDefinition.



25
26
27
# File 'lib/apollo_commons_ruby/DomainEvent.rb', line 25

def viewGroupDefinition
  @viewGroupDefinition
end