Class: Cosmos::NotificationModel

Inherits:
Object
  • Object
show all
Defined in:
lib/cosmos/models/notification_model.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(time:, severity:, url:, title:, body:) ⇒ NotificationModel

Returns a new instance of NotificationModel.



24
25
26
27
28
29
30
# File 'lib/cosmos/models/notification_model.rb', line 24

def initialize(time:, severity:, url:, title:, body:)
  @time = time
  @severity = severity
  @url = url
  @title = title
  @body = body
end

Instance Attribute Details

#bodyObject (readonly)

Returns the value of attribute body.



22
23
24
# File 'lib/cosmos/models/notification_model.rb', line 22

def body
  @body
end

#severityObject (readonly)

Returns the value of attribute severity.



22
23
24
# File 'lib/cosmos/models/notification_model.rb', line 22

def severity
  @severity
end

#timeObject (readonly)

Returns the value of attribute time.



22
23
24
# File 'lib/cosmos/models/notification_model.rb', line 22

def time
  @time
end

#titleObject (readonly)

Returns the value of attribute title.



22
23
24
# File 'lib/cosmos/models/notification_model.rb', line 22

def title
  @title
end

#urlObject (readonly)

Returns the value of attribute url.



22
23
24
# File 'lib/cosmos/models/notification_model.rb', line 22

def url
  @url
end

Instance Method Details

#as_jsonObject



32
33
34
35
36
37
38
# File 'lib/cosmos/models/notification_model.rb', line 32

def as_json
  { "time" => @time,
    "severity" => @severity,
    "url" => @url,
    "title" => @title,
    "body" => @body }
end