Sha256: a09d1f9811fea06a7d76cdb4cb7a5a128ad38f09f109144e77d6a3ea101ed9e3
Contents?: true
Size: 1.33 KB
Versions: 1
Compression:
Stored size: 1.33 KB
Contents
# frozen_string_literal: true require 'timetree/models/base_model' module TimeTree # Model for TimeTree comment. class Activity < BaseModel # @return [String] attr_accessor :content # @return [Time] attr_accessor :updated_at # @return [Time] attr_accessor :created_at # calendar's id. # @return [String] attr_accessor :calendar_id # event's id. # @return [String] attr_accessor :event_id TIME_FIELDS = %i[updated_at created_at].freeze # # 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 def create check_client _create end # # convert to a TimeTree request body format. # # @return [Hash] # @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
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
timetree-1.0.0 | lib/timetree/models/activity.rb |