<commit_before>require 'add_this_event/version'
require 'add_this_event/url'
require 'date'
require 'helpers/configuration'

##
# Ruby Client for the AddThisEvent API. Makes it easy to generate event invites from Ruby.
module AddThisEvent
  extend Configuration

  ##
  # Set the API client ID. (https://addthisevent.com/account)
  #
  # == Usage
  #  # config/initializers/add_this_event.rb
  #  AddThisEvent.configuration do |config|
  #    # Your Client ID (License code) is available here: https://addthisevent.com/account/
  #    config.client_id = 'your_id_goes_here'
  #  end
  define_setting :client_id

  ##
  # Creates an AddThisEvent URL
  #
  # @param [String] title The title of the event (this is what users will see on their calendar)
  # @param [DateTime] starts_at
  #   The <code>DateTime</code> of when the event begins.
  # @param [DateTime] ends_at
  #   The <code>DateTime</code> of when the event ends.
  # @param [Hash] options Optional parameters for creating the event.
  # @option options [String] :client_id The API client id (https://addthisevent.com/account)
  # @option options [Symbol, String] :service Invite format: [:outlook, :google, :appleical, :outlookcom, :yahoo]
  # @option options [Integer] :alarm Set a reminder alarm before the event. Integer in # of minutes.
  # @option options [String] :organizer Event Organizer's Name
  # @option options [String] :organizer_email Recipient email
  # @option options [String] :description Event description (Max 300 chars recommended)
  # @option options [String] :location Location of the Event. Ex: San Francisco, CA
  # @option options [String] :reference Tracking parameter for analytics. Ex: "iPhone" or "Newsletter Oct 2016"
  # @option options [String] :template ID of a AddThisEvent template. Uses the default template if not defined.
  # @option options [Boolean] :all_day_event All day event. True or False
  #
  # @return [String] AddThisEvent Direct URL
  #
  # @api public
  def self.url(title:, starts_at:, ends_at:, options: {})
    options = { client_id: client_id }.merge(options)

    Url.new(title: title, starts_at: starts_at, ends_at: ends_at,
            options: options).to_s
  end
end<commit_msg>Better documentation! with an example<commit_after>require 'add_this_event/version'
require 'add_this_event/url'
require 'date'
require 'helpers/configuration'

##
# Ruby Client for the AddThisEvent API. Makes it easy to generate event invites from Ruby.
module AddThisEvent
  extend Configuration

  ##
  # Set the API client ID. (https://addthisevent.com/account)
  #
  # == Usage
  #  # config/initializers/add_this_event.rb
  #  AddThisEvent.configuration do |config|
  #    # Your Client ID (License code) is available here: https://addthisevent.com/account/
  #    config.client_id = 'your_id_goes_here'
  #  end
  define_setting :client_id

  ##
  # Creates an AddThisEvent URL
  #
  # @param [String] title The title of the event (this is what users will see on their calendar)
  # @param [DateTime] starts_at
  #   The <code>DateTime</code> of when the event begins.
  # @param [DateTime] ends_at
  #   The <code>DateTime</code> of when the event ends.
  # @param [Hash] options Optional parameters for creating the event.
  #
  # @overload wrap(options)
  #   @option options [String] :client_id
  #     The API client id (https://addthisevent.com/account). Only need to include this
  #     if you did not set it using +config+.
  #   @option options [Symbol, String] :service
  #     Type of service you'd like the event generated for.
  #     Available services are <code>:outlook, :google, :appleical, :outlookcom or :yahoo.</code>
  #     May be passed as a string (<code>'outlook'</code>) or a symbol (<code>:outlook</code>)
  #   @option options [Integer] :alarm
  #     Set a reminder alarm before the event. Integer in # of minutes before the event starts.
  #   @option options [String] :organizer
  #     Event organizer's name
  #   @option options [String] :organizer_email
  #     Event organizers email
  #   @option options [String] :description
  #     Event description (Max 300 chars recommended)
  #   @option options [String] :location
  #     Location of the Event. Ex: +'San Francisco, CA'+
  #   @option options [String] :reference
  #     Tracking parameter for analytics. Ex: <code>"iPhone"</code> or <code>"Newsletter Oct 2016"</code>
  #   @option options [String] :template (default)
  #     ID of a AddThisEvent template. Uses the default template if not defined.
  #     You can get this ID from the AddThisEvent dashboard after creating a template.
  #   @option options [Boolean] :all_day_event (false)
  #     Is it an all day event? True or False
  #
  # == Usage
  #  party_starts = DateTime.new(2016, 10, 2, 18, 0, 0, '+7')
  #  party_ends = DateTime.new(2016, 10, 3, 3, 0, 0, '+7')
  #
  #  event_options = {
  #    service: :google, # or 'google' works too!
  #    organizer: 'Mike',
  #    organizer_email: '<EMAIL>',
  #    alert: 15, # set alarm for 15 minutes before the party starts
  #    description: "A little get together to celebrate DHH's birthday. BYORG (Bring your own ruby gems)",
  #    location: "Ruby Bar, San Francisco CA"
  #  }
  #
  #  url = AddThisEvent.url(title: "DHH's Birthday Bash", starts_at: party_starts, ends_at: party_ends, options: event_options)
  #
  #
  # @return [String] AddThisEvent Direct URL
  #
  # @api public
  def self.url(title:, starts_at:, ends_at:, options: {})
    options = { client_id: client_id }.merge(options)

    Url.new(title: title, starts_at: starts_at, ends_at: ends_at,
            options: options).to_s
  end
end
{'fraction_non_alphanumeric': 0.10749822316986496, 'fraction_numerical': 0.00728500355366027, 'mean_word_length': 3.64822460776218, 'pattern_counts': {'":': 0, '<': 22, '<?xml version=': 0, '>': 22, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6097242', 'n_tokens_mistral': 1811, 'n_tokens_neox': 1740, 'n_words': 612}