Module: AddEvent
- Extended by:
- Configuration
- Defined in:
- lib/add_event.rb,
lib/add_event/url.rb,
lib/add_event/params.rb,
lib/add_event/service.rb,
lib/add_event/version.rb
Overview
Validates and provides a Service value for the AddEvent API
Defined Under Namespace
Constant Summary collapse
- VERSION =
'0.1.0'.freeze
Class Method Summary collapse
-
.url(title, starts_at, ends_at, options) ⇒ String
Creates an AddEvent URL.
Instance Method Summary collapse
-
#client_id ⇒ Object
Set the API client ID.
Class Method Details
.url(title, starts_at, ends_at, options) ⇒ String
Creates an AddEvent URL
Usage
party_starts = DateTime.new(2016, 10, 2, 18, 0, 0, '+7')
party_ends = DateTime.new(2016, 10, 3, 3, 0, 0, '+7')
= {
service: :google, # or 'google' works too!
organizer: 'Mike',
organizer_email: '[email protected]',
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 = AddEvent.url(title: "DHH's Birthday Bash", starts_at: party_starts,
ends_at: party_ends, options: )
Time Zones
To keep things simple, this gem converts the starts_at and ends_at to UTC and sends all times to AddEvent as UTC. When the end user adds the event to their calendar, it will automatically be converted to their local timezone.
81 82 83 84 85 86 |
# File 'lib/add_event.rb', line 81 def self.url(title:, starts_at:, ends_at:, options: {}) = { client_id: client_id || ENV['ADD_EVENT_CLIENT_ID'] }.merge() Url.new(title: title, starts_at: starts_at, ends_at: ends_at, options: ).to_s end |
Instance Method Details
#client_id ⇒ Object
Set the API client ID. (addevent.com/account)
Usage
# config/initializers/add_event.rb
AddEvent.configuration do |config|
# Your Client ID (License code) is available here: https://addevent.com/account/
config.client_id = 'your_id_goes_here'
end
20 |
# File 'lib/add_event.rb', line 20 define_setting :client_id |