• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

sleede / fab-manager / #106

pending completion
#106

push

coveralls-ruby

sylvainbx
Merge branch 'dev' for release 6.0.0

704 of 704 new or added lines in 168 files covered. (100.0%)

7919 of 13474 relevant lines covered (58.77%)

15.29 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/app/controllers/api/i_calendar_controller.rb
1
# frozen_string_literal: true
2

3
# API Controller for resources of type iCalendar
4
class API::ICalendarController < API::APIController
×
5
  before_action :authenticate_user!, except: %i[index events]
×
6
  before_action :set_i_cal, only: [:destroy]
×
7
  respond_to :json
×
8

9
  def index
×
10
    @i_cals = ICalendar.all
×
11
  end
×
12

13
  def create
×
14
    authorize ICalendar
×
15
    @i_cal = ICalendar.new(i_calendar_params)
×
16
    if @i_cal.save
×
17
      render :show, status: :created, location: @i_cal
×
18
    else
×
19
      render json: @i_cal.errors, status: :unprocessable_entity
×
20
    end
×
21
  end
×
22

23
  def destroy
×
24
    authorize ICalendar
×
25
    @i_cal.destroy
×
26
    head :no_content
×
27
  end
×
28

29
  def events
×
30
    start_date = ActiveSupport::TimeZone[params[:timezone]]&.parse(params[:start])
×
31
    end_date = ActiveSupport::TimeZone[params[:timezone]]&.parse(params[:end])&.end_of_day
×
32

33
    @events = ICalendarEvent.where(i_calendar_id: params[:id])
×
34
                            .where('dtstart >= ? AND dtend <= ?', start_date, end_date)
×
35
                            .joins(:i_calendar)
×
36
  end
×
37

38
  def sync
×
39
    ICalendarImportWorker.perform_async([params[:id]])
×
40
    render json: { processing: [params[:id]] }, status: :created
×
41
  end
×
42

43
  private
×
44

45
  def set_i_cal
×
46
    @i_cal = ICalendar.find(params[:id])
×
47
  end
×
48

49
  def i_calendar_params
×
50
    params.require(:i_calendar).permit(:name, :url, :color, :text_color, :text_hidden)
×
51
  end
×
52
end
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc