Sha256: f54219d2691a3e18f834e4d2c5b6fe6c0f6ecda6ced55c15a634cdc1d21ad510
Contents?: true
Size: 813 Bytes
Versions: 20
Compression:
Stored size: 813 Bytes
Contents
module Lifen class Settings include Virtus.model(finalize: false) attribute :user, "Lifen::User" attribute :email_notifications, Boolean attribute :push_notifications, Boolean def reload json = client.get("central/api/settings") load_from_json(json) self end alias refresh reload def save params = {"emailNotifications" => email_notifications, "pushNotifications" => push_notifications} json = client.post("central/api/settings", params) load_from_json(json) self end private def client @client ||= user.client end def load_from_json(json) self.email_notifications = json["emailNotifications"] self.push_notifications = json["pushNotifications"] end end end
Version data entries
20 entries across 20 versions & 1 rubygems