class SnowplowTracker::Payload
Attributes
context[R]
Public Class Methods
new()
click to toggle source
# File lib/snowplow-tracker/payload.rb, line 30 def initialize @context = {} self end
Public Instance Methods
add(name, value)
click to toggle source
# File lib/snowplow-tracker/payload.rb, line 38 def add(name, value) if value != "" and not value.nil? @context[name] = value end end
add_dict(dict)
click to toggle source
# File lib/snowplow-tracker/payload.rb, line 47 def add_dict(dict) for f in dict self.add(f[0], f[1]) end end
add_json(dict, encode_base64, type_when_encoded, type_when_not_encoded)
click to toggle source
# File lib/snowplow-tracker/payload.rb, line 56 def add_json(dict, encode_base64, type_when_encoded, type_when_not_encoded) if dict.nil? return end dict_string = JSON.generate(dict) if encode_base64 self.add(type_when_encoded, Base64.strict_encode64(dict_string)) else self.add(type_when_not_encoded, dict_string) end end