Class: TimeTree::Activity
- Defined in:
- lib/timetree/activity.rb
Overview
Model for TimeTree comment.
Constant Summary collapse
- TIME_FIELDS =
i[updated_at created_at].freeze
Instance Attribute Summary collapse
-
#calendar_id ⇒ String
calendar’s id.
- #content ⇒ String
- #created_at ⇒ Time
-
#event_id ⇒ String
event’s id.
- #updated_at ⇒ Time
Attributes inherited from BaseModel
Instance Method Summary collapse
-
#create ⇒ TimeTree::Activity
Creates a comment to the associated event.
-
#data_params ⇒ Hash
convert to a TimeTree request body format.
Methods inherited from BaseModel
#initialize, #inspect, to_model
Constructor Details
This class inherits a constructor from TimeTree::BaseModel
Instance Attribute Details
#calendar_id ⇒ String
calendar’s id.
14 15 16 |
# File 'lib/timetree/activity.rb', line 14 def calendar_id @calendar_id end |
#content ⇒ String
7 8 9 |
# File 'lib/timetree/activity.rb', line 7 def content @content end |
#created_at ⇒ Time
11 12 13 |
# File 'lib/timetree/activity.rb', line 11 def created_at @created_at end |
#event_id ⇒ String
event’s id.
17 18 19 |
# File 'lib/timetree/activity.rb', line 17 def event_id @event_id end |
#updated_at ⇒ Time
9 10 11 |
# File 'lib/timetree/activity.rb', line 9 def updated_at @updated_at end |
Instance Method Details
#create ⇒ TimeTree::Activity
Creates a comment to the associated event.
30 31 32 33 34 35 36 |
# File 'lib/timetree/activity.rb', line 30 def create raise Error, '@client is nil.' if @client.nil? raise Error, 'calendar_id is required.' if calendar_id.nil? raise Error, 'event_id is required.' if event_id.nil? @client.create_activity calendar_id, event_id, data_params end |
#data_params ⇒ Hash
convert to a TimeTree request body format.
43 44 45 46 47 |
# File 'lib/timetree/activity.rb', line 43 def data_params { data: { attributes: { content: content } } } end |