Sha256: 9b2caa48b1e9c55c189ff6426ccc836b0da810a037d8839e0716be9c895f1572

Contents?: true

Size: 1.03 KB

Versions: 1

Compression:

Stored size: 1.03 KB

Contents

module FbGraph
  class Checkin < Node
    extend Searchable

    attr_accessor :from, :tags, :place, :message, :application, :created_time

    def initialize(identifier, attributes = {})
      super
      if (from = attributes[:from])
        @from = User.new(from[:id], from)
      end
      @tags = []
      if (tags = attributes[:tags])
        Collection.new(tags).each do |user|
          @tags << User.new(user[:id], user)
        end
      end
      if (place = attributes[:place])
        @place = case place
        when Place
          place
        when String, Integer
          Place.new(place)
        when Hash
          Place.new(place[:id], place)
        end
      end
      @message = attributes[:message]
      if (application = attributes[:application])
        @application = Application.new(application[:id], application)
      end
      if (created_time = attributes[:created_time])
        @created_time = Time.parse(created_time).utc
      end
    end

    def self.search(options = {})
      super(nil, options)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fb_graph-1.8.1 lib/fb_graph/checkin.rb