Sha256: 1516c64728181cea4f1cb1fb55f74d30fd95431b99a48148877d1d9943807c42

Contents?: true

Size: 1.23 KB

Versions: 11

Compression:

Stored size: 1.23 KB

Contents

module FbGraph2
  class Post < Node
    include Edge::Comments
    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

11 entries across 11 versions & 1 rubygems

Version Path
fb_graph2-0.4.0 lib/fb_graph2/post.rb
fb_graph2-0.3.2 lib/fb_graph2/post.rb
fb_graph2-0.3.1 lib/fb_graph2/post.rb
fb_graph2-0.3.0 lib/fb_graph2/post.rb
fb_graph2-0.2.0 lib/fb_graph2/post.rb
fb_graph2-0.1.3 lib/fb_graph2/post.rb
fb_graph2-0.1.2 lib/fb_graph2/post.rb
fb_graph2-0.1.1 lib/fb_graph2/post.rb
fb_graph2-0.1.0 lib/fb_graph2/post.rb
fb_graph2-0.0.11 lib/fb_graph2/post.rb
fb_graph2-0.0.10 lib/fb_graph2/post.rb