lib/pushpad/notification.rb in pushpad-0.7.0 vs lib/pushpad/notification.rb in pushpad-0.8.0

- old
+ new

@@ -10,11 +10,11 @@ end class ReadonlyError < RuntimeError end - attr_accessor :body, :title, :target_url, :icon_url, :image_url, :ttl, :require_interaction, :custom_data, :actions, :starred + attr_accessor :body, :title, :target_url, :icon_url, :image_url, :ttl, :require_interaction, :custom_data, :actions, :starred, :send_at attr_reader :id, :created_at, :scheduled_count, :successfully_sent_count, :opened_count def initialize(options) @id = options[:id] @created_at = options[:created_at] && Time.parse(options[:created_at]) @@ -30,10 +30,11 @@ @ttl = options[:ttl] @require_interaction = options[:require_interaction] @custom_data = options[:custom_data] @actions = options[:actions] @starred = options[:starred] + @send_at = options[:send_at] end def self.find(id) response = Request.get("https://pushpad.xyz/notifications/#{id}") @@ -116,9 +117,10 @@ notification_params["ttl"] = self.ttl if self.ttl notification_params["require_interaction"] = self.require_interaction unless self.require_interaction.nil? notification_params["custom_data"] = self.custom_data if self.custom_data notification_params["actions"] = self.actions if self.actions notification_params["starred"] = self.starred unless self.starred.nil? + notification_params["send_at"] = self.send_at.utc.strftime("%Y-%m-%dT%R") if self.send_at body = { "notification" => notification_params } body["uids"] = uids if uids body["tags"] = tags if tags body.to_json