Class: Prototok::Encoders::Json
- Inherits:
-
Base
- Object
- Base
- Prototok::Encoders::Json
show all
- Defined in:
- lib/prototok/encoders/json.rb
Instance Method Summary
collapse
Methods inherited from Base
#decode, #deserialize, #encode, #initialize, options, #options, #serialize
Instance Method Details
#decode_payload(str) ⇒ Object
18
19
20
|
# File 'lib/prototok/encoders/json.rb', line 18
def decode_payload str
MultiJson.decode(str)
end
|
#decode_token(str) ⇒ Object
10
11
12
|
# File 'lib/prototok/encoders/json.rb', line 10
def decode_token str
deserialize(MultiJson.decode(str))
end
|
#encode_payload(payload) ⇒ Object
14
15
16
|
# File 'lib/prototok/encoders/json.rb', line 14
def encode_payload payload
MultiJson.encode payload.to_h
end
|
#encode_token(payload, **header) ⇒ Object
6
7
8
|
# File 'lib/prototok/encoders/json.rb', line 6
def encode_token payload, **
MultiJson.encode serialize(payload, **)
end
|