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
mmangino-facebooker-1.0.27 lib/facebooker/models/notifications.rb
mmangino-facebooker-1.0.28 lib/facebooker/models/notifications.rb
mmangino-facebooker-1.0.29 lib/facebooker/models/notifications.rb
mmangino-facebooker-1.0.3 lib/facebooker/models/notifications.rb
mmangino-facebooker-1.0.30 lib/facebooker/models/notifications.rb
mmangino-facebooker-1.0.31 lib/facebooker/models/notifications.rb
mmangino-facebooker-1.0.32 lib/facebooker/models/notifications.rb
mmangino-facebooker-1.0.36 lib/facebooker/models/notifications.rb
mmangino-facebooker-1.0.37 lib/facebooker/models/notifications.rb
mmangino-facebooker-1.0.38 lib/facebooker/models/notifications.rb
mmangino-facebooker-1.0.39 lib/facebooker/models/notifications.rb
mmangino-facebooker-1.0.4 lib/facebooker/models/notifications.rb
mmangino-facebooker-1.0.40 lib/facebooker/models/notifications.rb
mmangino-facebooker-1.0.41 lib/facebooker/models/notifications.rb
mmangino-facebooker-1.0.42 lib/facebooker/models/notifications.rb
mmangino-facebooker-1.0.43 lib/facebooker/models/notifications.rb
mmangino-facebooker-1.0.44 lib/facebooker/models/notifications.rb
mmangino-facebooker-1.0.45 lib/facebooker/models/notifications.rb
mmangino-facebooker-1.0.46 lib/facebooker/models/notifications.rb
mmangino-facebooker-1.0.47 lib/facebooker/models/notifications.rb