Sha256: cb6cc0d3248b079a59dcc014100ed2d34f302bcab20c11249259c89bdfd1c1ef

Contents?: true

Size: 1.72 KB

Versions: 2

Compression:

Stored size: 1.72 KB

Contents

# lib/cal_invite.rb
require 'active_support'
require 'active_support/core_ext'
require 'securerandom'
require 'time'
require 'uri'

require 'cal_invite/version'
require 'cal_invite/configuration'
require 'cal_invite/caching'
require 'cal_invite/event'
require 'cal_invite/providers'

# The main module for the CalInvite gem. This module provides functionality for generating
# calendar invites across different calendar providers.
#
# @example Configure the gem
#   CalInvite.configure do |config|
#     config.timezone = 'America/New_York'
#     config.cache_store = :memory_store
#   end
#
# @example Create and generate a calendar URL
#   event = CalInvite::Event.new(
#     title: "Team Meeting",
#     start_time: Time.now,
#     end_time: Time.now + 3600
#   )
#   google_url = event.generate_calendar_url(:google)
#
module CalInvite
  class Error < StandardError; end

  class << self
    # Returns the current configuration object.
    # @return [CalInvite::Configuration] The current configuration object
    attr_accessor :configuration

    # Configures the CalInvite gem through a block.
    #
    # @yield [config] The configuration object to be modified
    # @yieldparam config [CalInvite::Configuration] The configuration object
    # @return [void]
    #
    # @example
    #   CalInvite.configure do |config|
    #     config.timezone = 'UTC'
    #     config.cache_store = :memory_store
    #   end
    def configure
      self.configuration ||= Configuration.new
      yield(configuration)
    end

    # Resets the configuration to default values.
    #
    # @return [void]
    def reset_configuration!
      self.configuration = Configuration.new
    end

    # Include caching methods at the module level
    include Caching
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
cal-invite-0.1.5 lib/cal_invite.rb
cal-invite-0.1.4 lib/cal_invite.rb