Sha256: 189ca8c105b04671802923363b3915d93e43de8eccf7d5c13d6ed5659b45b4c5

Contents?: true

Size: 750 Bytes

Versions: 22

Compression:

Stored size: 750 Bytes

Contents

module FbGraph2
  class Edge
    module Messages
      def assign(attributes)
        super
        if attributes.include? :messages
          @_cached_messages = Collection.new attributes[:messages]
        end
      end

      def messages(params = {})
        messages = if @_cached_messages.present? && params.blank?
          @_cached_messages
        else
          self.edge :messages, params
        end
        messages.collect! do |message|
          Message.new(message[:id], message).authenticate self.access_token
        end
      end

      def message!(params = {})
        message = self.post params, edge: :messages
        Message.new(message[:id], params.merge(message)).authenticate self.access_token
      end
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
fb_graph2-1.1.1 lib/fb_graph2/edge/messages.rb
fb_graph2-1.1.0 lib/fb_graph2/edge/messages.rb
fb_graph2-1.0.1 lib/fb_graph2/edge/messages.rb
fb_graph2-1.0.0 lib/fb_graph2/edge/messages.rb
fb_graph2-0.9.1 lib/fb_graph2/edge/messages.rb
fb_graph2-0.9.0 lib/fb_graph2/edge/messages.rb
fb_graph2-0.8.0 lib/fb_graph2/edge/messages.rb
fb_graph2-0.7.9 lib/fb_graph2/edge/messages.rb
fb_graph2-0.7.8 lib/fb_graph2/edge/messages.rb
fb_graph2-0.7.7 lib/fb_graph2/edge/messages.rb
fb_graph2-0.7.6 lib/fb_graph2/edge/messages.rb
fb_graph2-0.7.5 lib/fb_graph2/edge/messages.rb
fb_graph2-0.7.4 lib/fb_graph2/edge/messages.rb
fb_graph2-0.7.3 lib/fb_graph2/edge/messages.rb
fb_graph2-0.7.2 lib/fb_graph2/edge/messages.rb
fb_graph2-0.7.1 lib/fb_graph2/edge/messages.rb
fb_graph2-0.7.0 lib/fb_graph2/edge/messages.rb
fb_graph2-0.6.2 lib/fb_graph2/edge/messages.rb
fb_graph2-0.6.1 lib/fb_graph2/edge/messages.rb
fb_graph2-0.6.0 lib/fb_graph2/edge/messages.rb