add_event 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +10 -0
- data/.rspec +2 -0
- data/.rubocop.yml +7 -0
- data/.travis.yml +8 -0
- data/.yardopts +1 -0
- data/CODE_OF_CONDUCT.md +13 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +81 -0
- data/Rakefile +6 -0
- data/add_event.gemspec +29 -0
- data/addthisevent-ruby.png +0 -0
- data/lib/add_event.rb +87 -0
- data/lib/add_event/params.rb +106 -0
- data/lib/add_event/service.rb +38 -0
- data/lib/add_event/url.rb +41 -0
- data/lib/add_event/version.rb +3 -0
- data/lib/helpers/configuration.rb +42 -0
- metadata +161 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: a5a0b02081e6af36688fd6e5807eaf1270f62a6b
|
4
|
+
data.tar.gz: e9c70144a0ea91bc5218383c9c920918f2f208d3
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 091ecab83f2ab0c0323ba2902e3569ca251f1fb94eb0fc5200eb605907c5a80d83559c32e3ca2045eeeae2d638bb08a9de34f6b8469f857f121d2f6ff33a650f
|
7
|
+
data.tar.gz: 9db672abb0e0ba3e3be3014249d6f98aa49ef7e91d28ff1c8bc421d624c79648696a6d52431d62a11e12851a83a2755013f6a637cc0677ea5eb7360a3b903cc6
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.rubocop.yml
ADDED
data/.travis.yml
ADDED
data/.yardopts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--no-private --exclude /helpers/** - CODE_OF_CONDUCT.md LICENSE.txt
|
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
# Contributor Code of Conduct
|
2
|
+
|
3
|
+
As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
|
4
|
+
|
5
|
+
We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, or religion.
|
6
|
+
|
7
|
+
Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
|
8
|
+
|
9
|
+
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
|
10
|
+
|
11
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
|
12
|
+
|
13
|
+
This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015 Mike Coutermarsh
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,81 @@
|
|
1
|
+
# AddEvent Ruby API Client
|
2
|
+
|
3
|
+
(Formally known as AddThisEvent)
|
4
|
+
|
5
|
+
:construction: Work in progress, don't use me yet! :warning:
|
6
|
+
|
7
|
+
![AddEvent Ruby API Client](https://raw.githubusercontent.com/mscoutermarsh/AddEvent-Ruby/master/addthisevent-ruby.png)
|
8
|
+
|
9
|
+
[![Build Status](https://travis-ci.org/mscoutermarsh/AddEvent-Ruby.svg)](https://travis-ci.org/mscoutermarsh/AddEvent-Ruby) [![Code Climate](https://codeclimate.com/github/mscoutermarsh/AddEvent-Ruby/badges/gpa.svg)](https://codeclimate.com/github/mscoutermarsh/AddEvent-Ruby) [![Test Coverage](https://codeclimate.com/github/mscoutermarsh/AddEvent-Ruby/badges/coverage.svg)](https://codeclimate.com/github/mscoutermarsh/AddEvent-Ruby/coverage) [![security](https://hakiri.io/github/mscoutermarsh/AddEvent-Ruby/master.svg)](https://hakiri.io/github/mscoutermarsh/AddEvent-Ruby/master)
|
10
|
+
|
11
|
+
Ruby client for the AddEvent.com API :zap: :smiley:.
|
12
|
+
|
13
|
+
Makes it super easy to create AddEvent URL's from Ruby.
|
14
|
+
|
15
|
+
## Installation
|
16
|
+
|
17
|
+
Add this line to your application's Gemfile:
|
18
|
+
|
19
|
+
```ruby
|
20
|
+
gem 'add_event'
|
21
|
+
```
|
22
|
+
|
23
|
+
And then execute:
|
24
|
+
|
25
|
+
$ bundle
|
26
|
+
|
27
|
+
Or install it yourself as:
|
28
|
+
|
29
|
+
$ gem install add_event
|
30
|
+
|
31
|
+
## Usage
|
32
|
+
|
33
|
+
You'll need an **AddEvent premium account** to use the API (sign up here: [addevent.com](https://addevent.com)).
|
34
|
+
|
35
|
+
Once you have a premium account, you'll need to set your `client_id` in an initializer (Rails), as an environment variable `ADD_EVENT_CLIENT_ID` or by passing it as an `option` each time when creating a new event URL.
|
36
|
+
```Ruby
|
37
|
+
# config/initializers/add_event.rb
|
38
|
+
AddEvent.configuration do |config|
|
39
|
+
# Your Client ID (License code) is available here: https://addevent.com/account/
|
40
|
+
config.client_id = 'your_id_goes_here'
|
41
|
+
end
|
42
|
+
```
|
43
|
+
|
44
|
+
Then to create an event, pass the `title`, `starts_at`, `ends_at` and `options` to `AddEvent.url`
|
45
|
+
|
46
|
+
```Ruby
|
47
|
+
party_starts = DateTime.new(2016, 10, 2, 18, 0, 0, '-7')
|
48
|
+
party_ends = DateTime.new(2016, 10, 3, 3, 0, 0, '-7')
|
49
|
+
|
50
|
+
event_options = {
|
51
|
+
service: :google, # or 'google' works too!
|
52
|
+
organizer: 'Mike',
|
53
|
+
organizer_email: 'coutermarsh.mike@gmail.com',
|
54
|
+
alert: 15, # set alarm for 15 minutes before the party starts
|
55
|
+
description: "A little get together to celebrate DHH's birthday. BYORG (Bring your own ruby gems)",
|
56
|
+
location: "Ruby Bar, San Francisco CA"
|
57
|
+
}
|
58
|
+
|
59
|
+
url = AddEvent.url(title: "DHH's Birthday Bash", starts_at: party_starts,
|
60
|
+
ends_at: party_ends, options: event_options)
|
61
|
+
```
|
62
|
+
|
63
|
+
To see the full list of available options, see the documentation here (TODO).
|
64
|
+
|
65
|
+
## Development
|
66
|
+
|
67
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake rspec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
68
|
+
|
69
|
+
To install this gem onto your local machine, run `bundle exec rake install`.
|
70
|
+
|
71
|
+
## Contributing :heart:
|
72
|
+
|
73
|
+
Want to make this better? Great! :smile:
|
74
|
+
|
75
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/mscoutermarsh/AddEvent-Ruby. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
76
|
+
|
77
|
+
|
78
|
+
## License
|
79
|
+
|
80
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
81
|
+
|
data/Rakefile
ADDED
data/add_event.gemspec
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'add_event/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'add_event'
|
8
|
+
spec.version = AddEvent::VERSION
|
9
|
+
spec.authors = ['Mike Coutermarsh']
|
10
|
+
spec.email = ['coutermarsh.mike@gmail.com']
|
11
|
+
|
12
|
+
spec.summary = 'Ruby client for using the AddEvent API (https://addevent.com/api)'
|
13
|
+
spec.description = 'Ruby client for using the AddEvent API (https://addevent.com/api)'
|
14
|
+
spec.homepage = 'https://github.com/mscoutermarsh/AddEvent-Ruby'
|
15
|
+
spec.license = 'MIT'
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features|bin)/}) }
|
18
|
+
spec.bindir = 'exe'
|
19
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
|
+
spec.require_paths = ['lib']
|
21
|
+
|
22
|
+
spec.add_dependency 'addressable', '~> 2.3'
|
23
|
+
spec.add_development_dependency 'bundler', '~> 1.10'
|
24
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
25
|
+
spec.add_development_dependency 'rspec'
|
26
|
+
spec.add_development_dependency 'pry'
|
27
|
+
spec.add_development_dependency 'codeclimate-test-reporter'
|
28
|
+
spec.add_development_dependency 'rubocop', '~> 0.34'
|
29
|
+
end
|
Binary file
|
data/lib/add_event.rb
ADDED
@@ -0,0 +1,87 @@
|
|
1
|
+
require 'add_event/version'
|
2
|
+
require 'add_event/url'
|
3
|
+
require 'date'
|
4
|
+
require 'helpers/configuration'
|
5
|
+
|
6
|
+
##
|
7
|
+
# Ruby Client for the AddEvent API. Makes it easy to generate event invites from Ruby.
|
8
|
+
module AddEvent
|
9
|
+
extend Configuration
|
10
|
+
|
11
|
+
##
|
12
|
+
# Set the API client ID. (https://addevent.com/account)
|
13
|
+
#
|
14
|
+
# == Usage
|
15
|
+
# # config/initializers/add_event.rb
|
16
|
+
# AddEvent.configuration do |config|
|
17
|
+
# # Your Client ID (License code) is available here: https://addevent.com/account/
|
18
|
+
# config.client_id = 'your_id_goes_here'
|
19
|
+
# end
|
20
|
+
define_setting :client_id
|
21
|
+
|
22
|
+
##
|
23
|
+
# Creates an AddEvent URL
|
24
|
+
#
|
25
|
+
# == Usage
|
26
|
+
# party_starts = DateTime.new(2016, 10, 2, 18, 0, 0, '+7')
|
27
|
+
# party_ends = DateTime.new(2016, 10, 3, 3, 0, 0, '+7')
|
28
|
+
#
|
29
|
+
# event_options = {
|
30
|
+
# service: :google, # or 'google' works too!
|
31
|
+
# organizer: 'Mike',
|
32
|
+
# organizer_email: 'coutermarsh.mike@gmail.com',
|
33
|
+
# alert: 15, # set alarm for 15 minutes before the party starts
|
34
|
+
# description: "A little get together to celebrate DHH's birthday. BYORG (Bring your own ruby gems)",
|
35
|
+
# location: "Ruby Bar, San Francisco CA"
|
36
|
+
# }
|
37
|
+
#
|
38
|
+
# url = AddEvent.url(title: "DHH's Birthday Bash", starts_at: party_starts,
|
39
|
+
# ends_at: party_ends, options: event_options)
|
40
|
+
#
|
41
|
+
# == Time Zones
|
42
|
+
# To keep things simple, this gem converts the <code>starts_at</code> and <code>ends_at</code>
|
43
|
+
# to UTC and sends all times to AddEvent as UTC. When the end user adds the event to their
|
44
|
+
# calendar, it will automatically be converted to their local timezone.
|
45
|
+
#
|
46
|
+
# @overload url(title, starts_at, ends_at, options)
|
47
|
+
# @param [String] title The title of the event (this is what users will see on their calendar)
|
48
|
+
# @param [DateTime] starts_at
|
49
|
+
# The <code>DateTime</code> of when the event begins.
|
50
|
+
# @param [DateTime] ends_at
|
51
|
+
# The <code>DateTime</code> of when the event ends.
|
52
|
+
# @param [Hash] options Optional parameters for creating the event.
|
53
|
+
# @option options [String] :client_id
|
54
|
+
# The API client id (https://addthisevent.com/account). Only need to include this
|
55
|
+
# if you did not set it using +config+.
|
56
|
+
# @option options [Symbol, String] :service
|
57
|
+
# Type of service you'd like the event generated for.
|
58
|
+
# Available services are <code>:outlook, :google, :appleical, :outlookcom or :yahoo.</code>
|
59
|
+
# May be passed as a string (<code>'outlook'</code>) or a symbol (<code>:outlook</code>)
|
60
|
+
# @option options [Integer] :alarm
|
61
|
+
# Set a reminder alarm before the event. Integer in # of minutes before the event starts.
|
62
|
+
# @option options [String] :organizer
|
63
|
+
# Event organizer's name
|
64
|
+
# @option options [String] :organizer_email
|
65
|
+
# Event organizers email
|
66
|
+
# @option options [String] :description
|
67
|
+
# Event description (Max 300 chars recommended)
|
68
|
+
# @option options [String] :location
|
69
|
+
# Location of the Event. Ex: +'San Francisco, CA'+
|
70
|
+
# @option options [String] :reference
|
71
|
+
# Tracking parameter for analytics. Ex: <code>"iPhone"</code> or <code>"Newsletter Oct 2016"</code>
|
72
|
+
# @option options [String] :template
|
73
|
+
# ID of a AddEvent template. Uses the default template if not defined.
|
74
|
+
# You can get this ID from the AddEvent dashboard after creating a template.
|
75
|
+
# @option options [Boolean] :all_day_event (false)
|
76
|
+
# Is it an all day event? True or False
|
77
|
+
#
|
78
|
+
# @return [String] AddEvent Direct URL
|
79
|
+
#
|
80
|
+
# @api public
|
81
|
+
def self.url(title:, starts_at:, ends_at:, options: {})
|
82
|
+
options = { client_id: client_id || ENV['ADD_EVENT_CLIENT_ID'] }.merge(options)
|
83
|
+
|
84
|
+
Url.new(title: title, starts_at: starts_at, ends_at: ends_at,
|
85
|
+
options: options).to_s
|
86
|
+
end
|
87
|
+
end
|
@@ -0,0 +1,106 @@
|
|
1
|
+
require 'add_event/service'
|
2
|
+
require 'forwardable'
|
3
|
+
require 'ostruct'
|
4
|
+
|
5
|
+
module AddEvent
|
6
|
+
# Takes in a hash of parameters and formats them for use with the AddEvent API
|
7
|
+
class Params
|
8
|
+
extend Forwardable
|
9
|
+
|
10
|
+
# Available parameters. Full docs: https://addthisevent.com/api/
|
11
|
+
KEYS = %i(alarm all_day_event client date_format description end endext endtime location
|
12
|
+
organizer organizer_email reference service start startext starttime template timezone title).freeze
|
13
|
+
|
14
|
+
VALID_SERVICES = %w(outlook google appleical outlookcom yahoo).freeze
|
15
|
+
DATE_FORMAT = 'MM/DD/YYYY'.freeze
|
16
|
+
|
17
|
+
attr_reader :params
|
18
|
+
|
19
|
+
delegate %i(title organizer description location organizer_email template reference alarm) => :params
|
20
|
+
|
21
|
+
##
|
22
|
+
# @param [Hash] params
|
23
|
+
#
|
24
|
+
# @return [AddEvent::Params]
|
25
|
+
#
|
26
|
+
# @api public
|
27
|
+
def initialize(params)
|
28
|
+
@params = OpenStruct.new(params)
|
29
|
+
end
|
30
|
+
|
31
|
+
##
|
32
|
+
# Returns a hash with only valid params for the AddEvent API
|
33
|
+
#
|
34
|
+
# @return [Hash]
|
35
|
+
#
|
36
|
+
# @api public
|
37
|
+
def to_h
|
38
|
+
KEYS.each_with_object({}) { |key, output| output[key] = send(key) }
|
39
|
+
end
|
40
|
+
|
41
|
+
private
|
42
|
+
|
43
|
+
# The AddEvent API client_id
|
44
|
+
def client
|
45
|
+
return params.client_id unless params.client_id.nil?
|
46
|
+
fail(ArgumentError, 'client_id must not be nil. ' \
|
47
|
+
'Visit https://addthisevent.com/account/ to get your client_id (License Code)')
|
48
|
+
end
|
49
|
+
|
50
|
+
def starts_at_utc
|
51
|
+
@starts_at_utc ||= params.starts_at.new_offset(0)
|
52
|
+
end
|
53
|
+
|
54
|
+
def ends_at_utc
|
55
|
+
@ends_at_utc ||= params.ends_at.new_offset(0)
|
56
|
+
end
|
57
|
+
|
58
|
+
# Event start date. Mandatory. Format: "MM/DD/YYYY"
|
59
|
+
def start
|
60
|
+
starts_at_utc.strftime('%m/%d/%Y')
|
61
|
+
end
|
62
|
+
|
63
|
+
# Event end date. Mandatory. Format: "MM/DD/YYYY"
|
64
|
+
def end
|
65
|
+
ends_at_utc.strftime('%m/%d/%Y')
|
66
|
+
end
|
67
|
+
|
68
|
+
# Event start time. Mandatory. Format: "HH/MM/SS"
|
69
|
+
def starttime
|
70
|
+
starts_at_utc.strftime('%H:%M:%S')
|
71
|
+
end
|
72
|
+
|
73
|
+
# Event end time. Mandatory. Format: "HH/MM/SS"
|
74
|
+
def endtime
|
75
|
+
ends_at_utc.strftime('%H:%M:%S')
|
76
|
+
end
|
77
|
+
|
78
|
+
# AM or PM
|
79
|
+
def startext
|
80
|
+
starts_at_utc.strftime('%p')
|
81
|
+
end
|
82
|
+
|
83
|
+
def endext
|
84
|
+
ends_at_utc.strftime('%p')
|
85
|
+
end
|
86
|
+
|
87
|
+
def date_format
|
88
|
+
DATE_FORMAT
|
89
|
+
end
|
90
|
+
|
91
|
+
def service
|
92
|
+
AddEvent::Service.new(params[:service]).value
|
93
|
+
end
|
94
|
+
|
95
|
+
# The AddEvent API only accepts location timezones. It's impossible to determine this
|
96
|
+
# accurately from a Ruby DateTime object. So we'll always send the times as UTC to the API.
|
97
|
+
def timezone
|
98
|
+
# Casablanca is a 00:00 neutral zone with no DST. Their TZID is "Africa/Casablanca".
|
99
|
+
'Africa/Casablanca'
|
100
|
+
end
|
101
|
+
|
102
|
+
def all_day_event
|
103
|
+
params.all_day_event == true
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
##
|
2
|
+
# Validates and provides a Service value for the AddEvent API
|
3
|
+
module AddEvent
|
4
|
+
class Service
|
5
|
+
VALID_SERVICES = %w(appleical google outlook outlookcom yahoo).freeze
|
6
|
+
|
7
|
+
##
|
8
|
+
# @param [String, Symbol] service
|
9
|
+
# The type of service to create the event for
|
10
|
+
#
|
11
|
+
# @return [AddEvent::Service]
|
12
|
+
#
|
13
|
+
# @api public
|
14
|
+
def initialize(service)
|
15
|
+
fail(ArgumentError, "service must set to #{VALID_SERVICES.join(', ')} or nil") unless valid_service?(service)
|
16
|
+
@service = service || ''
|
17
|
+
end
|
18
|
+
|
19
|
+
##
|
20
|
+
# Returns a proper service value for the API
|
21
|
+
# either a string if a valid service was passed, or nil.
|
22
|
+
#
|
23
|
+
# @return [String]
|
24
|
+
#
|
25
|
+
# @api public
|
26
|
+
def value
|
27
|
+
return nil if @service.empty?
|
28
|
+
@service.to_s
|
29
|
+
end
|
30
|
+
|
31
|
+
private
|
32
|
+
|
33
|
+
def valid_service?(service)
|
34
|
+
return true if service.nil? || service.empty?
|
35
|
+
VALID_SERVICES.include?(service.to_s)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
require 'addressable/template'
|
2
|
+
require 'add_event/params'
|
3
|
+
|
4
|
+
##
|
5
|
+
# An AddEvent::Url that conforms to the Direct URL API (https://addthisevent.com/api)
|
6
|
+
module AddEvent
|
7
|
+
class Url
|
8
|
+
URL_TEMPLATE = Addressable::Template.new("https://addevent.to/dir/{?#{Params::KEYS.join(',')}}").freeze
|
9
|
+
|
10
|
+
##
|
11
|
+
# Creates an AddEvent URL
|
12
|
+
#
|
13
|
+
# @param [String] title
|
14
|
+
# @param [DateTime] starts_at
|
15
|
+
# The <code>DateTime</code> of when the event begins.
|
16
|
+
# @param [DateTime] ends_at
|
17
|
+
# The <code>DateTime</code> of when the event ends.
|
18
|
+
# @param [Hash] options
|
19
|
+
#
|
20
|
+
# @return [AddEvent::Url]
|
21
|
+
#
|
22
|
+
# @api public
|
23
|
+
def initialize(title:, starts_at:, ends_at:, options: {})
|
24
|
+
@title = title
|
25
|
+
@starts_at = starts_at
|
26
|
+
@ends_at = ends_at
|
27
|
+
@params = AddEvent::Params.new(options.merge(title: title,
|
28
|
+
starts_at: starts_at,
|
29
|
+
ends_at: ends_at))
|
30
|
+
end
|
31
|
+
|
32
|
+
##
|
33
|
+
# Returns the AddEvent URL as a string
|
34
|
+
# @return [String]
|
35
|
+
#
|
36
|
+
# @api public
|
37
|
+
def to_s
|
38
|
+
URL_TEMPLATE.expand(@params.to_h).to_s
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# Configuration Helper: https://viget.com/extend/easy-gem-configuration-variables-with-defaults
|
2
|
+
#
|
3
|
+
# Usage Example:
|
4
|
+
#
|
5
|
+
# require 'helpers/configuration'
|
6
|
+
# module MyGem
|
7
|
+
# extend Configuration
|
8
|
+
#
|
9
|
+
# define_setting :access_token
|
10
|
+
# define_setting :favorite_liquid, 'apple juice'
|
11
|
+
# end
|
12
|
+
#
|
13
|
+
# # config/initializers/my_gem.rb
|
14
|
+
# MyGem.configuration do |config|
|
15
|
+
# config.access_token = 'token'
|
16
|
+
# config.favorite_liquid = 'gluten free apple juice'
|
17
|
+
# end
|
18
|
+
module Configuration
|
19
|
+
def configuration
|
20
|
+
yield self
|
21
|
+
end
|
22
|
+
|
23
|
+
def define_setting(name, default = nil)
|
24
|
+
class_variable_set("@@#{name}", default)
|
25
|
+
|
26
|
+
define_class_method "#{name}=" do |value|
|
27
|
+
class_variable_set("@@#{name}", value)
|
28
|
+
end
|
29
|
+
|
30
|
+
define_class_method name do
|
31
|
+
class_variable_get("@@#{name}")
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
private
|
36
|
+
|
37
|
+
def define_class_method(name, &block)
|
38
|
+
(class << self; self; end).instance_eval do
|
39
|
+
define_method name, &block
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
metadata
ADDED
@@ -0,0 +1,161 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: add_event
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Mike Coutermarsh
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-11-22 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: addressable
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '2.3'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '2.3'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.10'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.10'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '10.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '10.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: pry
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: codeclimate-test-reporter
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rubocop
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0.34'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0.34'
|
111
|
+
description: Ruby client for using the AddEvent API (https://addevent.com/api)
|
112
|
+
email:
|
113
|
+
- coutermarsh.mike@gmail.com
|
114
|
+
executables: []
|
115
|
+
extensions: []
|
116
|
+
extra_rdoc_files: []
|
117
|
+
files:
|
118
|
+
- ".gitignore"
|
119
|
+
- ".rspec"
|
120
|
+
- ".rubocop.yml"
|
121
|
+
- ".travis.yml"
|
122
|
+
- ".yardopts"
|
123
|
+
- CODE_OF_CONDUCT.md
|
124
|
+
- Gemfile
|
125
|
+
- LICENSE.txt
|
126
|
+
- README.md
|
127
|
+
- Rakefile
|
128
|
+
- add_event.gemspec
|
129
|
+
- addthisevent-ruby.png
|
130
|
+
- lib/add_event.rb
|
131
|
+
- lib/add_event/params.rb
|
132
|
+
- lib/add_event/service.rb
|
133
|
+
- lib/add_event/url.rb
|
134
|
+
- lib/add_event/version.rb
|
135
|
+
- lib/helpers/configuration.rb
|
136
|
+
homepage: https://github.com/mscoutermarsh/AddEvent-Ruby
|
137
|
+
licenses:
|
138
|
+
- MIT
|
139
|
+
metadata: {}
|
140
|
+
post_install_message:
|
141
|
+
rdoc_options: []
|
142
|
+
require_paths:
|
143
|
+
- lib
|
144
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
145
|
+
requirements:
|
146
|
+
- - ">="
|
147
|
+
- !ruby/object:Gem::Version
|
148
|
+
version: '0'
|
149
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
150
|
+
requirements:
|
151
|
+
- - ">="
|
152
|
+
- !ruby/object:Gem::Version
|
153
|
+
version: '0'
|
154
|
+
requirements: []
|
155
|
+
rubyforge_project:
|
156
|
+
rubygems_version: 2.4.8
|
157
|
+
signing_key:
|
158
|
+
specification_version: 4
|
159
|
+
summary: Ruby client for using the AddEvent API (https://addevent.com/api)
|
160
|
+
test_files: []
|
161
|
+
has_rdoc:
|