Sha256: 44a845ed3582f035a2df75b603cf047ccd9f75ee75c04adeeaef03415220ad42

Contents?: true

Size: 1.16 KB

Versions: 22

Compression:

Stored size: 1.16 KB

Contents

module FbGraph
  module OpenGraph
    class Action < Node
      include Connections::Comments
      include Connections::Likes
      include Connections::Likes::Likable

      attr_accessor :type, :application, :from, :objects, :start_time, :end_time, :publish_time
      attr_accessor :raw_attributes

      def initialize(identifier, attributes = {})
        super
        @raw_attributes = attributes
        @type = attributes[:type]
        if application = attributes[:application]
          @application = Application.new(application[:id], application)
        end
        if from = attributes[:from]
          @from = User.new(from[:id], from)
        end
        @objects = {}
        if attributes[:data]
          attributes[:data].each do |key, _attributes_|
            @objects[key] = Object.new _attributes_[:id], _attributes_
          end
        end
        @objects = @objects.with_indifferent_access
        [:start_time, :end_time, :publish_time].each do |key|
          self.send "#{key}=", Time.parse(attributes[key]) if attributes[key]
        end

        # cached connection
        cache_collections attributes, :comments, :likes
      end
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
fb_graph-2.4.15 lib/fb_graph/open_graph/action.rb
fb_graph-2.4.14 lib/fb_graph/open_graph/action.rb
fb_graph-2.4.13 lib/fb_graph/open_graph/action.rb
fb_graph-2.4.12 lib/fb_graph/open_graph/action.rb
fb_graph-2.4.11 lib/fb_graph/open_graph/action.rb
fb_graph-2.4.10 lib/fb_graph/open_graph/action.rb
fb_graph-2.4.9 lib/fb_graph/open_graph/action.rb
fb_graph-2.4.8 lib/fb_graph/open_graph/action.rb
fb_graph-2.4.7 lib/fb_graph/open_graph/action.rb
fb_graph-2.4.6 lib/fb_graph/open_graph/action.rb
fb_graph-2.4.4 lib/fb_graph/open_graph/action.rb
fb_graph-2.4.3 lib/fb_graph/open_graph/action.rb
fb_graph-2.4.2 lib/fb_graph/open_graph/action.rb
fb_graph-2.4.1 lib/fb_graph/open_graph/action.rb
fb_graph-2.4.0 lib/fb_graph/open_graph/action.rb
fb_graph-2.3.2 lib/fb_graph/open_graph/action.rb
fb_graph-2.3.1 lib/fb_graph/open_graph/action.rb
fb_graph-2.3.0 lib/fb_graph/open_graph/action.rb
fb_graph-2.2.6 lib/fb_graph/open_graph/action.rb
fb_graph-2.2.5 lib/fb_graph/open_graph/action.rb