Class: Meeting
- Inherits:
-
Object
- Object
- Meeting
- Includes:
- Bloomy::Utilities::UserIdUtility
- Defined in:
- lib/bloomy/operations/meetings.rb
Overview
This class is already initialized via the client and usable as ‘client.measurable.method`
Class to handle all the operations related to meeting
Instance Method Summary collapse
-
#attendees(meeting_id) ⇒ Array<Hash>
Lists all attendees for a specific meeting.
-
#create(title, add_self: true, attendees: []) ⇒ Hash
Creates a new meeting.
-
#delete(meeting_id) ⇒ Object
Deletes a meeting.
-
#details(meeting_id, include_closed: false) ⇒ Hash
Retrieves details of a specific meeting.
-
#initialize(conn) ⇒ Meeting
constructor
Initializes a new Meeting instance.
-
#issues(meeting_id, include_closed: false) ⇒ Array<Hash>
Lists all issues for a specific meeting.
-
#list(user_id = self.user_id) ⇒ Array<Hash>
Lists all meetings for a specific user.
-
#metrics(meeting_id) ⇒ Array<Hash>
Lists all metrics for a specific meeting.
-
#todos(meeting_id, include_closed: false) ⇒ Array<Hash>
Lists all todos for a specific meeting.
Methods included from Bloomy::Utilities::UserIdUtility
Constructor Details
#initialize(conn) ⇒ Meeting
Initializes a new Meeting instance
13 14 15 |
# File 'lib/bloomy/operations/meetings.rb', line 13 def initialize(conn) @conn = conn end |
Instance Method Details
#attendees(meeting_id) ⇒ Array<Hash>
Lists all attendees for a specific meeting
36 37 38 39 |
# File 'lib/bloomy/operations/meetings.rb', line 36 def attendees(meeting_id) response = @conn.get("L10/#{meeting_id}/attendees").body response.map { |attendee| {name: attendee["Name"], id: attendee["Id"]} } end |
#create(title, add_self: true, attendees: []) ⇒ Hash
Creates a new meeting
152 153 154 155 156 157 158 159 160 161 |
# File 'lib/bloomy/operations/meetings.rb', line 152 def create(title, add_self: true, attendees: []) payload = {title: title, addSelf: add_self}.to_json response = @conn.post("L10/create", payload).body meeting_id = response["meetingId"] meeting_details = {meeting_id: meeting_id, title: title} attendees.each do |attendee| @conn.post("L10/#{meeting_id}/attendees/#{attendee}") end meeting_details.merge(attendees: attendees) end |
#delete(meeting_id) ⇒ Object
Deletes a meeting
168 169 170 171 |
# File 'lib/bloomy/operations/meetings.rb', line 168 def delete(meeting_id) response = @conn.delete("L10/#{meeting_id}") response.success? end |
#details(meeting_id, include_closed: false) ⇒ Hash
Retrieves details of a specific meeting
127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 |
# File 'lib/bloomy/operations/meetings.rb', line 127 def details(meeting_id, include_closed: false) meeting = list.find { |m| m[:id] == meeting_id } attendees = attendees(meeting_id) issues = issues(meeting_id, include_closed: include_closed) todos = todos(meeting_id, include_closed: include_closed) measurables = metrics(meeting_id) { id: meeting[:id], title: meeting[:name], attendees: attendees, issues: issues, todos: todos, metrics: measurables } end |
#issues(meeting_id, include_closed: false) ⇒ Array<Hash>
Lists all issues for a specific meeting
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/bloomy/operations/meetings.rb', line 49 def issues(meeting_id, include_closed: false) response = @conn.get("L10/#{meeting_id}/issues?include_resolved=#{include_closed}").body response.map do |issue| { id: issue["Id"], title: issue["Name"], created_at: issue["CreateTime"], closed_at: issue["CloseTime"], details_url: issue["DetailsUrl"], owner: { id: issue["Owner"]["Id"], name: issue["Owner"]["Name"] } } end end |
#list(user_id = self.user_id) ⇒ Array<Hash>
Lists all meetings for a specific user
24 25 26 27 |
# File 'lib/bloomy/operations/meetings.rb', line 24 def list(user_id = self.user_id) response = @conn.get("L10/#{user_id}/list").body response.map { |meeting| {id: meeting["Id"], name: meeting["Name"]} } end |
#metrics(meeting_id) ⇒ Array<Hash>
Lists all metrics for a specific meeting
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 |
# File 'lib/bloomy/operations/meetings.rb', line 98 def metrics(meeting_id) response = @conn.get("L10/#{meeting_id}/measurables").body response.map do |measurable| { id: measurable["Id"], title: measurable["Name"].strip, target: measurable["Target"], operator: measurable["Direction"], format: measurable["Modifiers"], owner: { id: measurable["Owner"]["Id"], name: measurable["Owner"]["Name"] }, admin: { id: measurable["Admin"]["Id"], name: measurable["Admin"]["Name"] } } end end |
#todos(meeting_id, include_closed: false) ⇒ Array<Hash>
Lists all todos for a specific meeting
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
# File 'lib/bloomy/operations/meetings.rb', line 74 def todos(meeting_id, include_closed: false) response = @conn.get("L10/#{meeting_id}/todos?INCLUDE_CLOSED=#{include_closed}").body response.map do |todo| { id: todo["Id"], title: todo["Name"], due_date: todo["DueDate"], details_url: todo["DetailsUrl"], completed_at: todo["CompleteTime"], owner: { id: todo["Owner"]["Id"], name: todo["Owner"]["Name"] } } end end |