Sha256: 8881de36d8a77dc60f0a0b6abbc2b165086c289ec79ede5ee0803240dbc799ff

Contents?: true

Size: 1.25 KB

Versions: 6

Compression:

Stored size: 1.25 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],
      place: [:place],
      profile: [:from],
      profiles: [:to, :with_tags],
      actions: [:actions],
      custom: [
        :message_tags, :privacy, :properties, :shares
      ]
    )

    def initialize(id, attributes = {})
      super
      if attributes.include? :message_tags
        self.message_tags = attributes[:message_tags].collect do |message_tag|
          TaggedProfile.new message_tag[:id], message_tag
        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
      if attributes.include? :shares
        self.shares = Struct::Share.new attributes[:shares]
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
fb_graph2-1.1.1 lib/fb_graph2/post.rb
fb_graph2-1.1.0 lib/fb_graph2/post.rb
fb_graph2-1.0.1 lib/fb_graph2/post.rb
fb_graph2-1.0.0 lib/fb_graph2/post.rb
fb_graph2-0.9.1 lib/fb_graph2/post.rb
fb_graph2-0.9.0 lib/fb_graph2/post.rb