Class: Iterable::InApp

Inherits:
ApiResource show all
Defined in:
lib/iterable/in_app.rb

Overview

Interact with /inApp API endpoints

Examples:

Creating in app endpoint object

# With default config
in_app = Iterable::InApp.new

# With custom config
conf = Iterable::Config.new(token: 'new-token')
in_app = Iterable::InApp.new(config)

Instance Attribute Summary

Attributes inherited from ApiResource

#conf

Instance Method Summary collapse

Methods inherited from ApiResource

#default_config, default_config, #initialize

Constructor Details

This class inherits a constructor from Iterable::ApiResource

Instance Method Details

#messages_for_email(email, count: 1, **attrs) ⇒ Iterable::Response

Get in-app messages for a user by email

Parameters:

  • email (String)

    required Email of user who received the message to view. Required if no user_id present.

  • count (Integer) (defaults to: 1)

    Number of messages to return, defaults to 1

  • attrs (Hash)

    Hash of query attributes like platform, SDKVersion, etc.

Returns:



23
24
25
26
27
# File 'lib/iterable/in_app.rb', line 23

def messages_for_email(email, count: 1, **attrs)
  attrs[:email] = email
  attrs[:count] = count
  messages(attrs)
end

#messages_for_user_id(user_id, count: 1, **attrs) ⇒ Iterable::Response

Get in-app messages for a user by user_id

Parameters:

  • email (String)

    required Email of user who received the message to view. Required if no user_id present.

  • count (Integer) (defaults to: 1)

    Number of messages to return, defaults to 1

  • attrs (Hash)

    Hash of query attributes like platform, SDKVersion, etc.

Returns:



38
39
40
41
42
# File 'lib/iterable/in_app.rb', line 38

def messages_for_user_id(user_id, count: 1, **attrs)
  attrs[:userId] = user_id
  attrs[:count] = count
  messages(attrs)
end