Module: MagicBell

Extended by:
Forwardable
Defined in:
lib/magicbell.rb,
lib/magicbell/client.rb,
lib/magicbell/config.rb,
lib/magicbell/railtie.rb,
lib/magicbell/version.rb,
lib/magicbell/api_resource.rb,
lib/magicbell/api_operations.rb,
lib/magicbell/api_resources/user.rb,
lib/magicbell/singleton_api_resource.rb,
lib/magicbell/action_mailer_extension.rb,
lib/magicbell/api_resource_collection.rb,
lib/magicbell/api_resources/notification.rb,
lib/magicbell/api_resources/user_notification.rb,
lib/magicbell/api_resources/user_notifications.rb,
lib/magicbell/api_resources/user_notification_read.rb,
lib/magicbell/api_resources/user_notifications_read.rb,
lib/magicbell/api_resources/user_notifications_seen.rb,
lib/magicbell/api_resources/user_notification_unread.rb,
lib/magicbell/api_resources/user_notification_preferences.rb

Defined Under Namespace

Modules: ActionMailerExtension, ApiOperations Classes: ApiResource, ApiResourceCollection, Client, Config, Notification, Railtie, SingletonApiResource, User, UserNotification, UserNotificationPreferences, UserNotificationRead, UserNotificationUnread, UserNotifications, UserNotificationsRead, UserNotificationsSeen

Constant Summary collapse

WIDGET_JAVASCRIPT_URL =
"https://assets.magicbell.io/widget.magicbell.js"
EXTRAS_CSS_URL =
"https://assets.magicbell.io/extras.magicbell.css"
VERSION =
'2.2.1'

Class Method Summary collapse

Class Method Details

.authentication_headers(client_api_key: nil, client_api_secret: nil) ⇒ Object



49
50
51
52
53
54
# File 'lib/magicbell.rb', line 49

def authentication_headers(client_api_key: nil, client_api_secret: nil)
  {
    "X-MAGICBELL-API-KEY" => client_api_key || api_key,
    "X-MAGICBELL-API-SECRET" => client_api_secret || api_secret
  }
end

.configObject



41
42
43
# File 'lib/magicbell.rb', line 41

def config
  @config ||= Config.new
end

.configure {|config| ... } ⇒ Object

Yields:



37
38
39
# File 'lib/magicbell.rb', line 37

def configure
  yield(config)
end

.hmac(message) ⇒ Object

Calculate HMAC for user’s email



57
58
59
# File 'lib/magicbell.rb', line 57

def hmac(message)
  MagicBell::Client.new(api_key: api_key, api_secret: api_secret).hmac(message)
end

.reset_configObject



45
46
47
# File 'lib/magicbell.rb', line 45

def reset_config
  @config = Config.new
end