lib/timetree/client.rb in timetree-0.1.3 vs lib/timetree/client.rb in timetree-0.1.4

- old
+ new

@@ -38,10 +38,11 @@ # # @param cal_id [String] calendar's id. # @param include_relationships [Array<symbol>] # includes association's object in the response. # @return [TimeTree::Calendar] + # @raise [TimeTree::Error] if the cal_id arg is empty. # @raise [TimeTree::ApiError] if the http response status will not success. # @since 0.0.1 def calendar(cal_id, include_relationships: nil) check_calendar_id cal_id params = relationships_params(include_relationships, Calendar::RELATIONSHIPS) @@ -71,10 +72,11 @@ # # Get a calendar's label information used in event. # # @param cal_id [String] calendar's id. # @return [Array<TimeTree::Label>] + # @raise [TimeTree::Error] if the cal_id arg is empty. # @raise [TimeTree::ApiError] if the http response status will not success. # @since 0.0.1 def calendar_labels(cal_id) check_calendar_id cal_id res = @http_cmd.get "/calendars/#{cal_id}/labels" @@ -86,10 +88,11 @@ # # Get a calendar's member information. # # @param cal_id [String] calendar's id. # @return [Array<TimeTree::User>] + # @raise [TimeTree::Error] if the cal_id arg is empty. # @raise [TimeTree::ApiError] if the http response status will not success. # @since 0.0.1 def calendar_members(cal_id) check_calendar_id cal_id res = @http_cmd.get "/calendars/#{cal_id}/members" @@ -104,10 +107,12 @@ # @param cal_id [String] calendar's id. # @param event_id [String] event's id. # @param include_relationships [Array<symbol>] # includes association's object in the response. # @return [TimeTree::Event] + # @raise [TimeTree::Error] if the cal_id arg is empty. + # @raise [TimeTree::Error] if the event_id arg is empty. # @raise [TimeTree::ApiError] if the http response status will not success. # @since 0.0.1 def event(cal_id, event_id, include_relationships: nil) check_calendar_id cal_id check_event_id event_id @@ -127,10 +132,11 @@ # @param days [Integer] The number of days to get. # @param timezone [String] Timezone. # @param include_relationships [Array<symbol>] # includes association's object in the response. # @return [Array<TimeTree::Event>] + # @raise [TimeTree::Error] if the cal_id arg is empty. # @raise [TimeTree::ApiError] if the http response status will not success. # @since 0.0.1 def upcoming_events(cal_id, days: 7, timezone: 'UTC', include_relationships: nil) check_calendar_id cal_id params = relationships_params(include_relationships, Event::RELATIONSHIPS) @@ -150,10 +156,11 @@ # Creates an event to the calendar. # # @param cal_id [String] calendar's id. # @param params [Hash] TimeTree request body format. # @return [TimeTree::Event] + # @raise [TimeTree::Error] if the cal_id arg is empty. # @raise [TimeTree::ApiError] if the http response status will not success. # @since 0.0.1 def create_event(cal_id, params) check_calendar_id cal_id res = @http_cmd.post "/calendars/#{cal_id}/events", params @@ -170,10 +177,12 @@ # @param cal_id [String] calendar's id. # @param event_id [String] event's id. # @param params [Hash] # event's information specified in TimeTree request body format. # @return [TimeTree::Event] + # @raise [TimeTree::Error] if the cal_id arg is empty. + # @raise [TimeTree::Error] if the event_id arg is empty. # @raise [TimeTree::ApiError] if the http response status will not success. # @since 0.0.1 def update_event(cal_id, event_id, params) check_calendar_id cal_id check_event_id event_id @@ -189,10 +198,12 @@ # Deletes an event. # # @param cal_id [String] calendar's id. # @param event_id [String] event's id. # @return [true] if the operation succeeded. + # @raise [TimeTree::Error] if the cal_id arg is empty. + # @raise [TimeTree::Error] if the event_id arg is empty. # @raise [TimeTree::ApiError] if the http response status will not success. # @since 0.0.1 def delete_event(cal_id, event_id) check_calendar_id cal_id check_event_id event_id @@ -208,10 +219,12 @@ # @param cal_id [String] calendar's id. # @param event_id [String] event's id. # @param params [Hash] # comment's information specified in TimeTree request body format. # @return [TimeTree::Activity] - # @raise [TimeTree::ApiError] if the nhttp response status is not success. + # @raise [TimeTree::Error] if the cal_id arg is empty. + # @raise [TimeTree::Error] if the event_id arg is empty. + # @raise [TimeTree::ApiError] if the http response status is not success. # @since 0.0.1 def create_activity(cal_id, event_id, params) check_calendar_id cal_id check_event_id event_id res = @http_cmd.post "/calendars/#{cal_id}/events/#{event_id}/activities", params