wcc-media-client 0.4.13 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.rubocop.yml +34 -2
- data/Gemfile +25 -0
- data/lib/wcc/media/active_record_shim.rb +10 -4
- data/lib/wcc/media/base.rb +3 -1
- data/lib/wcc/media/cacheable.rb +4 -2
- data/lib/wcc/media/client/response.rb +3 -1
- data/lib/wcc/media/client.rb +7 -6
- data/lib/wcc/media/message.rb +12 -3
- data/lib/wcc/media/playlist.rb +3 -1
- data/lib/wcc/media/rails.rb +0 -1
- data/lib/wcc/media/series.rb +2 -0
- data/lib/wcc/media/speaker.rb +3 -1
- data/lib/wcc/media/tag.rb +3 -1
- data/lib/wcc/media/tag_group.rb +7 -5
- data/lib/wcc/media/version.rb +3 -1
- data/wcc-media-client.gemspec +1 -22
- metadata +8 -297
- data/config/routes.rb +0 -6
- data/lib/wcc/media/engine.rb +0 -104
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 46a2dbaa7272ac0536ff246070064408e8497f48d6f6059a2f9f13e5d4d8f844
|
4
|
+
data.tar.gz: 3fb5f421fe0a334ea65f78a4264bfb778f02291ced6b593fb3b4cd14511fd058
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a92537cee37ad01a6135fc7dcb706dd29d384d54b91484e1d36d62ad875abfd1fef62b0fddc0063c1a2adb885be8f4dd66330dd87a82463d99e0c9e5ed4418db
|
7
|
+
data.tar.gz: 50ad7694bdf5feb85d2915aa553f9358aaf5c408d7a2369d7884bf040197a954529b2d10f75439b867d0df2ff69325ed5d0007dd92627ebad8e855e1552aad8d
|
data/.rubocop.yml
CHANGED
@@ -1,4 +1,21 @@
|
|
1
|
-
|
1
|
+
require:
|
2
|
+
- rubocop-rspec
|
3
|
+
|
4
|
+
AllCops:
|
5
|
+
TargetRubyVersion: 2.3
|
6
|
+
# RuboCop has a bunch of cops enabled by default. This setting tells RuboCop
|
7
|
+
# to ignore them, so only the ones explicitly set in this file are enabled.
|
8
|
+
DisabledByDefault: false
|
9
|
+
NewCops: enable
|
10
|
+
Exclude:
|
11
|
+
- '**/templates/**/*'
|
12
|
+
- '**/vendor/**/*'
|
13
|
+
- 'spec/dummy/**/*'
|
14
|
+
Include:
|
15
|
+
- 'lib/**/*'
|
16
|
+
- 'Gemfile'
|
17
|
+
- 'wcc-scripture.gemspec'
|
18
|
+
- 'spec/**/*_spec.rb'
|
2
19
|
|
3
20
|
Metrics/BlockLength:
|
4
21
|
Exclude:
|
@@ -7,9 +24,24 @@ Metrics/BlockLength:
|
|
7
24
|
Style/ClassAndModuleChildren:
|
8
25
|
Enabled: false
|
9
26
|
|
27
|
+
Style/Documentation:
|
28
|
+
Enabled: false
|
29
|
+
|
10
30
|
Style/MultilineBlockChain:
|
11
31
|
Exclude:
|
12
32
|
- 'spec/**/*'
|
13
33
|
|
14
|
-
|
34
|
+
Style/OpenStructUse:
|
35
|
+
Enabled: false
|
36
|
+
|
37
|
+
RSpec/DescribedClass:
|
38
|
+
Enabled: false
|
39
|
+
|
40
|
+
RSpec/ExampleLength:
|
41
|
+
Enabled: false
|
42
|
+
|
43
|
+
RSpec/MultipleExpectations:
|
44
|
+
Enabled: false
|
45
|
+
|
46
|
+
RSpec/NamedSubject:
|
15
47
|
Enabled: false
|
data/Gemfile
CHANGED
@@ -4,3 +4,28 @@ source 'https://rubygems.org'
|
|
4
4
|
|
5
5
|
# Specify your gem's dependencies in wcc-media-client.gemspec
|
6
6
|
gemspec
|
7
|
+
|
8
|
+
group :development, :test do
|
9
|
+
gem 'guard', '~> 2.15'
|
10
|
+
gem 'guard-rspec', '~> 4.7'
|
11
|
+
gem 'guard-rubocop', '~> 1.3'
|
12
|
+
gem 'http', '> 1.0', '< 3.0'
|
13
|
+
gem 'httplog', '~> 1.0'
|
14
|
+
gem 'nio4r', '2.5.2'
|
15
|
+
gem 'parallel', '~> 1.19.0'
|
16
|
+
gem 'rails', '~> 5.0'
|
17
|
+
gem 'rake', '~> 12.3'
|
18
|
+
gem 'responders', '< 3.0'
|
19
|
+
gem 'rspec', '~> 3.0'
|
20
|
+
gem 'rspec_junit_formatter', '~> 0.3.0'
|
21
|
+
gem 'rspec-rails', '~> 3.7'
|
22
|
+
gem 'rubocop', '~> 1.31.0'
|
23
|
+
gem 'rubocop-rspec', '~> 2.12'
|
24
|
+
gem 'sidekiq', '< 6.0'
|
25
|
+
gem 'simplecov', '~> 0.21.2', require: false
|
26
|
+
gem 'simplecov-cobertura', '~> 1.4'
|
27
|
+
gem 'sprockets', '< 4.0'
|
28
|
+
gem 'sqlite3', '~> 1.3.6'
|
29
|
+
gem 'typhoeus', '~> 1.3'
|
30
|
+
gem 'webmock', '~> 3.0'
|
31
|
+
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module WCC::Media::ActiveRecordShim
|
2
4
|
def self.included(base)
|
3
5
|
base.public_send :include, InstanceMethods
|
@@ -37,7 +39,7 @@ module WCC::Media::ActiveRecordShim
|
|
37
39
|
end
|
38
40
|
|
39
41
|
def find_by(**filters)
|
40
|
-
raise ArgumentError,
|
42
|
+
raise ArgumentError, 'You must provide at least one filter' if filters.empty?
|
41
43
|
|
42
44
|
find_all(filters).first
|
43
45
|
end
|
@@ -84,8 +86,12 @@ module WCC::Media::ActiveRecordShim
|
|
84
86
|
end
|
85
87
|
end
|
86
88
|
|
87
|
-
[
|
88
|
-
class_eval
|
89
|
+
%i[filters endpoint key].each do |att|
|
90
|
+
class_eval <<-CODE, __FILE__, __LINE__ + 1
|
91
|
+
def #{att}(value); # def filters(value)
|
92
|
+
@#{att} = value; # @filters = value
|
93
|
+
end # end
|
94
|
+
CODE
|
89
95
|
end
|
90
96
|
end
|
91
|
-
end
|
97
|
+
end
|
data/lib/wcc/media/base.rb
CHANGED
data/lib/wcc/media/cacheable.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module WCC
|
2
4
|
module Media
|
3
5
|
module Cacheable
|
@@ -17,11 +19,11 @@ module WCC
|
|
17
19
|
(headers&.fetch('Last-Modified', nil) if respond_to?(:headers))
|
18
20
|
@last_modified = Time.parse(last_modified) if last_modified && /\S/.match(last_modified)
|
19
21
|
end
|
20
|
-
|
22
|
+
alias updated_at last_modified
|
21
23
|
|
22
24
|
def self.hash_cache_key(hash)
|
23
25
|
Digest::SHA1.hexdigest(Marshal.dump(hash))
|
24
26
|
end
|
25
27
|
end
|
26
28
|
end
|
27
|
-
end
|
29
|
+
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module WCC
|
2
4
|
module Media
|
3
5
|
class Client < ::WCC::API::RestClient
|
@@ -20,7 +22,7 @@ module WCC
|
|
20
22
|
|
21
23
|
def next_page_query
|
22
24
|
{
|
23
|
-
offset: page_items.length + skip
|
25
|
+
offset: page_items.length + skip
|
24
26
|
}
|
25
27
|
end
|
26
28
|
end
|
data/lib/wcc/media/client.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'wcc/api/rest_client'
|
2
4
|
require_relative 'message'
|
3
5
|
require_relative 'series'
|
@@ -12,6 +14,7 @@ module WCC
|
|
12
14
|
class Client < ::WCC::API::RestClient
|
13
15
|
class << self
|
14
16
|
attr_writer :default
|
17
|
+
|
15
18
|
# The default client. Set this in an initializer to change the client used
|
16
19
|
# by all the WCC::Media models
|
17
20
|
def default
|
@@ -39,9 +42,7 @@ module WCC
|
|
39
42
|
'playlists' => WCC::Media::Playlist,
|
40
43
|
'streams' => WCC::Media::LiveStream
|
41
44
|
}.freeze
|
42
|
-
attr_reader(*RESOURCES.keys)
|
43
|
-
|
44
|
-
attr_reader :options
|
45
|
+
attr_reader(*RESOURCES.keys, :options)
|
45
46
|
|
46
47
|
def initialize(**options)
|
47
48
|
options = {
|
@@ -58,12 +59,12 @@ module WCC
|
|
58
59
|
|
59
60
|
Resource =
|
60
61
|
Struct.new(:client, :model, :options) do
|
61
|
-
def find(id, **params)
|
62
|
+
def find(id, **params) # rubocop:disable Metrics/AbcSize
|
62
63
|
raise ArgumentError, "id param must be present, got: #{id}" unless id && /\S/.match(id.to_s)
|
63
64
|
|
64
65
|
resp = client.get(
|
65
66
|
"#{model.endpoint}/#{id}",
|
66
|
-
default_params('target').merge(params)
|
67
|
+
default_params('target').merge(params)
|
67
68
|
)
|
68
69
|
resp.assert_ok!
|
69
70
|
model.new(resp.body[model.key], resp.headers.freeze)
|
@@ -71,7 +72,7 @@ module WCC
|
|
71
72
|
|
72
73
|
def list(**filters)
|
73
74
|
query = extract_params(filters)
|
74
|
-
query
|
75
|
+
query.merge!(apply_filters(filters, model.filters))
|
75
76
|
resp = client.get(model.endpoint, query)
|
76
77
|
resp.assert_ok!
|
77
78
|
resp.items.map { |s| model.new(s) }
|
data/lib/wcc/media/message.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require_relative 'base'
|
2
4
|
require_relative 'tag_group'
|
3
5
|
|
@@ -14,6 +16,7 @@ class WCC::Media::Message < WCC::Media::Base
|
|
14
16
|
series_id
|
15
17
|
title_like
|
16
18
|
legacy_id
|
19
|
+
hide_from_internal_search
|
17
20
|
].freeze
|
18
21
|
end
|
19
22
|
|
@@ -28,12 +31,17 @@ class WCC::Media::Message < WCC::Media::Base
|
|
28
31
|
campus_names
|
29
32
|
topic
|
30
33
|
topics
|
34
|
+
hide_from_internal_search
|
31
35
|
].each do |att|
|
32
36
|
define_method att do
|
33
37
|
raw[att]
|
34
38
|
end
|
35
39
|
end
|
36
40
|
|
41
|
+
def hide_from_internal_search
|
42
|
+
raw['flags']['hide_from_internal_search'] || false
|
43
|
+
end
|
44
|
+
|
37
45
|
def speakers
|
38
46
|
(raw['speakers'] || []).map { |val| WCC::Media::Speaker.new(val) }
|
39
47
|
end
|
@@ -62,6 +70,7 @@ class WCC::Media::Message < WCC::Media::Base
|
|
62
70
|
%w[
|
63
71
|
meta
|
64
72
|
embeds
|
73
|
+
flags
|
65
74
|
assets
|
66
75
|
images
|
67
76
|
external_urls
|
@@ -78,12 +87,12 @@ class WCC::Media::Message < WCC::Media::Base
|
|
78
87
|
|
79
88
|
def has_video? # rubocop:disable Naming/PredicateName
|
80
89
|
assets.each_pair
|
81
|
-
|
90
|
+
.any? { |k, v| /video/.match(k) && v && !v.empty? }
|
82
91
|
end
|
83
92
|
|
84
93
|
def has_audio? # rubocop:disable Naming/PredicateName
|
85
94
|
assets.each_pair
|
86
|
-
|
95
|
+
.any? { |k, v| /^audio/.match(k) && v && !v.empty? }
|
87
96
|
end
|
88
97
|
|
89
98
|
def to_param
|
@@ -100,6 +109,6 @@ class WCC::Media::Message < WCC::Media::Base
|
|
100
109
|
end
|
101
110
|
end
|
102
111
|
# pluralize "campus" specifically
|
103
|
-
|
112
|
+
alias campuses campus
|
104
113
|
remove_method :campus
|
105
114
|
end
|
data/lib/wcc/media/playlist.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require_relative 'base'
|
2
4
|
require_relative 'message'
|
3
5
|
|
@@ -24,4 +26,4 @@ class WCC::Media::Playlist < WCC::Media::Base
|
|
24
26
|
def messages
|
25
27
|
(raw['messages'] || []).map { |val| WCC::Media::Message.new(val) }
|
26
28
|
end
|
27
|
-
end
|
29
|
+
end
|
data/lib/wcc/media/rails.rb
CHANGED
data/lib/wcc/media/series.rb
CHANGED
data/lib/wcc/media/speaker.rb
CHANGED
data/lib/wcc/media/tag.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require_relative 'base'
|
2
4
|
require_relative 'tag_group'
|
3
5
|
|
@@ -19,7 +21,7 @@ class WCC::Media::Tag < WCC::Media::Base
|
|
19
21
|
end
|
20
22
|
|
21
23
|
def tag_group
|
22
|
-
return unless key = raw.dig('tag_group', 'key')
|
24
|
+
return unless (key = raw.dig('tag_group', 'key'))
|
23
25
|
|
24
26
|
WCC::Media::TagGroup[key.to_sym]
|
25
27
|
end
|
data/lib/wcc/media/tag_group.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
gem 'wcc-data'
|
2
4
|
require 'wcc/data/enumerated_type'
|
3
5
|
|
@@ -18,8 +20,8 @@ class WCC::Media::TagGroup < WCC::Data::EnumeratedType
|
|
18
20
|
end
|
19
21
|
|
20
22
|
TAG_GROUPS = [
|
21
|
-
{ id: 1, name:
|
22
|
-
{ id: 2, name:
|
23
|
-
{ id: 3, name:
|
24
|
-
{ id: 4, name:
|
25
|
-
]
|
23
|
+
{ id: 1, name: 'Channels', key: :channels },
|
24
|
+
{ id: 2, name: 'Ministries', key: :ministries },
|
25
|
+
{ id: 3, name: 'Meta', key: :meta },
|
26
|
+
{ id: 4, name: 'Campus', key: :campus }
|
27
|
+
].freeze
|
data/lib/wcc/media/version.rb
CHANGED
data/wcc-media-client.gemspec
CHANGED
@@ -24,29 +24,8 @@ Gem::Specification.new do |spec|
|
|
24
24
|
|
25
25
|
spec.require_paths = ['lib']
|
26
26
|
|
27
|
-
spec.add_runtime_dependency 'wcc-api', '
|
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
30
|
spec.add_runtime_dependency 'wcc-data', '~> 0.3.3'
|
31
|
-
|
32
|
-
spec.add_development_dependency 'byebug', '~> 11.0.1'
|
33
|
-
spec.add_development_dependency 'guard', '~> 2.15'
|
34
|
-
spec.add_development_dependency 'guard-rspec', '~> 4.7'
|
35
|
-
spec.add_development_dependency 'guard-rubocop', '~> 1.3'
|
36
|
-
spec.add_development_dependency 'http', '> 1.0', '< 3.0'
|
37
|
-
spec.add_development_dependency 'httplog', '~> 1.0'
|
38
|
-
spec.add_development_dependency 'nio4r', '2.5.2'
|
39
|
-
spec.add_development_dependency 'rails', '~> 5.0'
|
40
|
-
spec.add_development_dependency 'rake', '~> 12.3'
|
41
|
-
spec.add_development_dependency 'responders', '< 3.0'
|
42
|
-
spec.add_development_dependency 'rspec', '~> 3.0'
|
43
|
-
spec.add_development_dependency 'rspec-rails', '~> 3.7'
|
44
|
-
spec.add_development_dependency 'rspec_junit_formatter', '~> 0.3.0'
|
45
|
-
spec.add_development_dependency 'rubocop', '~> 0.60.0'
|
46
|
-
spec.add_development_dependency 'sidekiq', '< 6.0'
|
47
|
-
spec.add_development_dependency 'sprockets', '< 4.0'
|
48
|
-
spec.add_development_dependency 'sqlite3', '~> 1.3.6'
|
49
|
-
spec.add_development_dependency 'toot', '~> 0.4.1'
|
50
|
-
spec.add_development_dependency 'typhoeus', '~> 1.3'
|
51
|
-
spec.add_development_dependency 'webmock', '~> 3.0'
|
52
31
|
end
|
metadata
CHANGED
@@ -1,27 +1,27 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wcc-media-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Watermark Dev
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-08-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: wcc-api
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: 0.3.1
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 0.3.1
|
27
27
|
- !ruby/object:Gem::Dependency
|
@@ -66,292 +66,6 @@ dependencies:
|
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: 0.3.3
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: byebug
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - "~>"
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: 11.0.1
|
76
|
-
type: :development
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - "~>"
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: 11.0.1
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: guard
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - "~>"
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: '2.15'
|
90
|
-
type: :development
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - "~>"
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: '2.15'
|
97
|
-
- !ruby/object:Gem::Dependency
|
98
|
-
name: guard-rspec
|
99
|
-
requirement: !ruby/object:Gem::Requirement
|
100
|
-
requirements:
|
101
|
-
- - "~>"
|
102
|
-
- !ruby/object:Gem::Version
|
103
|
-
version: '4.7'
|
104
|
-
type: :development
|
105
|
-
prerelease: false
|
106
|
-
version_requirements: !ruby/object:Gem::Requirement
|
107
|
-
requirements:
|
108
|
-
- - "~>"
|
109
|
-
- !ruby/object:Gem::Version
|
110
|
-
version: '4.7'
|
111
|
-
- !ruby/object:Gem::Dependency
|
112
|
-
name: guard-rubocop
|
113
|
-
requirement: !ruby/object:Gem::Requirement
|
114
|
-
requirements:
|
115
|
-
- - "~>"
|
116
|
-
- !ruby/object:Gem::Version
|
117
|
-
version: '1.3'
|
118
|
-
type: :development
|
119
|
-
prerelease: false
|
120
|
-
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
requirements:
|
122
|
-
- - "~>"
|
123
|
-
- !ruby/object:Gem::Version
|
124
|
-
version: '1.3'
|
125
|
-
- !ruby/object:Gem::Dependency
|
126
|
-
name: http
|
127
|
-
requirement: !ruby/object:Gem::Requirement
|
128
|
-
requirements:
|
129
|
-
- - ">"
|
130
|
-
- !ruby/object:Gem::Version
|
131
|
-
version: '1.0'
|
132
|
-
- - "<"
|
133
|
-
- !ruby/object:Gem::Version
|
134
|
-
version: '3.0'
|
135
|
-
type: :development
|
136
|
-
prerelease: false
|
137
|
-
version_requirements: !ruby/object:Gem::Requirement
|
138
|
-
requirements:
|
139
|
-
- - ">"
|
140
|
-
- !ruby/object:Gem::Version
|
141
|
-
version: '1.0'
|
142
|
-
- - "<"
|
143
|
-
- !ruby/object:Gem::Version
|
144
|
-
version: '3.0'
|
145
|
-
- !ruby/object:Gem::Dependency
|
146
|
-
name: httplog
|
147
|
-
requirement: !ruby/object:Gem::Requirement
|
148
|
-
requirements:
|
149
|
-
- - "~>"
|
150
|
-
- !ruby/object:Gem::Version
|
151
|
-
version: '1.0'
|
152
|
-
type: :development
|
153
|
-
prerelease: false
|
154
|
-
version_requirements: !ruby/object:Gem::Requirement
|
155
|
-
requirements:
|
156
|
-
- - "~>"
|
157
|
-
- !ruby/object:Gem::Version
|
158
|
-
version: '1.0'
|
159
|
-
- !ruby/object:Gem::Dependency
|
160
|
-
name: nio4r
|
161
|
-
requirement: !ruby/object:Gem::Requirement
|
162
|
-
requirements:
|
163
|
-
- - '='
|
164
|
-
- !ruby/object:Gem::Version
|
165
|
-
version: 2.5.2
|
166
|
-
type: :development
|
167
|
-
prerelease: false
|
168
|
-
version_requirements: !ruby/object:Gem::Requirement
|
169
|
-
requirements:
|
170
|
-
- - '='
|
171
|
-
- !ruby/object:Gem::Version
|
172
|
-
version: 2.5.2
|
173
|
-
- !ruby/object:Gem::Dependency
|
174
|
-
name: rails
|
175
|
-
requirement: !ruby/object:Gem::Requirement
|
176
|
-
requirements:
|
177
|
-
- - "~>"
|
178
|
-
- !ruby/object:Gem::Version
|
179
|
-
version: '5.0'
|
180
|
-
type: :development
|
181
|
-
prerelease: false
|
182
|
-
version_requirements: !ruby/object:Gem::Requirement
|
183
|
-
requirements:
|
184
|
-
- - "~>"
|
185
|
-
- !ruby/object:Gem::Version
|
186
|
-
version: '5.0'
|
187
|
-
- !ruby/object:Gem::Dependency
|
188
|
-
name: rake
|
189
|
-
requirement: !ruby/object:Gem::Requirement
|
190
|
-
requirements:
|
191
|
-
- - "~>"
|
192
|
-
- !ruby/object:Gem::Version
|
193
|
-
version: '12.3'
|
194
|
-
type: :development
|
195
|
-
prerelease: false
|
196
|
-
version_requirements: !ruby/object:Gem::Requirement
|
197
|
-
requirements:
|
198
|
-
- - "~>"
|
199
|
-
- !ruby/object:Gem::Version
|
200
|
-
version: '12.3'
|
201
|
-
- !ruby/object:Gem::Dependency
|
202
|
-
name: responders
|
203
|
-
requirement: !ruby/object:Gem::Requirement
|
204
|
-
requirements:
|
205
|
-
- - "<"
|
206
|
-
- !ruby/object:Gem::Version
|
207
|
-
version: '3.0'
|
208
|
-
type: :development
|
209
|
-
prerelease: false
|
210
|
-
version_requirements: !ruby/object:Gem::Requirement
|
211
|
-
requirements:
|
212
|
-
- - "<"
|
213
|
-
- !ruby/object:Gem::Version
|
214
|
-
version: '3.0'
|
215
|
-
- !ruby/object:Gem::Dependency
|
216
|
-
name: rspec
|
217
|
-
requirement: !ruby/object:Gem::Requirement
|
218
|
-
requirements:
|
219
|
-
- - "~>"
|
220
|
-
- !ruby/object:Gem::Version
|
221
|
-
version: '3.0'
|
222
|
-
type: :development
|
223
|
-
prerelease: false
|
224
|
-
version_requirements: !ruby/object:Gem::Requirement
|
225
|
-
requirements:
|
226
|
-
- - "~>"
|
227
|
-
- !ruby/object:Gem::Version
|
228
|
-
version: '3.0'
|
229
|
-
- !ruby/object:Gem::Dependency
|
230
|
-
name: rspec-rails
|
231
|
-
requirement: !ruby/object:Gem::Requirement
|
232
|
-
requirements:
|
233
|
-
- - "~>"
|
234
|
-
- !ruby/object:Gem::Version
|
235
|
-
version: '3.7'
|
236
|
-
type: :development
|
237
|
-
prerelease: false
|
238
|
-
version_requirements: !ruby/object:Gem::Requirement
|
239
|
-
requirements:
|
240
|
-
- - "~>"
|
241
|
-
- !ruby/object:Gem::Version
|
242
|
-
version: '3.7'
|
243
|
-
- !ruby/object:Gem::Dependency
|
244
|
-
name: rspec_junit_formatter
|
245
|
-
requirement: !ruby/object:Gem::Requirement
|
246
|
-
requirements:
|
247
|
-
- - "~>"
|
248
|
-
- !ruby/object:Gem::Version
|
249
|
-
version: 0.3.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.3.0
|
257
|
-
- !ruby/object:Gem::Dependency
|
258
|
-
name: rubocop
|
259
|
-
requirement: !ruby/object:Gem::Requirement
|
260
|
-
requirements:
|
261
|
-
- - "~>"
|
262
|
-
- !ruby/object:Gem::Version
|
263
|
-
version: 0.60.0
|
264
|
-
type: :development
|
265
|
-
prerelease: false
|
266
|
-
version_requirements: !ruby/object:Gem::Requirement
|
267
|
-
requirements:
|
268
|
-
- - "~>"
|
269
|
-
- !ruby/object:Gem::Version
|
270
|
-
version: 0.60.0
|
271
|
-
- !ruby/object:Gem::Dependency
|
272
|
-
name: sidekiq
|
273
|
-
requirement: !ruby/object:Gem::Requirement
|
274
|
-
requirements:
|
275
|
-
- - "<"
|
276
|
-
- !ruby/object:Gem::Version
|
277
|
-
version: '6.0'
|
278
|
-
type: :development
|
279
|
-
prerelease: false
|
280
|
-
version_requirements: !ruby/object:Gem::Requirement
|
281
|
-
requirements:
|
282
|
-
- - "<"
|
283
|
-
- !ruby/object:Gem::Version
|
284
|
-
version: '6.0'
|
285
|
-
- !ruby/object:Gem::Dependency
|
286
|
-
name: sprockets
|
287
|
-
requirement: !ruby/object:Gem::Requirement
|
288
|
-
requirements:
|
289
|
-
- - "<"
|
290
|
-
- !ruby/object:Gem::Version
|
291
|
-
version: '4.0'
|
292
|
-
type: :development
|
293
|
-
prerelease: false
|
294
|
-
version_requirements: !ruby/object:Gem::Requirement
|
295
|
-
requirements:
|
296
|
-
- - "<"
|
297
|
-
- !ruby/object:Gem::Version
|
298
|
-
version: '4.0'
|
299
|
-
- !ruby/object:Gem::Dependency
|
300
|
-
name: sqlite3
|
301
|
-
requirement: !ruby/object:Gem::Requirement
|
302
|
-
requirements:
|
303
|
-
- - "~>"
|
304
|
-
- !ruby/object:Gem::Version
|
305
|
-
version: 1.3.6
|
306
|
-
type: :development
|
307
|
-
prerelease: false
|
308
|
-
version_requirements: !ruby/object:Gem::Requirement
|
309
|
-
requirements:
|
310
|
-
- - "~>"
|
311
|
-
- !ruby/object:Gem::Version
|
312
|
-
version: 1.3.6
|
313
|
-
- !ruby/object:Gem::Dependency
|
314
|
-
name: toot
|
315
|
-
requirement: !ruby/object:Gem::Requirement
|
316
|
-
requirements:
|
317
|
-
- - "~>"
|
318
|
-
- !ruby/object:Gem::Version
|
319
|
-
version: 0.4.1
|
320
|
-
type: :development
|
321
|
-
prerelease: false
|
322
|
-
version_requirements: !ruby/object:Gem::Requirement
|
323
|
-
requirements:
|
324
|
-
- - "~>"
|
325
|
-
- !ruby/object:Gem::Version
|
326
|
-
version: 0.4.1
|
327
|
-
- !ruby/object:Gem::Dependency
|
328
|
-
name: typhoeus
|
329
|
-
requirement: !ruby/object:Gem::Requirement
|
330
|
-
requirements:
|
331
|
-
- - "~>"
|
332
|
-
- !ruby/object:Gem::Version
|
333
|
-
version: '1.3'
|
334
|
-
type: :development
|
335
|
-
prerelease: false
|
336
|
-
version_requirements: !ruby/object:Gem::Requirement
|
337
|
-
requirements:
|
338
|
-
- - "~>"
|
339
|
-
- !ruby/object:Gem::Version
|
340
|
-
version: '1.3'
|
341
|
-
- !ruby/object:Gem::Dependency
|
342
|
-
name: webmock
|
343
|
-
requirement: !ruby/object:Gem::Requirement
|
344
|
-
requirements:
|
345
|
-
- - "~>"
|
346
|
-
- !ruby/object:Gem::Version
|
347
|
-
version: '3.0'
|
348
|
-
type: :development
|
349
|
-
prerelease: false
|
350
|
-
version_requirements: !ruby/object:Gem::Requirement
|
351
|
-
requirements:
|
352
|
-
- - "~>"
|
353
|
-
- !ruby/object:Gem::Version
|
354
|
-
version: '3.0'
|
355
69
|
description: REST Client for accessing the WCC Media library
|
356
70
|
email:
|
357
71
|
- dev@watermark.org
|
@@ -364,13 +78,11 @@ files:
|
|
364
78
|
- Gemfile
|
365
79
|
- Guardfile
|
366
80
|
- README.md
|
367
|
-
- config/routes.rb
|
368
81
|
- lib/wcc/media/active_record_shim.rb
|
369
82
|
- lib/wcc/media/base.rb
|
370
83
|
- lib/wcc/media/cacheable.rb
|
371
84
|
- lib/wcc/media/client.rb
|
372
85
|
- lib/wcc/media/client/response.rb
|
373
|
-
- lib/wcc/media/engine.rb
|
374
86
|
- lib/wcc/media/live_stream.rb
|
375
87
|
- lib/wcc/media/message.rb
|
376
88
|
- lib/wcc/media/playlist.rb
|
@@ -386,7 +98,7 @@ homepage: https://github.com/watermarkchurch/media/wcc-media-client
|
|
386
98
|
licenses:
|
387
99
|
- MIT
|
388
100
|
metadata: {}
|
389
|
-
post_install_message:
|
101
|
+
post_install_message:
|
390
102
|
rdoc_options: []
|
391
103
|
require_paths:
|
392
104
|
- lib
|
@@ -401,9 +113,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
401
113
|
- !ruby/object:Gem::Version
|
402
114
|
version: '0'
|
403
115
|
requirements: []
|
404
|
-
|
405
|
-
|
406
|
-
signing_key:
|
116
|
+
rubygems_version: 3.1.6
|
117
|
+
signing_key:
|
407
118
|
specification_version: 4
|
408
119
|
summary: ''
|
409
120
|
test_files: []
|
data/config/routes.rb
DELETED
data/lib/wcc/media/engine.rb
DELETED
@@ -1,104 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'active_job'
|
4
|
-
require 'toot'
|
5
|
-
require 'wcc/auth'
|
6
|
-
require 'wcc/data'
|
7
|
-
|
8
|
-
class WCC::Media::Engine < ::Rails::Engine
|
9
|
-
isolate_namespace WCC::Media
|
10
|
-
|
11
|
-
class << self
|
12
|
-
def subscribe(channel, handler = nil, &block)
|
13
|
-
handler ||= Proc.new(&block)
|
14
|
-
with_toot_config do |c|
|
15
|
-
c.subscribe :media, channel, handler
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
def initialized
|
20
|
-
# Don't register subscriptions unless
|
21
|
-
# 1. we mounted the engine and
|
22
|
-
# 2. something subscribed.
|
23
|
-
::Toot.config.callback_url &&
|
24
|
-
::Toot.config.subscriptions.any? { |s| s.source.name == :media }
|
25
|
-
end
|
26
|
-
|
27
|
-
def register_subscriptions
|
28
|
-
return unless initialized
|
29
|
-
|
30
|
-
raise StandardError, "WCC::Auth must be configured" unless WCC::Auth.config.app_name.present? && WCC::Auth.config.app_url.present?
|
31
|
-
|
32
|
-
RegistersSubscriptionsJob.perform_later
|
33
|
-
end
|
34
|
-
|
35
|
-
# Ensures toot is configured properly with the Media channel. Note this is
|
36
|
-
# not done until an actual subscription is requested.
|
37
|
-
def with_toot_config(&block)
|
38
|
-
return ::Toot.config(&block) if @configured
|
39
|
-
|
40
|
-
::Toot.config do |c|
|
41
|
-
media_api_url = WCC::Media::Client.default.api_url
|
42
|
-
|
43
|
-
c.source :media,
|
44
|
-
channel_prefix: "org.watermark.media.",
|
45
|
-
subscription_url: URI.join(media_api_url, '/toot/subscriptions')
|
46
|
-
|
47
|
-
# Note - use the [] method to override only if not set in client already
|
48
|
-
c[:http_connection] ||=
|
49
|
-
Faraday::Connection.new do |conn|
|
50
|
-
conn.use :client_app_token
|
51
|
-
conn.adapter :net_http
|
52
|
-
end
|
53
|
-
|
54
|
-
yield c
|
55
|
-
end
|
56
|
-
@configured = true
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
60
|
-
initializer 'configure WCC::Media Toots' do
|
61
|
-
ActiveSupport::Notifications.subscribe 'routes_loaded.engine.media.wcc' do
|
62
|
-
::Toot.config.callback_url ||=
|
63
|
-
begin
|
64
|
-
Rails.application.routes.url_helpers.wcc_media_url + '/callbacks'
|
65
|
-
rescue ArgumentError => ex
|
66
|
-
raise unless ex.message =~ /^Missing host to link to/
|
67
|
-
end
|
68
|
-
|
69
|
-
if ::Toot.config.callback_url.nil?
|
70
|
-
Rails.logger.error "Toot.config.callback_url not set! Media webhooks will not be subscribed."
|
71
|
-
else
|
72
|
-
WCC::Media::Engine.register_subscriptions
|
73
|
-
end
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
|
-
config.generators do |g|
|
78
|
-
g.test_framework :rspec, fixture: false
|
79
|
-
end
|
80
|
-
|
81
|
-
class RegistersSubscriptionsJob < ::ActiveJob::Base
|
82
|
-
self.queue_adapter = :async
|
83
|
-
|
84
|
-
def perform
|
85
|
-
Toot::RegistersSubscriptions.call
|
86
|
-
rescue WCC::Data::Mapper::ServiceUnavailable => e
|
87
|
-
_handle_error(e)
|
88
|
-
rescue Faraday::ConnectionFailed => e
|
89
|
-
_handle_error(e)
|
90
|
-
rescue Faraday::TimeoutError => e
|
91
|
-
_handle_error(e)
|
92
|
-
rescue Toot::RegisterSubscriptionFailure => e
|
93
|
-
raise unless e.status == 503
|
94
|
-
|
95
|
-
_handle_error(e)
|
96
|
-
end
|
97
|
-
|
98
|
-
private
|
99
|
-
|
100
|
-
def _handle_error(err)
|
101
|
-
logger.error "Server is down (will not retry): #{err.class} #{err}"
|
102
|
-
end
|
103
|
-
end
|
104
|
-
end
|