Sha256: 2b14fde4c2389573e77a4dc3b6af5cd927389a95fc42552bb20ce58788f675a9

Contents?: true

Size: 1.26 KB

Versions: 17

Compression:

Stored size: 1.26 KB

Contents

module FbGraph2
  class Post < Node
    include Edge::Comments
    include Edge::Insights
    include Edge::Likes::LikeeContext
    include Edge::SharedPosts

    register_attributes(
      raw: [
        :caption, :description, :icon, :is_hidden, :link, :message, :name, :object_id, :picture,
        :source, :status_type, :story, :type
      ],
      time: [:created_time, :updated_time],
      app: [:application],
      page: [:place],
      profile: [:from],
      profiles: [:to, :with_tags],
      actions: [:actions],
      custom: [
        :message_tags, :privacy, :properties
      ]
    )

    def initialize(id, attributes = {})
      super
      if attributes.include? :message_tags
        self.message_tags = attributes[:message_tags].inject({}) do |message_tags, (key, values)|
          _message_tags_ = values.collect do |value|
            TaggedProfile.new value[:id], value
          end
          message_tags.merge! key => _message_tags_
        end
      end
      if attributes.include? :privacy
        self.privacy = Struct::Privacy.new attributes[:privacy]
      end
      if attributes.include? :properties
        self.properties = attributes[:properties].collect do |property|
          Struct::Property.new property
        end
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
fb_graph2-0.7.6 lib/fb_graph2/post.rb
fb_graph2-0.7.5 lib/fb_graph2/post.rb
fb_graph2-0.7.4 lib/fb_graph2/post.rb
fb_graph2-0.7.3 lib/fb_graph2/post.rb
fb_graph2-0.7.2 lib/fb_graph2/post.rb
fb_graph2-0.7.1 lib/fb_graph2/post.rb
fb_graph2-0.7.0 lib/fb_graph2/post.rb
fb_graph2-0.6.2 lib/fb_graph2/post.rb
fb_graph2-0.6.1 lib/fb_graph2/post.rb
fb_graph2-0.6.0 lib/fb_graph2/post.rb
fb_graph2-0.5.3 lib/fb_graph2/post.rb
fb_graph2-0.5.2 lib/fb_graph2/post.rb
fb_graph2-0.5.1 lib/fb_graph2/post.rb
fb_graph2-0.5.0 lib/fb_graph2/post.rb
fb_graph2-0.4.4 lib/fb_graph2/post.rb
fb_graph2-0.4.3 lib/fb_graph2/post.rb
fb_graph2-0.4.1 lib/fb_graph2/post.rb