Sha256: b20fd48c9858e902708b48ed6d5078bd1cb853b390d07f4a77af77080d3445cd

Contents?: true

Size: 628 Bytes

Versions: 138

Compression:

Stored size: 628 Bytes

Contents

module Facebooker
  class Notifications
    include Model
    attr_accessor :messages, :group_invites, :pokes, :friend_requests, :event_invites, :shares
    
    [:Messages, :Pokes, :Shares].each do |notification_type|
      const_set(notification_type, Class.new do
        include Model
        attr_accessor :unread, :most_recent
      end)
      attribute_name = "#{notification_type.to_s.downcase}"
      define_method("#{attribute_name}=") do |value|
        instance_variable_set("@#{attribute_name}", value.kind_of?(Hash) ? Notifications.const_get(notification_type).from_hash(value) : value)
      end
    end
  end
end

Version data entries

138 entries across 138 versions & 30 rubygems

Version Path
al-facebooker-1.0.12.1 lib/facebooker/models/notifications.rb
al-facebooker-1.0.12 lib/facebooker/models/notifications.rb
al-facebooker-1.0.9 lib/facebooker/models/notifications.rb
corey-facebooker-1.0.28.1 lib/facebooker/models/notifications.rb
cwninja-facebooker-1.0.8 lib/facebooker/models/notifications.rb
djanowski-facebooker-1.0.1 lib/facebooker/models/notifications.rb
djanowski-facebooker-1.0.10 lib/facebooker/models/notifications.rb
djanowski-facebooker-1.0.11 lib/facebooker/models/notifications.rb
djanowski-facebooker-1.0.12 lib/facebooker/models/notifications.rb
djanowski-facebooker-1.0.2 lib/facebooker/models/notifications.rb
djanowski-facebooker-1.0.4 lib/facebooker/models/notifications.rb
djanowski-facebooker-1.0.7 lib/facebooker/models/notifications.rb
djanowski-mmangino-facebooker-1.0.4 lib/facebooker/models/notifications.rb
fs-facebooker-1.0.37 lib/facebooker/models/notifications.rb
hashrocket-clearance-0.4.0 test/rails_root/vendor/plugins/facebooker/lib/facebooker/models/notifications.rb
hashrocket-clearance-0.4.1 test/rails_root/vendor/plugins/facebooker/lib/facebooker/models/notifications.rb
hashrocket-clearance-0.4.2 test/rails_root/vendor/plugins/facebooker/lib/facebooker/models/notifications.rb
hashrocket-clearance-0.4.3 test/rails_root/vendor/plugins/facebooker/lib/facebooker/models/notifications.rb
mborromeo-facebooker-1.0.28 lib/facebooker/models/notifications.rb
mborromeo-facebooker-1.0.29 lib/facebooker/models/notifications.rb