class Togglehq::Notify::Preferences

Attributes

categories[RW]

Public Class Methods

all() click to toggle source

Gets all available notification categories and their associated preferences for the current app @return an array of notification categories

# File lib/togglehq/notify/preferences.rb, line 14
def self.all
  response = Togglehq::Request.new("/preferences").get!
  if response.status == 200
    json = JSON.parse(response.body)
    preferences = Togglehq::Notify::Preferences.new(categories: json)
    return preferences
  else
    raise "Unexpected error getting app preferences"
  end
end
new(params = {}) click to toggle source
# File lib/togglehq/notify/preferences.rb, line 8
def initialize(params = {})
  @categories = params[:categories]
end