Class: WebpushPayload

Inherits:
Struct
  • Object
show all
Defined in:
app/models/webpush_payload.rb

Overview

El payload que se envía en la notificación

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#endpoint ⇒ Object

Returns the value of attribute endpoint

Returns:

  • (Object) —

    the current value of endpoint



8
9
10
# File 'app/models/webpush_payload.rb', line 8

def endpoint
  @endpoint
end

#message ⇒ Object

Returns the value of attribute message

Returns:

  • (Object) —

    the current value of message



8
9
10
# File 'app/models/webpush_payload.rb', line 8

def message
  @message
end

#subject ⇒ Object

Returns the value of attribute subject

Returns:

  • (Object) —

    the current value of subject



8
9
10
# File 'app/models/webpush_payload.rb', line 8

def subject
  @subject
end

Class Method Details

.from_json(string) ⇒ Object



17
18
19
# File 'app/models/webpush_payload.rb', line 17

def self.from_json(string)
  new(JSON.parse(string))
end

Instance Method Details

#to_json(opts = nil) ⇒ Object

Convertir el payload a JSON para poder enviarlo

Returns:

  • String



13
14
15
# File 'app/models/webpush_payload.rb', line 13

def to_json(opts = nil)
  to_h.to_json(opts)
end