wcc-media-client 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/wcc/media/client.rb +12 -1
- data/lib/wcc/media/engine.rb +15 -0
- data/lib/wcc/media/version.rb +1 -1
- data/wcc-media-client.gemspec +3 -2
- metadata +20 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 26adba91ed34291d31b66a829cf650252ca667d5
|
4
|
+
data.tar.gz: b58140833fe65dbe42ef94ad5e7fa025264c9f16
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 26bb6a9f269c700130cf35e10ba63bba84bcb9d57d3409f3de73b7c89e1de4d9926f783ecad9d27039f1c8b36bc7275f78732910363be8c0ff2ce52eb2f7a780
|
7
|
+
data.tar.gz: 1aafbcd559cd6432cb8f09236edd70eb14fb74bd86c6054ee5d9e40788947d2b4eee99808be3714cdb50c30eb81560533a016057598c28a5ca69ed5a3927a1f5
|
data/lib/wcc/media/client.rb
CHANGED
@@ -26,6 +26,10 @@ module WCC
|
|
26
26
|
target
|
27
27
|
].freeze
|
28
28
|
|
29
|
+
CONFIGURABLE_PARAMS = PARAMS - %w[
|
30
|
+
offset
|
31
|
+
]
|
32
|
+
|
29
33
|
RESOURCES = {
|
30
34
|
'messages' => WCC::Media::Message,
|
31
35
|
'series' => WCC::Media::Series,
|
@@ -68,12 +72,19 @@ module WCC
|
|
68
72
|
private
|
69
73
|
|
70
74
|
def extract_params(filters)
|
71
|
-
filters.each_with_object(
|
75
|
+
filters.each_with_object(default_params) do |(k, _v), h|
|
72
76
|
k_s = k.to_s
|
73
77
|
h[k_s] = filters.delete(k) if PARAMS.include?(k_s)
|
74
78
|
end
|
75
79
|
end
|
76
80
|
|
81
|
+
def default_params
|
82
|
+
options.each_with_object({}) do |(k, v), h|
|
83
|
+
k = k.to_s
|
84
|
+
h[k] = v if CONFIGURABLE_PARAMS.include?(k)
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
77
88
|
def apply_filters(filters, expected_filters)
|
78
89
|
defaults = default_filters(expected_filters) || {}
|
79
90
|
filters.each_with_object(defaults) do |(k, v), h|
|
data/lib/wcc/media/engine.rb
CHANGED
@@ -76,6 +76,21 @@ class WCC::Media::Engine < ::Rails::Engine
|
|
76
76
|
|
77
77
|
def perform
|
78
78
|
Toot::RegistersSubscriptions.call
|
79
|
+
rescue WCC::Data::Mapper::ServiceUnavailable => e
|
80
|
+
_handle_error(e)
|
81
|
+
rescue Faraday::ConnectionFailed => e
|
82
|
+
_handle_error(e)
|
83
|
+
rescue Toot::RegisterSubscriptionFailure => e
|
84
|
+
raise unless e.status == 503
|
85
|
+
|
86
|
+
_handle_error(e)
|
87
|
+
end
|
88
|
+
|
89
|
+
private
|
90
|
+
|
91
|
+
def _handle_error(err)
|
92
|
+
logger.error "Error registering subscriptions (Retrying in 5 minutes): #{err.class} #{err}"
|
93
|
+
retry_job wait: 5.minutes
|
79
94
|
end
|
80
95
|
end
|
81
96
|
end
|
data/lib/wcc/media/version.rb
CHANGED
data/wcc-media-client.gemspec
CHANGED
@@ -27,7 +27,7 @@ Gem::Specification.new do |spec|
|
|
27
27
|
spec.add_runtime_dependency 'wcc-api', '~> 0.3.1'
|
28
28
|
spec.add_runtime_dependency 'wcc-auth'
|
29
29
|
spec.add_runtime_dependency 'wcc-base', '~> 0.3.1'
|
30
|
-
spec.add_runtime_dependency 'wcc-data', '~> 0.3.
|
30
|
+
spec.add_runtime_dependency 'wcc-data', '~> 0.3.3'
|
31
31
|
|
32
32
|
spec.add_development_dependency 'byebug'
|
33
33
|
spec.add_development_dependency 'guard', '~> 2.15'
|
@@ -41,10 +41,11 @@ Gem::Specification.new do |spec|
|
|
41
41
|
spec.add_development_dependency 'rspec', '~> 3.0'
|
42
42
|
spec.add_development_dependency 'rspec-rails', '~> 3.7'
|
43
43
|
spec.add_development_dependency 'rspec_junit_formatter', '~> 0.3.0'
|
44
|
+
spec.add_development_dependency 'rubocop', '~> 0.60.0'
|
44
45
|
spec.add_development_dependency 'sidekiq', '< 6.0'
|
45
46
|
spec.add_development_dependency 'sprockets', '< 4.0'
|
46
47
|
spec.add_development_dependency 'sqlite3', '~> 1.3.6'
|
47
|
-
spec.add_development_dependency 'toot', '~> 0.
|
48
|
+
spec.add_development_dependency 'toot', '~> 0.4.1'
|
48
49
|
spec.add_development_dependency 'typhoeus', '~> 1.3'
|
49
50
|
spec.add_development_dependency 'webmock', '~> 3.0'
|
50
51
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wcc-media-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Watermark Dev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-10-
|
11
|
+
date: 2019-10-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: wcc-api
|
@@ -58,14 +58,14 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 0.3.
|
61
|
+
version: 0.3.3
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 0.3.
|
68
|
+
version: 0.3.3
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: byebug
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -240,6 +240,20 @@ dependencies:
|
|
240
240
|
- - "~>"
|
241
241
|
- !ruby/object:Gem::Version
|
242
242
|
version: 0.3.0
|
243
|
+
- !ruby/object:Gem::Dependency
|
244
|
+
name: rubocop
|
245
|
+
requirement: !ruby/object:Gem::Requirement
|
246
|
+
requirements:
|
247
|
+
- - "~>"
|
248
|
+
- !ruby/object:Gem::Version
|
249
|
+
version: 0.60.0
|
250
|
+
type: :development
|
251
|
+
prerelease: false
|
252
|
+
version_requirements: !ruby/object:Gem::Requirement
|
253
|
+
requirements:
|
254
|
+
- - "~>"
|
255
|
+
- !ruby/object:Gem::Version
|
256
|
+
version: 0.60.0
|
243
257
|
- !ruby/object:Gem::Dependency
|
244
258
|
name: sidekiq
|
245
259
|
requirement: !ruby/object:Gem::Requirement
|
@@ -288,14 +302,14 @@ dependencies:
|
|
288
302
|
requirements:
|
289
303
|
- - "~>"
|
290
304
|
- !ruby/object:Gem::Version
|
291
|
-
version: 0.
|
305
|
+
version: 0.4.1
|
292
306
|
type: :development
|
293
307
|
prerelease: false
|
294
308
|
version_requirements: !ruby/object:Gem::Requirement
|
295
309
|
requirements:
|
296
310
|
- - "~>"
|
297
311
|
- !ruby/object:Gem::Version
|
298
|
-
version: 0.
|
312
|
+
version: 0.4.1
|
299
313
|
- !ruby/object:Gem::Dependency
|
300
314
|
name: typhoeus
|
301
315
|
requirement: !ruby/object:Gem::Requirement
|