Module: ParamsReady::Marshaller::StructMarshallers::Base64Marshaller

Defined in:
lib/params_ready/marshaller/struct_marshallers.rb

Class Method Summary collapse

Class Method Details

.canonicalize(definition, string, context, validator) ⇒ Object



27
28
29
30
31
# File 'lib/params_ready/marshaller/struct_marshallers.rb', line 27

def self.canonicalize(definition, string, context, validator)
  json = Base64.urlsafe_decode64(string)
  hash = JSON.parse(json)
  StructMarshaller.canonicalize(definition, hash, context, validator)
end

.instanceObject



23
24
25
# File 'lib/params_ready/marshaller/struct_marshallers.rb', line 23

def self.instance
  [String, self]
end

.marshal(parameter, intent) ⇒ Object



33
34
35
36
37
# File 'lib/params_ready/marshaller/struct_marshallers.rb', line 33

def self.marshal(parameter, intent)
  hash = StructMarshaller.marshal(parameter, intent)
  json = JSON.generate(hash)
  Base64.urlsafe_encode64(json)
end