omnievent 0.1.0.pre2 → 0.1.0.pre4

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: fa8cce6c3cb47b7bfca7a47f52fa85716da5dad467f554cfc2a2b94f07ed7592
4
- data.tar.gz: 5b93e428b47df1cdd7c705339789cba4e9964a72b632bc91af06777fe7c90d89
3
+ metadata.gz: 38717b9e58eab673d2701d9bd2fb29a47b39820614cf9b46ab2dfde98a940d7f
4
+ data.tar.gz: 8f750f1bf92f031b333bb50a39e1dd8f355d641549ed271c9c0017689676c63c
5
5
  SHA512:
6
- metadata.gz: 3dd505bcd7de6aabb10d74413ba53e1a1db5a4598ae2d2bd9871763ac5961b5dffbacbdfc64ce8f3146f00ae846e919e1ea145555d0f91ae46d327a34794ea27
7
- data.tar.gz: 0aa3a3c99c131bf24230391aaa724e87bbe16b446851f81eb57c754fb718e0e816dd25a8646e0329d5f2637f7726ac1f0281876c1e359925c21d4e03ecd417e9
6
+ metadata.gz: 4e5224989a966288fb06247ca102f5a93491703df0180e69532f3baf228488e3cee2872b244248418108717430413745e1c083526cb344bf59cd6536eafab2cc
7
+ data.tar.gz: 5941e388487c35a43935675dc12a5a8af99756b86d98d053d3aed128b915d3032d12e2ced512889525c9a00fd0aa0326a294ee9e1c8810e389d1527b60a060d9
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/CHANGELOG.md CHANGED
@@ -7,3 +7,7 @@
7
7
  ## [0.1.0.pre2] - 2022-10-05
8
8
 
9
9
  - Update development strategy
10
+
11
+ ## [0.1.0.pre3] - 2022-10-21
12
+
13
+ - Add recurrence metadata
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- omnievent (0.1.0.pre2)
4
+ omnievent (0.1.0.pre3)
5
5
  hashie (>= 3.4.6)
6
6
  iso-639 (~> 0.3.5)
7
7
  tzinfo (~> 2.0)
@@ -75,4 +75,4 @@ DEPENDENCIES
75
75
  timecop (~> 0.9.5)
76
76
 
77
77
  BUNDLED WITH
78
- 2.3.14
78
+ 2.3.24
@@ -122,6 +122,9 @@ module OmniEvent
122
122
  language
123
123
  status
124
124
  taxonomies
125
+ sequence
126
+ series_id
127
+ occurrence_id
125
128
  ]
126
129
  end
127
130
 
@@ -134,7 +137,7 @@ module OmniEvent
134
137
  end
135
138
 
136
139
  def uid_valid?
137
- OmniEvent::Utils.valid_uid?(uid)
140
+ OmniEvent::Utils.valid_type?(uid, :string)
138
141
  end
139
142
 
140
143
  def created_at_valid?
@@ -156,6 +159,18 @@ module OmniEvent
156
159
  def taxonomies_valid?
157
160
  OmniEvent::Utils.all_valid_type?(taxonomies, :string)
158
161
  end
162
+
163
+ def sequence_valid?
164
+ OmniEvent::Utils.valid_type?(sequence, :string)
165
+ end
166
+
167
+ def series_id_valid?
168
+ OmniEvent::Utils.valid_type?(series_id, :string)
169
+ end
170
+
171
+ def occurrence_id_valid?
172
+ OmniEvent::Utils.valid_type?(occurrence_id, :string)
173
+ end
159
174
  end
160
175
 
161
176
  # The event's associated data.
@@ -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
  #
@@ -70,10 +70,6 @@ module OmniEvent
70
70
  end
71
71
  end
72
72
 
73
- def valid_uid?(value)
74
- value.is_a?(String)
75
- end
76
-
77
73
  def all_valid_type?(array, type)
78
74
  valid_type?(array, :array) && array.all? { |t| valid_type?(t, type) }
79
75
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module OmniEvent
4
- VERSION = "0.1.0.pre2"
4
+ VERSION = "0.1.0.pre4"
5
5
  end
data/lib/omnievent.rb CHANGED
@@ -57,11 +57,46 @@ module OmniEvent
57
57
 
58
58
  # List events.
59
59
  def list_events(provider = nil, opts = {})
60
- raise ArgumentError, "You need to pass a provider name as the first argument." unless provider
60
+ validate_provider_arg(provider)
61
61
 
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
+ validate_event_args(provider, opts)
68
+
69
+ strategy_instance(provider).request(:create_event, opts)
70
+ end
71
+
72
+ # Update event.
73
+ def update_event(provider = nil, opts = {})
74
+ validate_event_args(provider, opts)
75
+
76
+ strategy_instance(provider).request(:update_event, opts)
77
+ end
78
+
79
+ # Destroy event.
80
+ def destroy_event(provider = nil, opts = {})
81
+ validate_event_args(provider, opts)
82
+
83
+ strategy_instance(provider).request(:destroy_event, opts)
84
+ end
85
+
86
+ def validate_provider_arg(provider)
87
+ raise ArgumentError, "You need to pass a provider name as the first argument." unless provider
88
+ end
89
+
90
+ def validate_event_args(provider, opts)
91
+ validate_provider_arg(provider)
92
+
93
+ raise ArgumentError, "You need to pass a valid as :event in opts." unless opts_have_valid_event?(opts)
94
+ end
95
+
96
+ def opts_have_valid_event?(opts)
97
+ opts[:event].present? && opts[:event].is_a?(OmniEvent::EventHash) && opts[:event].valid?
98
+ end
99
+
65
100
  def strategy_instance(provider)
66
101
  klass = provider_class(provider)
67
102
  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.pre2
4
+ version: 0.1.0.pre4
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-05 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.4
148
+ rubygems_version: 3.3.26
149
149
  signing_key:
150
150
  specification_version: 4
151
151
  summary: Manage events from multiple providers.