omnievent 0.1.0.pre1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.rspec +4 -0
- data/.rubocop.yml +48 -0
- data/CHANGELOG.md +5 -0
- data/CODE_OF_CONDUCT.md +84 -0
- data/Gemfile +14 -0
- data/Gemfile.lock +78 -0
- data/LICENSE.txt +21 -0
- data/README.md +63 -0
- data/Rakefile +12 -0
- data/lib/omnievent/builder.rb +34 -0
- data/lib/omnievent/configuration.rb +58 -0
- data/lib/omnievent/event_hash.rb +290 -0
- data/lib/omnievent/key_store.rb +24 -0
- data/lib/omnievent/strategies/developer.rb +88 -0
- data/lib/omnievent/strategy.rb +190 -0
- data/lib/omnievent/utils.rb +87 -0
- data/lib/omnievent/version.rb +5 -0
- data/lib/omnievent.rb +86 -0
- data/omnievent.gemspec +37 -0
- data/sig/omnievent.rbs +4 -0
- metadata +152 -0
data/lib/omnievent.rb
ADDED
@@ -0,0 +1,86 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "logger"
|
4
|
+
|
5
|
+
# Base module for OmniEvent
|
6
|
+
module OmniEvent
|
7
|
+
class Error < StandardError; end
|
8
|
+
class MissingStrategy < StandardError; end
|
9
|
+
class StrategyNotIncluded < StandardError; end
|
10
|
+
class StrategyNotConfigured < StandardError; end
|
11
|
+
|
12
|
+
module Strategies
|
13
|
+
autoload :Developer, "omnievent/strategies/developer"
|
14
|
+
end
|
15
|
+
|
16
|
+
autoload :Utils, "omnievent/utils"
|
17
|
+
autoload :Configuration, "omnievent/configuration"
|
18
|
+
autoload :Strategy, "omnievent/strategy"
|
19
|
+
autoload :Builder, "omnievent/builder"
|
20
|
+
autoload :KeyStore, "omnievent/key_store"
|
21
|
+
autoload :EventHash, "omnievent/event_hash"
|
22
|
+
|
23
|
+
class ActiveStrategies < OmniEvent::KeyStore; end
|
24
|
+
|
25
|
+
class << self
|
26
|
+
# The default logger.
|
27
|
+
def default_logger
|
28
|
+
logger = ::Logger.new($stdout)
|
29
|
+
logger.progname = "omniauth"
|
30
|
+
logger
|
31
|
+
end
|
32
|
+
|
33
|
+
# Get the configuration.
|
34
|
+
def config
|
35
|
+
Configuration.instance
|
36
|
+
end
|
37
|
+
|
38
|
+
# Setup the configuration.
|
39
|
+
def configure
|
40
|
+
yield config
|
41
|
+
end
|
42
|
+
|
43
|
+
# Get the current logger.
|
44
|
+
def logger
|
45
|
+
config.logger
|
46
|
+
end
|
47
|
+
|
48
|
+
# All available strategies.
|
49
|
+
def strategies
|
50
|
+
@strategies ||= []
|
51
|
+
end
|
52
|
+
|
53
|
+
# All active strategies.
|
54
|
+
def active_strategies
|
55
|
+
@active_strategies ||= ActiveStrategies.new
|
56
|
+
end
|
57
|
+
|
58
|
+
# List events.
|
59
|
+
def list_events(provider = nil, opts = {})
|
60
|
+
raise ArgumentError, "You need to pass a provider name as the first argument." unless provider
|
61
|
+
|
62
|
+
strategy_instance(provider).request(:list_events, opts)
|
63
|
+
end
|
64
|
+
|
65
|
+
def strategy_instance(provider)
|
66
|
+
klass = provider_class(provider)
|
67
|
+
raise MissingStrategy, "Could not find matching strategy for #{klass.inspect}." unless klass
|
68
|
+
|
69
|
+
strategy_proc = active_strategies[klass]
|
70
|
+
|
71
|
+
raise StrategyNotConfigured, "Strategy for #{klass.inspect} has not be configured." unless strategy_proc
|
72
|
+
|
73
|
+
strategy_proc.call
|
74
|
+
end
|
75
|
+
|
76
|
+
def provider_class(provider)
|
77
|
+
klass = OmniEvent::Utils.camelize(provider.to_s).to_s
|
78
|
+
|
79
|
+
begin
|
80
|
+
OmniEvent::Strategies.const_get(klass, false)
|
81
|
+
rescue NameError
|
82
|
+
false
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
data/omnievent.gemspec
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
lib = File.expand_path("lib", __dir__)
|
4
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
|
+
require "omnievent/version"
|
6
|
+
|
7
|
+
Gem::Specification.new do |spec|
|
8
|
+
spec.name = "omnievent"
|
9
|
+
spec.version = OmniEvent::VERSION
|
10
|
+
spec.authors = ["Angus McLeod"]
|
11
|
+
spec.email = ["development@pavilion.tech"]
|
12
|
+
spec.description = "Manage events from any calendar, event discovery, event ticketing,
|
13
|
+
event management, social network or video conferencing provider."
|
14
|
+
spec.summary = "Manage events from multiple providers."
|
15
|
+
spec.homepage = "https://github.com/paviliondev/omnievent"
|
16
|
+
spec.license = "MIT"
|
17
|
+
spec.required_ruby_version = ">= 2.6.0"
|
18
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
19
|
+
spec.metadata["source_code_uri"] = spec.homepage
|
20
|
+
spec.metadata["changelog_uri"] = spec.homepage
|
21
|
+
|
22
|
+
spec.files = Dir.chdir(__dir__) do
|
23
|
+
`git ls-files -z`.split("\x0").reject do |f|
|
24
|
+
(f == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
|
25
|
+
end
|
26
|
+
end
|
27
|
+
spec.bindir = "exe"
|
28
|
+
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
29
|
+
spec.require_paths = ["lib"]
|
30
|
+
|
31
|
+
spec.add_development_dependency "activesupport", "~> 7.0"
|
32
|
+
spec.add_development_dependency "byebug"
|
33
|
+
spec.add_development_dependency "rspec", "~> 3.4"
|
34
|
+
spec.add_dependency "hashie", ">= 3.4.6"
|
35
|
+
spec.add_dependency "iso-639", "~> 0.3.5"
|
36
|
+
spec.add_dependency "tzinfo", "~> 2.0"
|
37
|
+
end
|
data/sig/omnievent.rbs
ADDED
metadata
ADDED
@@ -0,0 +1,152 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: omnievent
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0.pre1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Angus McLeod
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2022-10-03 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: activesupport
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '7.0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '7.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: byebug
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.4'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.4'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: hashie
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 3.4.6
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 3.4.6
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: iso-639
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 0.3.5
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 0.3.5
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: tzinfo
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '2.0'
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '2.0'
|
97
|
+
description: |-
|
98
|
+
Manage events from any calendar, event discovery, event ticketing,
|
99
|
+
event management, social network or video conferencing provider.
|
100
|
+
email:
|
101
|
+
- development@pavilion.tech
|
102
|
+
executables: []
|
103
|
+
extensions: []
|
104
|
+
extra_rdoc_files: []
|
105
|
+
files:
|
106
|
+
- ".rspec"
|
107
|
+
- ".rubocop.yml"
|
108
|
+
- CHANGELOG.md
|
109
|
+
- CODE_OF_CONDUCT.md
|
110
|
+
- Gemfile
|
111
|
+
- Gemfile.lock
|
112
|
+
- LICENSE.txt
|
113
|
+
- README.md
|
114
|
+
- Rakefile
|
115
|
+
- lib/omnievent.rb
|
116
|
+
- lib/omnievent/builder.rb
|
117
|
+
- lib/omnievent/configuration.rb
|
118
|
+
- lib/omnievent/event_hash.rb
|
119
|
+
- lib/omnievent/key_store.rb
|
120
|
+
- lib/omnievent/strategies/developer.rb
|
121
|
+
- lib/omnievent/strategy.rb
|
122
|
+
- lib/omnievent/utils.rb
|
123
|
+
- lib/omnievent/version.rb
|
124
|
+
- omnievent.gemspec
|
125
|
+
- sig/omnievent.rbs
|
126
|
+
homepage: https://github.com/paviliondev/omnievent
|
127
|
+
licenses:
|
128
|
+
- MIT
|
129
|
+
metadata:
|
130
|
+
homepage_uri: https://github.com/paviliondev/omnievent
|
131
|
+
source_code_uri: https://github.com/paviliondev/omnievent
|
132
|
+
changelog_uri: https://github.com/paviliondev/omnievent
|
133
|
+
post_install_message:
|
134
|
+
rdoc_options: []
|
135
|
+
require_paths:
|
136
|
+
- lib
|
137
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
138
|
+
requirements:
|
139
|
+
- - ">="
|
140
|
+
- !ruby/object:Gem::Version
|
141
|
+
version: 2.6.0
|
142
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
143
|
+
requirements:
|
144
|
+
- - ">"
|
145
|
+
- !ruby/object:Gem::Version
|
146
|
+
version: 1.3.1
|
147
|
+
requirements: []
|
148
|
+
rubygems_version: 3.1.4
|
149
|
+
signing_key:
|
150
|
+
specification_version: 4
|
151
|
+
summary: Manage events from multiple providers.
|
152
|
+
test_files: []
|