class TimeTree::Activity

Model for TimeTree comment.

Constants

TIME_FIELDS

Attributes

calendar_id[RW]

calendar's id. @return [String]

content[RW]

@return [String]

created_at[RW]

@return [Time]

event_id[RW]

event's id. @return [String]

updated_at[RW]

@return [Time]

Public Instance Methods

create() click to toggle source

Creates a comment to the associated event.

@return [TimeTree::Activity] @raise [TimeTree::Error] if @client is not set. @raise [TimeTree::Error] if the calendar_id property is not set. @raise [TimeTree::Error] if the event_id property is not set. @raise [TimeTree::ApiError] if the http response status will not success. @since 0.0.1

# File lib/timetree/models/activity.rb, line 32
def create
  check_client
  _create
end
data_params() click to toggle source

convert to a TimeTree request body format.

@return [Hash] @since 0.0.1

# File lib/timetree/models/activity.rb, line 42
def data_params
  {
    data: {attributes: {content: content}}
  }
end

Private Instance Methods

_create() click to toggle source
# File lib/timetree/models/activity.rb, line 50
def _create
  if @client.is_a?(CalendarApp::Client)
    @client.create_activity(event_id, data_params)
  else
    @client.create_activity(calendar_id, event_id, data_params)
  end
end