Sha256: 224bcb9191743478e8e25a219589f825e6d910ee50803f9dd4ea44397a9200e1

Contents?: true

Size: 1004 Bytes

Versions: 3

Compression:

Stored size: 1004 Bytes

Contents

# Ruby client to authenticate a Facebook user.
# @see http://www.rubydoc.info/gems/Fb/
module Fb
  # Fb::Post reprensents a Facebook post. Post provides getters for:
  #   :id, :title, :url, :created_time, and :type.
  class Post
    # @option [String] the post’s unique ID.
    attr_reader :id

    # @option [String] the post’s type.
    attr_reader :type

    # @option [Time] the post’s creation time.
    attr_reader :created_at

    # @param [Hash] options the options to initialize an instance of Fb::Post.
    # @option [String] :id the post id.
    # @option [String] :type the post’s type.
    # @option [String] :created_time the post’s creation time in iso8601 format.
    def initialize(options = {})
      @id = options[:id]
      @type = options[:type]
      @created_at = Time.parse(options[:created_time]) if options[:created_time]
    end

    # @return [String] the representation of the post.
    def to_s
      %Q(#<#{self.class.name} #{@id} "#{@type}">)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
fb-core-1.0.0.alpha6 lib/fb/post.rb
fb-core-1.0.0.alpha5 lib/fb/post.rb
fb-core-1.0.0.alpha4 lib/fb/post.rb