Sha256: 89aeb5adf71acbc316c2890ec2496b08e17f9feb36394021163261596124120e

Contents?: true

Size: 794 Bytes

Versions: 1

Compression:

Stored size: 794 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

1 entries across 1 versions & 1 rubygems

Version Path
fb_graph2-0.5.1 lib/fb_graph2/edge/messages.rb