# jaredlt/add_to_calendar architecture

> Architecture diagram of the GitHub repository jaredlt/add_to_calendar, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/jaredlt/add_to_calendar
- Repository: https://github.com/jaredlt/add_to_calendar

## Overview

##### Project Type Analysis
This is an open-source Ruby gem that serves as a utility library for generating calendar event URLs across multiple calendar providers. The project follows a standard Ruby gem structure with clear separation of concerns.

##### Main Components

A. Core Component Layer:
- AddToCalendar::URLs Class (Main Interface)
- URL Generators (Individual Provider Implementations)

B. External Integration Layer:
- Calendar Service Providers
- Client Applications

##### Component Organization

**[Client Applications]**
- ↓
**[AddToCalendar Gem]**

- [Core URL Class]

- [URL Generators]
- Google URL Generator
- Yahoo URL Generator
- Hey URL Generator
- Office365 URL Generator
- Outlook.com URL Generator
- iCal URL Generator

- ↓
**[Calendar Services]**

##### Specific Implementation Details

a) Input Processing:
- How event attributes flow into the system
- Required fields (start_datetime, title, timezone)

b) URL Generation Flow:
- Demonstrate the transformation of inputs into formatted URLs
- Different output formats for different providers

c) Integration Points:
- How the gem interfaces with different calendar services
- Different URL formats (direct links vs data-uri)

##### Key Relationships to Highlight

- Single entry point (URLs class) and how it delegates to specific providers
- Demonstrate the relationship between input parameters and generated URLs
- Validation and formatting processes

##### Additional Details

Annotations for:
- Required vs optional parameters
- Special handling for all-day events
- URL formatting specifications
- Timezone conversion logic

This system design should help developers understand both the high-level architecture and the specific implementation details of the add_to_calendar gem, making it easier to maintain and extend the codebase.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client["Client Applications"]
        App[Client Application]
    end

    subgraph Gem["AddToCalendar Gem"]
        Core["Core Interface (URLs Class)"]:::core
        click Core "https://github.com/jaredlt/add_to_calendar/blob/main/lib/add_to_calendar.rb"

        subgraph Components["Core Components"]
            Version["Version Management"]:::component
            click Version "https://github.com/jaredlt/add_to_calendar/blob/main/lib/add_to_calendar/version.rb"
            
            DateHandler["Date Handler"]:::component
            click DateHandler "https://github.com/jaredlt/add_to_calendar/blob/main/test/urls/dates_test.rb"
        end

        subgraph Generators["URL Generators"]
            Google["Google Calendar"]:::generator
            click Google "https://github.com/jaredlt/add_to_calendar/blob/main/test/urls/google_url_test.rb"
            
            Yahoo["Yahoo Calendar"]:::generator
            click Yahoo "https://github.com/jaredlt/add_to_calendar/blob/main/test/urls/yahoo_url_test.rb"
            
            Hey["Hey Calendar"]:::generator
            click Hey "https://github.com/jaredlt/add_to_calendar/blob/main/test/urls/hey_url_test.rb"
            
            Office365["Office 365"]:::generator
            click Office365 "https://github.com/jaredlt/add_to_calendar/blob/main/test/urls/office365_test.rb"
            
            OutlookCom["Outlook.com"]:::generator
            click OutlookCom "https://github.com/jaredlt/add_to_calendar/blob/main/test/urls/outlook_com_url_test.rb"
            
            ICal["iCal Format"]:::generator
            click ICal "https://github.com/jaredlt/add_to_calendar/blob/main/test/urls/ical_url_test.rb"
        end
    end

    subgraph Services["Calendar Services"]
        GoogleService["Google Calendar"]:::service
        YahooService["Yahoo Calendar"]:::service
        HeyService["Hey Calendar"]:::service
        Office365Service["Office 365"]:::service
        OutlookService["Outlook.com"]:::service
        ICalService["iCal Compatible"]:::service
    end

    %% Relationships
    App -->|Input| Core
    Core --> Components
    Core --> Generators
    Google --> GoogleService
    Yahoo --> YahooService
    Hey --> HeyService
    Office365 --> Office365Service
    OutlookCom --> OutlookService
    ICal --> ICalService

    %% Styling
    classDef core fill:#a8e6cf,stroke:#3b6978
    classDef component fill:#dcedc1,stroke:#3b6978
    classDef generator fill:#ffd3b6,stroke:#3b6978
    classDef service fill:#ffaaa5,stroke:#3b6978

    %% Legend
    subgraph Legend
        L1[Core Interface]:::core
        L2[Core Component]:::component
        L3[URL Generator]:::generator
        L4[External Service]:::service
    end
```
