Module: Teamlab::CommunityEvents

Included in:
Community
Defined in:
lib/teamlab/modules/community/community_events.rb

Overview

Methods for working with community events

Instance Method Summary collapse

Instance Method Details

#add_comment_to_event(event_id, content, options = {}) ⇒ Object



34
35
36
# File 'lib/teamlab/modules/community/community_events.rb', line 34

def add_comment_to_event(event_id, content, options = {})
  @request.post(['event', event_id.to_s, 'comment'], { content: content }.merge(options))
end

#create_event(title, content, options = {}) ⇒ Object



26
27
28
# File 'lib/teamlab/modules/community/community_events.rb', line 26

def create_event(title, content, options = {})
  @request.post(%w[event], { title: title, content: content }.merge(options))
end

#delete_event(event_id) ⇒ Object

Deletes the selected event

Parameters:

  • event_id (Integer)

    id of event



46
47
48
# File 'lib/teamlab/modules/community/community_events.rb', line 46

def delete_event(event_id)
  @request.delete(['event', event_id.to_s])
end

#get_all_eventsObject



6
7
8
# File 'lib/teamlab/modules/community/community_events.rb', line 6

def get_all_events
  @request.get(%w[event])
end

#get_event(id) ⇒ Object



14
15
16
# File 'lib/teamlab/modules/community/community_events.rb', line 14

def get_event(id)
  @request.get(['event', id.to_s])
end

#get_event_comments(event_id) ⇒ Object



22
23
24
# File 'lib/teamlab/modules/community/community_events.rb', line 22

def get_event_comments(event_id)
  @request.get(['event', event_id.to_s, 'comment'])
end

#get_my_eventsObject



10
11
12
# File 'lib/teamlab/modules/community/community_events.rb', line 10

def get_my_events
  @request.get(%w[event @self])
end

#search_events(query) ⇒ Object



18
19
20
# File 'lib/teamlab/modules/community/community_events.rb', line 18

def search_events(query)
  @request.get(['event', '@search', query])
end

#update_event(event_id, options = {}) ⇒ Object



38
39
40
41
42
# File 'lib/teamlab/modules/community/community_events.rb', line 38

def update_event(event_id, options = {})
  @request.put(['event', event_id.to_s], title: options[:title],
                                         content: options[:content],
                                         type: options[:type])
end

#vote_for_event(event_id, *variants) ⇒ Object



30
31
32
# File 'lib/teamlab/modules/community/community_events.rb', line 30

def vote_for_event(event_id, *variants)
  @request.post(['event', event_id.to_s, 'vote'], variants: variants.flatten)
end