Class: Nelumba::Event

Inherits:
Object
  • Object
show all
Includes:
Object
Defined in:
lib/nelumba/event.rb

Constant Summary

Constants included from Object

Object::USERNAME_REGULAR_EXPRESSION

Instance Attribute Summary collapse

Attributes included from Object

#author, #content, #display_name, #html, #image, #published, #summary, #text, #title, #uid, #updated, #url

Instance Method Summary collapse

Methods included from Object

#mentions, #reply_to, #to_as1, #to_html, #to_json, #to_text

Constructor Details

#initialize(options = {}, &blk) ⇒ Event

Returns a new instance of Event.



14
15
16
# File 'lib/nelumba/event.rb', line 14

def initialize(options = {}, &blk)
  init(options, &blk)
end

Instance Attribute Details

#attendingObject (readonly)

Returns the value of attribute attending.



5
6
7
# File 'lib/nelumba/event.rb', line 5

def attending
  @attending
end

#end_timeObject (readonly)

Returns the value of attribute end_time.



10
11
12
# File 'lib/nelumba/event.rb', line 10

def end_time
  @end_time
end

#locationObject (readonly)

Returns the value of attribute location.



12
13
14
# File 'lib/nelumba/event.rb', line 12

def location
  @location
end

#maybe_attendingObject (readonly)

Returns the value of attribute maybe_attending.



6
7
8
# File 'lib/nelumba/event.rb', line 6

def maybe_attending
  @maybe_attending
end

#not_attendingObject (readonly)

Returns the value of attribute not_attending.



7
8
9
# File 'lib/nelumba/event.rb', line 7

def not_attending
  @not_attending
end

#start_timeObject (readonly)

Returns the value of attribute start_time.



9
10
11
# File 'lib/nelumba/event.rb', line 9

def start_time
  @start_time
end

Instance Method Details

#init(options = {}, &blk) ⇒ Object



18
19
20
21
22
23
24
25
26
27
# File 'lib/nelumba/event.rb', line 18

def init(options = {}, &blk)
  super options

  @attending       = options[:attending]       || []
  @maybe_attending = options[:maybe_attending] || []
  @not_attending   = options[:not_attending]   || []
  @start_time      = options[:start_time]
  @end_time        = options[:end_time]
  @location        = options[:location]
end

#to_hashObject



29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/nelumba/event.rb', line 29

def to_hash
  {
    :attending       => @attending.dup,
    :maybe_attending => @maybe_attending.dup,
    :not_attending   => @not_attending.dup,

    :start_time      => @start_time,
    :end_time        => @end_time,

    :location        => @location
  }.merge(super)
end

#to_json_hashObject



42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/nelumba/event.rb', line 42

def to_json_hash
  {
    :objectType     => "event",

    :attending      => @attending.dup,
    :maybeAttending => @maybe_attending.dup,
    :notAttending   => @not_attending.dup,

    :startTime      => (@start_time && @start_time.to_date.rfc3339 + 'Z'),
    :endTime        => (@end_time   && @end_time.to_date.rfc3339   + 'Z'),

    :location       => @location
  }.merge(super)
end