lib/timetree/models/activity.rb in timetree-0.3.2 vs lib/timetree/models/activity.rb in timetree-1.0.0
- old
+ new
@@ -29,11 +29,11 @@
# @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
def create
check_client
- @client.create_activity calendar_id, event_id, data_params
+ _create
end
#
# convert to a TimeTree request body format.
#
@@ -41,8 +41,18 @@
# @since 0.0.1
def data_params
{
data: {attributes: {content: content}}
}
+ end
+
+ private
+
+ 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
end
end