Sha256: 43d878d450842793b02b9478bcca4e70d089bb710eccbf9b2c60ec01471481ba

Contents?: true

Size: 1.36 KB

Versions: 23

Compression:

Stored size: 1.36 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, attributes = {})
      super
      if (owner = attributes[:owner])
        @owner = FbGraph::User.new(owner.delete(:id), owner)
      end
      @name        = attributes[:name]
      @description = attributes[:description]
      @location    = attributes[:location]
      @privacy     = attributes[:privacy]
      if (start_time = attributes[: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 = attributes[:end_time])
        @end_time = case end_time
        when String
          Time.parse(end_time).utc
        when Fixnum
          Time.at(end_time).utc
        end
      end
      if attributes[:venue]
        @venue = FbGraph::Venue.new(attributes[:venue])
      end
      if attributes[:updated_time]
        @updated_time = Time.parse(attributes[:updated_time]).utc
      end
    end
  end
end

Version data entries

23 entries across 23 versions & 2 rubygems

Version Path
fb_graph-1.2.1 lib/fb_graph/event.rb
fb_graph-1.2.0 lib/fb_graph/event.rb
fb_graph-1.1.7 lib/fb_graph/event.rb
fb_graph-1.1.6 lib/fb_graph/event.rb
fb_graph-1.1.5 lib/fb_graph/event.rb
fb_graph-1.1.4 lib/fb_graph/event.rb
fb_graph-1.1.3 lib/fb_graph/event.rb
fb_graph-1.1.2 lib/fb_graph/event.rb
fb_graph-1.1.1 lib/fb_graph/event.rb
fb_graph-1.1.0 lib/fb_graph/event.rb
fb_graph-1.0.7 lib/fb_graph/event.rb
fb_graph-1.0.6 lib/fb_graph/event.rb
fb_graph-1.0.5 lib/fb_graph/event.rb
palidanx-fb_graph-1.0.4 lib/fb_graph/event.rb
fb_graph-1.0.4 lib/fb_graph/event.rb
fb_graph-1.0.3 lib/fb_graph/event.rb
fb_graph-1.0.2 lib/fb_graph/event.rb
fb_graph-1.0.1 lib/fb_graph/event.rb
fb_graph-1.0.0 lib/fb_graph/event.rb
fb_graph-0.8.0 lib/fb_graph/event.rb