Class: NthuEvent::Event

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

Overview

Single event on organiztion’s feed

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(event_data) ⇒ Event

Returns a new instance of Event.



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

def initialize(event_data)
  load_data(event_data)
end

Instance Attribute Details

#contentObject (readonly)

Returns the value of attribute content.



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

def content
  @content
end

#dateObject (readonly)

Returns the value of attribute date.



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

def date
  @date
end

#titleObject (readonly)

Returns the value of attribute title.



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

def title
  @title
end

#urlObject (readonly)

Returns the value of attribute url.



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

def url
  @url
end

Class Method Details

.find(type: nil, page: nil) ⇒ Object



13
14
15
16
17
18
19
# File 'lib/nthuevent/event.rb', line 13

def self.find(type: nil, page: nil)
  events_data = NthuEvent::NthuEventApi.events(type: type, page: page)
  events = events_data.map do |event_data|
    new(event_data)
  end
  events
end