Class: Gaah::Calendar::Event

Inherits:
ApiModel show all
Defined in:
lib/gaah/calendar/event.rb

Instance Attribute Summary collapse

Attributes inherited from ApiModel

#id

Instance Method Summary collapse

Methods inherited from ApiModel

#==, batch_create

Constructor Details

#initialize(json) ⇒ Event

Returns a new instance of Event.



6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/gaah/calendar/event.rb', line 6

def initialize(json)
  store_json(json)

  @id           = json['id']
  @updated      = Time.parse(json['updated'])
  @summary      = json['summary'].to_s
  @description  = json['description'].to_s
  @location     = json['location'].to_s
  @creator      = Who.new(json['creator']) if json['creator']
  @when         = parse_when
  @attendees    = parse_attendees
  @transparency = json['transparency'].to_s
  @visibility   = json['visibility'] || 'default'
end

Instance Attribute Details

#attendeesObject (readonly)

Returns the value of attribute attendees.



4
5
6
# File 'lib/gaah/calendar/event.rb', line 4

def attendees
  @attendees
end

#creatorObject (readonly)

Returns the value of attribute creator.



4
5
6
# File 'lib/gaah/calendar/event.rb', line 4

def creator
  @creator
end

#descriptionObject (readonly)

Returns the value of attribute description.



4
5
6
# File 'lib/gaah/calendar/event.rb', line 4

def description
  @description
end

#locationObject (readonly)

Returns the value of attribute location.



4
5
6
# File 'lib/gaah/calendar/event.rb', line 4

def location
  @location
end

#summaryObject (readonly)

Returns the value of attribute summary.



4
5
6
# File 'lib/gaah/calendar/event.rb', line 4

def summary
  @summary
end

#transparencyObject (readonly)

Returns the value of attribute transparency.



4
5
6
# File 'lib/gaah/calendar/event.rb', line 4

def transparency
  @transparency
end

#updatedObject (readonly)

Returns the value of attribute updated.



4
5
6
# File 'lib/gaah/calendar/event.rb', line 4

def updated
  @updated
end

#visibilityObject (readonly)

Returns the value of attribute visibility.



4
5
6
# File 'lib/gaah/calendar/event.rb', line 4

def visibility
  @visibility
end

#whenObject (readonly)

Returns the value of attribute when.



4
5
6
# File 'lib/gaah/calendar/event.rb', line 4

def when
  @when
end

Instance Method Details

#authorObject

V2 -> V3



37
# File 'lib/gaah/calendar/event.rb', line 37

def author;  creator;     end

#contentObject



38
# File 'lib/gaah/calendar/event.rb', line 38

def content; description; end

#marshal_dumpObject



43
44
45
# File 'lib/gaah/calendar/event.rb', line 43

def marshal_dump
  [@id, nil, @updated, @summary, @description, @location, @creator, @when, @attendees, @transparency, @visibility]
end

#marshal_load(array) ⇒ Object



47
48
49
# File 'lib/gaah/calendar/event.rb', line 47

def marshal_load(array)
  @id, _, @updated, @summary, @description, @location, @creator, @when, @attendees, @transparency, @visibility = array
end

#titleObject



39
# File 'lib/gaah/calendar/event.rb', line 39

def title;   summary;     end

#to_json(*args) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/gaah/calendar/event.rb', line 21

def to_json(*args)
  {
    id:           @id,
    updated:      @updated,
    summary:      @summary,
    description:  @description,
    location:     @location,
    creator:      @creator,
    when:         @when,
    attendees:    @attendees,
    transparency: @transparency,
    visibility:   @visibility,
  }.to_json
end

#whereObject



40
# File 'lib/gaah/calendar/event.rb', line 40

def where;   location;    end

#whoObject



41
# File 'lib/gaah/calendar/event.rb', line 41

def who;     attendees;   end