Sha256: 3f448c56b903674ef9e6742091c77a773ee8ab899b6405e4b81c1ebd4e814713

Contents?: true

Size: 971 Bytes

Versions: 59

Compression:

Stored size: 971 Bytes

Contents

module FbGraph
  class Notification < Node
    attr_accessor :application, :from, :to, :title, :message, :link, :unread, :created_time, :updated_time

    def initialize(identifier, attributes = {})
      super
      @title = attributes[:title]
      @message = attributes[:message]
      @link = attributes[:link]
      @unread = attributes[:unread] == 1
      if (application = attributes[:application])
        @application = Application.new(application[:id], application)
      end
      if (from = attributes[:from])
        @from = User.new(from[:id], from)
      end
      if (to = attributes[:to])
        @to = User.new(to[:id], to)
      end
      if attributes[:created_time]
        @created_time = Time.parse(attributes[:created_time]).utc
      end
      if attributes[:updated_time]
        @updated_time = Time.parse(attributes[:updated_time]).utc
      end
    end

    def read!(options = {})
      post options.merge(:unread => false)
    end
  end
end

Version data entries

59 entries across 59 versions & 1 rubygems

Version Path
fb_graph-2.6.5 lib/fb_graph/notification.rb
fb_graph-2.6.4 lib/fb_graph/notification.rb
fb_graph-2.6.3 lib/fb_graph/notification.rb
fb_graph-2.6.2 lib/fb_graph/notification.rb
fb_graph-2.6.1 lib/fb_graph/notification.rb
fb_graph-2.6.0 lib/fb_graph/notification.rb
fb_graph-2.5.9 lib/fb_graph/notification.rb
fb_graph-2.5.8 lib/fb_graph/notification.rb
fb_graph-2.5.7 lib/fb_graph/notification.rb
fb_graph-2.5.6 lib/fb_graph/notification.rb
fb_graph-2.5.5 lib/fb_graph/notification.rb
fb_graph-2.5.4 lib/fb_graph/notification.rb
fb_graph-2.5.3 lib/fb_graph/notification.rb
fb_graph-2.5.2 lib/fb_graph/notification.rb
fb_graph-2.5.1 lib/fb_graph/notification.rb
fb_graph-2.5.0 lib/fb_graph/notification.rb
fb_graph-2.4.20 lib/fb_graph/notification.rb
fb_graph-2.4.19 lib/fb_graph/notification.rb
fb_graph-2.4.18 lib/fb_graph/notification.rb
fb_graph-2.4.17 lib/fb_graph/notification.rb