Class: Mailkube::Events::EngagementContext

Inherits:
Node
  • Object
show all
Defined in:
lib/mailkube/events/contexts.rb,
sig/mailkube/events/contexts.rbs

Overview

An open interaction (email.opened).

These nested keys are camelCase on the wire, unlike every other block here. The SDK mirrors the server rather than normalizing it.

Direct Known Subclasses

ClickContext

Instance Attribute Summary

Attributes inherited from Node

#raw

Instance Method Summary collapse

Methods inherited from Node

#==, #[], #block, #hash, #initialize, #to_h

Constructor Details

This class inherits a constructor from Mailkube::Events::Node

Instance Method Details

#countryString?

Elected together with #ip_address, but can still be nil when the address was recorded: it is resolved at the edge and is not available on every path.

Returns:

  • (String, nil)

    the two-letter country the address resolves to.



78
79
# File 'lib/mailkube/events/contexts.rb', line 78

def country = self["country"]
# @return [String] when the interaction was recorded.

#ip_addressString?

The three connection accessors return nil unless the sending domain elected to record the field, which is off by default. The server omits the key rather than sending a blank, so nil here means "the sender did not record this" and never "the sender recorded an empty value".

Returns:

  • (String, nil)

    the opening client's IP address (wire key ipAddress).



72
73
# File 'lib/mailkube/events/contexts.rb', line 72

def ip_address = self["ipAddress"]
# @return [String, nil] the opening client's user agent (wire key `userAgent`).

#timestampString

Returns when the interaction was recorded.

Returns:

  • (String)

    when the interaction was recorded.



80
# File 'lib/mailkube/events/contexts.rb', line 80

def timestamp = self["timestamp"]

#user_agentString?

Returns the opening client's user agent (wire key userAgent).

Returns:

  • (String, nil)

    the opening client's user agent (wire key userAgent).



74
75
76
77
# File 'lib/mailkube/events/contexts.rb', line 74

def user_agent = self["userAgent"]
# Elected together with {#ip_address}, but can still be nil when the address was recorded:
# it is resolved at the edge and is not available on every path.
# @return [String, nil] the two-letter country the address resolves to.