omnievent 0.1.0.pre3 → 0.1.0.pre5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bb07327f2d1f44b38d3eb76509641665bae87ed481d152382482617013be525f
4
- data.tar.gz: 860d9fb49b3a7689cf29711cd4199e75ad8b197b05ae7bb348d5318ecacb806e
3
+ metadata.gz: 5fe7bcccfdc17aa7d63acd4c44143de5006e7cee9c142078656751bc3a5641fe
4
+ data.tar.gz: 7be7b177ae90c1eb8d3490e6563956c7d3f1ac702d59e108058c1eac70d4f696
5
5
  SHA512:
6
- metadata.gz: 78ca39a4647ebdda34b2cda063a5b3b92b34693221b8e159ba68fafbc3e02fa8e067754e4445b96d209e3ad37d0b227d2179088f68c42fa3ffdffe28a761c9cd
7
- data.tar.gz: 277bb9491cb240e4258d46bc11f4733077544ca356a1b14e6ec080fd98109b32c7f0411b4c38ada623ae0163996d39b825b07c8975fb58d0dba5fbb095c4bbf4
6
+ metadata.gz: ba6ca77f917e16246ec0bb3d80186b9ae3fb515b4b4bc1947688cd5f2cd51bbf06abe88adaa557448f00c89fd12467c5bebf9f04852f6d92cae6773a12060230
7
+ data.tar.gz: 43ebe3948021f40fa946c2bc5a7d200da65fd96754425bda2d378e6fa06dbdb94bfe1a051c53ed3605edfe9593b6a17ede5448065e61c696e5e1097a0d1f6150
data/.rubocop.yml CHANGED
@@ -1,6 +1,3 @@
1
- AllCops:
2
- TargetRubyVersion: 2.6
3
-
4
1
  Layout/LineLength:
5
2
  Max: 120
6
3
 
@@ -14,8 +11,10 @@ Metrics/BlockLength:
14
11
  - 'spec/**/*.rb'
15
12
 
16
13
  Metrics/MethodLength:
17
- CountComments: false
18
- Max: 25
14
+ Enabled: false
15
+
16
+ Metrics/BlockLength:
17
+ Enabled: false
19
18
 
20
19
  Metrics/ClassLength:
21
20
  Max: 150
@@ -46,3 +45,6 @@ Style/OptionalBooleanParameter:
46
45
 
47
46
  Style/MultilineBlockChain:
48
47
  Enabled: false
48
+
49
+ Style/Documentation:
50
+ Enabled: false
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- omnievent (0.1.0.pre3)
4
+ omnievent (0.1.0.pre5)
5
5
  hashie (>= 3.4.6)
6
6
  iso-639 (~> 0.3.5)
7
7
  tzinfo (~> 2.0)
@@ -21,7 +21,7 @@ GEM
21
21
  hashie (5.0.0)
22
22
  i18n (1.12.0)
23
23
  concurrent-ruby (~> 1.0)
24
- iso-639 (0.3.5)
24
+ iso-639 (0.3.6)
25
25
  json (2.6.2)
26
26
  minitest (5.16.3)
27
27
  parallel (1.22.1)
@@ -30,6 +30,18 @@ module OmniEvent
30
30
  raw_data["events"]
31
31
  end
32
32
 
33
+ def create_event
34
+ options.event
35
+ end
36
+
37
+ def update_event
38
+ options.event
39
+ end
40
+
41
+ def destroy_event
42
+ true
43
+ end
44
+
33
45
  def event_hash(raw_event)
34
46
  event = OmniEvent::EventHash.new(
35
47
  provider: name,
@@ -170,6 +170,18 @@ module OmniEvent
170
170
  end
171
171
  end
172
172
 
173
+ def create_event
174
+ raise NotImplementedError
175
+ end
176
+
177
+ def update_event
178
+ raise NotImplementedError
179
+ end
180
+
181
+ def destroy_event
182
+ raise NotImplementedError
183
+ end
184
+
173
185
  # Direct access to the OmniEvent logger, automatically prefixed
174
186
  # with this strategy's name.
175
187
  #
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module OmniEvent
4
- VERSION = "0.1.0.pre3"
4
+ VERSION = "0.1.0.pre5"
5
5
  end
data/lib/omnievent.rb CHANGED
@@ -62,6 +62,35 @@ module OmniEvent
62
62
  strategy_instance(provider).request(:list_events, opts)
63
63
  end
64
64
 
65
+ # Create event.
66
+ def create_event(provider = nil, opts = {})
67
+ raise ArgumentError, "You need to pass a provider name as the first argument." unless provider
68
+ raise ArgumentError, "You need to pass an :event in opts." unless opts_has_event?(opts)
69
+ raise ArgumentError, "Event is not valid." unless opts[:event].valid?
70
+
71
+ strategy_instance(provider).request(:create_event, opts)
72
+ end
73
+
74
+ # Update event.
75
+ def update_event(provider = nil, opts = {})
76
+ raise ArgumentError, "You need to pass a provider name as the first argument." unless provider
77
+ raise ArgumentError, "You need to pass an :event in opts." unless opts_has_event?(opts)
78
+
79
+ strategy_instance(provider).request(:update_event, opts)
80
+ end
81
+
82
+ # Destroy event.
83
+ def destroy_event(provider = nil, opts = {})
84
+ raise ArgumentError, "You need to pass a provider name as the first argument." unless provider
85
+ raise ArgumentError, "You need to pass an :event in opts." unless opts_has_event?(opts)
86
+
87
+ strategy_instance(provider).request(:destroy_event, opts)
88
+ end
89
+
90
+ def opts_has_event?(opts)
91
+ opts[:event]&.is_a?(OmniEvent::EventHash)
92
+ end
93
+
65
94
  def strategy_instance(provider)
66
95
  klass = provider_class(provider)
67
96
  raise MissingStrategy, "Could not find matching strategy for #{klass.inspect}." unless klass
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omnievent
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0.pre3
4
+ version: 0.1.0.pre5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Angus McLeod
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-10-21 00:00:00.000000000 Z
11
+ date: 2024-09-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -145,7 +145,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
145
145
  - !ruby/object:Gem::Version
146
146
  version: 1.3.1
147
147
  requirements: []
148
- rubygems_version: 3.1.6
148
+ rubygems_version: 3.3.26
149
149
  signing_key:
150
150
  specification_version: 4
151
151
  summary: Manage events from multiple providers.