Class: Ketchup::Meeting
- Inherits:
-
Object
- Object
- Ketchup::Meeting
- Defined in:
- lib/ketchup/meeting.rb
Overview
A Meeting - the cornerstone of Ketchup. This object tracks the meeting’s key details: the title, whether it’s public or not, the date, attendees, a description, location, project name, and the agenda items.
While you won’t want to create a new meeting from this class itself - it’s far easier to do so using a profile’s meetings array - this is a good reference point for changing and deleting meetings.
Constant Summary collapse
- WriteableAttributes =
[:title, :quick, :public, :date, :attendees, :description, :project_name, :location]
Instance Attribute Summary collapse
-
#api ⇒ Object
readonly
Returns the value of attribute api.
-
#created_at ⇒ Object
readonly
Returns the value of attribute created_at.
-
#items ⇒ Object
readonly
Returns the value of attribute items.
-
#project_id ⇒ Object
readonly
Returns the value of attribute project_id.
-
#public_url ⇒ Object
readonly
Returns the value of attribute public_url.
-
#shortcode_url ⇒ Object
readonly
Returns the value of attribute shortcode_url.
-
#updated_at ⇒ Object
readonly
Returns the value of attribute updated_at.
-
#user_id ⇒ Object
readonly
Returns the value of attribute user_id.
Instance Method Summary collapse
-
#destroy ⇒ Object
Deletes the meeting from the server.
-
#initialize(api, params = {}) ⇒ Meeting
constructor
Create a new meeting, using an active API object.
-
#new_record? ⇒ Boolean
Indicates whether the meeting exists on the server yet.
-
#save ⇒ Object
Saves the meeting to the server, whether it’s a new meeting or an existing one.
Constructor Details
#initialize(api, params = {}) ⇒ Meeting
Create a new meeting, using an active API object. Keep in mind that all parameter keys must be provided as strings. The key attributes are the title and the date (the rest are optional).
The date can be defined using natural language, and the server will figure out what you mean (just like when you create a meeting on the website).
38 39 40 41 42 43 44 |
# File 'lib/ketchup/meeting.rb', line 38 def initialize(api, params = {}) @api = api overwrite params @items = Ketchup::ItemArray.new @api, self, (params['items'] || []) end |
Instance Attribute Details
#api ⇒ Object (readonly)
Returns the value of attribute api.
13 14 15 |
# File 'lib/ketchup/meeting.rb', line 13 def api @api end |
#created_at ⇒ Object (readonly)
Returns the value of attribute created_at.
13 14 15 |
# File 'lib/ketchup/meeting.rb', line 13 def created_at @created_at end |
#items ⇒ Object (readonly)
Returns the value of attribute items.
13 14 15 |
# File 'lib/ketchup/meeting.rb', line 13 def items @items end |
#project_id ⇒ Object (readonly)
Returns the value of attribute project_id.
13 14 15 |
# File 'lib/ketchup/meeting.rb', line 13 def project_id @project_id end |
#public_url ⇒ Object (readonly)
Returns the value of attribute public_url.
13 14 15 |
# File 'lib/ketchup/meeting.rb', line 13 def public_url @public_url end |
#shortcode_url ⇒ Object (readonly)
Returns the value of attribute shortcode_url.
13 14 15 |
# File 'lib/ketchup/meeting.rb', line 13 def shortcode_url @shortcode_url end |
#updated_at ⇒ Object (readonly)
Returns the value of attribute updated_at.
13 14 15 |
# File 'lib/ketchup/meeting.rb', line 13 def updated_at @updated_at end |
#user_id ⇒ Object (readonly)
Returns the value of attribute user_id.
13 14 15 |
# File 'lib/ketchup/meeting.rb', line 13 def user_id @user_id end |
Instance Method Details
#destroy ⇒ Object
Deletes the meeting from the server. If the meeting has never been saved, this method will do nothing at all.
61 62 63 64 65 |
# File 'lib/ketchup/meeting.rb', line 61 def destroy return if new_record? @api.delete "/meetings/#{shortcode_url}.json" end |
#new_record? ⇒ Boolean
Indicates whether the meeting exists on the server yet.
71 72 73 |
# File 'lib/ketchup/meeting.rb', line 71 def new_record? shortcode_url.nil? end |
#save ⇒ Object
Saves the meeting to the server, whether it’s a new meeting or an existing one. This does not save underlying items or notes.
49 50 51 52 53 54 55 56 |
# File 'lib/ketchup/meeting.rb', line 49 def save if new_record? overwrite @api.post("/meetings.json", writeable_attributes) else overwrite @api.put("/meetings/#{shortcode_url}.json", writeable_attributes) end end |