Sha256: 358cd4ab1398a0ddcce995bf0912f232fa84266a140778fac72ebfe76a9e4a3d

Contents?: true

Size: 1.32 KB

Versions: 2

Compression:

Stored size: 1.32 KB

Contents

module FbGraph
  class Event < Node
    include Connections::Feed
    include Connections::Noreply
    include Connections::Maybe
    include Connections::Invited
    include Connections::Attending
    include Connections::Declined
    include Connections::Picture
    extend Searchable

    attr_accessor :owner, :name, :description, :start_time, :end_time, :location, :venue, :privacy, :updated_time

    def initialize(identifier, options = {})
      super
      if (owner = options[:owner])
        @owner = FbGraph::User.new(owner.delete(:id), owner)
      end
      @name        = options[:name]
      @description = options[:description]
      @location    = options[:location]
      @privacy     = options[:privacy]
      if (start_time = options[:start_time])
        @start_time = case start_time
        when String
          Time.parse(start_time).utc
        when Fixnum
          Time.at(start_time).utc
        end
      end
      if (end_time = options[:end_time])
        @end_time = case end_time
        when String
          Time.parse(end_time).utc
        when Fixnum
          Time.at(end_time).utc
        end
      end
      if options[:venue]
        @venue = FbGraph::Venue.new(options[:venue])
      end
      if options[:updated_time]
        @updated_time = Time.parse(options[:updated_time]).utc
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
fb_graph-0.7.0 lib/fb_graph/event.rb
fb_graph-0.6.0 lib/fb_graph/event.rb