wcc-media-client 0.6.1 → 0.7.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/enumerated_type.rb +66 -0
- data/lib/wcc/media/series.rb +3 -0
- data/lib/wcc/media/tag_group.rb +2 -3
- data/lib/wcc/media/version.rb +1 -1
- data/wcc-media-client.gemspec +0 -1
- metadata +4 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 886c5928424748c983f732a1b3837533d82f5fd4443d22dc1b4a9600c40acb5e
|
4
|
+
data.tar.gz: f0ad07289d0519e45937967500478e5ca1adfa4983f785f7d64682dc6bea7657
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d1dcc8cd488fe14a6814df1b99b44bb39deae93e3bf09704769f15feb44115af37cd8247ad161637d6c7d42c1ac10981174931d7cea96220483c0654c42a36fa
|
7
|
+
data.tar.gz: 834460223c5b64f26eedeb0321b1e6c93b53e61dcd959e1bf84e6a93e75fcc510b083710d9fc97384c3464e49e9d5603d47435c5780fe4d4deb400a24ad5b206
|
@@ -0,0 +1,66 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copied out of WCC::Data::EnumeratedType so that we don't have to depend on the wcc-data gem
|
4
|
+
module WCC::Media
|
5
|
+
class EnumeratedType
|
6
|
+
def initialize(args = {})
|
7
|
+
only_attributes(args).each do |key, value|
|
8
|
+
instance_variable_set("@#{key}", value)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.[](value)
|
13
|
+
all.find { |record| record.matches?(value) }
|
14
|
+
end
|
15
|
+
|
16
|
+
def matches?(value)
|
17
|
+
raise NotImplementedError,
|
18
|
+
'The #matches? method should be defined in subclasses and return ' \
|
19
|
+
'true if the argument matches this record and false otherwise.'
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.db
|
23
|
+
raise NotImplementedError,
|
24
|
+
'The ::db class method should be defined in subclasses as an array ' \
|
25
|
+
'of hashes containing data for each record.'
|
26
|
+
end
|
27
|
+
|
28
|
+
def self.all
|
29
|
+
@all ||= db.collect { |data| new(data) }
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.reset
|
33
|
+
@all = nil
|
34
|
+
end
|
35
|
+
|
36
|
+
def self.attributes(*attrs)
|
37
|
+
attrs.each do |attr|
|
38
|
+
defined_attributes << attr
|
39
|
+
define_method(attr) do
|
40
|
+
instance_variable_get("@#{attr}")
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def self.defined_attributes
|
46
|
+
@attributes ||= [] # rubocop:disable Naming/MemoizedInstanceVariableName
|
47
|
+
end
|
48
|
+
|
49
|
+
def self.inherited(subclass)
|
50
|
+
super
|
51
|
+
subclass.send(
|
52
|
+
:instance_variable_set,
|
53
|
+
:@attributes,
|
54
|
+
defined_attributes.dup
|
55
|
+
)
|
56
|
+
end
|
57
|
+
|
58
|
+
private
|
59
|
+
|
60
|
+
def only_attributes(args)
|
61
|
+
args.select do |key, _value|
|
62
|
+
self.class.defined_attributes.include?(key)
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
data/lib/wcc/media/series.rb
CHANGED
@@ -21,6 +21,8 @@ class WCC::Media::Series < WCC::Media::Base
|
|
21
21
|
title
|
22
22
|
subtitle
|
23
23
|
summary
|
24
|
+
external_playlist
|
25
|
+
show_landing_page
|
24
26
|
date_range
|
25
27
|
messages_count
|
26
28
|
].each do |att|
|
@@ -32,6 +34,7 @@ class WCC::Media::Series < WCC::Media::Base
|
|
32
34
|
%w[
|
33
35
|
images
|
34
36
|
series_type
|
37
|
+
meta
|
35
38
|
].each do |att|
|
36
39
|
define_method att do
|
37
40
|
OpenStruct.new(raw[att]) if raw[att]
|
data/lib/wcc/media/tag_group.rb
CHANGED
@@ -1,9 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
require 'wcc/data/enumerated_type'
|
3
|
+
require_relative 'enumerated_type'
|
5
4
|
|
6
|
-
class WCC::Media::TagGroup < WCC::
|
5
|
+
class WCC::Media::TagGroup < WCC::Media::EnumeratedType
|
7
6
|
attributes :id, :name, :key
|
8
7
|
|
9
8
|
def matches?(value)
|
data/lib/wcc/media/version.rb
CHANGED
data/wcc-media-client.gemspec
CHANGED
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
|
+
version: 0.7.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: 2023-
|
11
|
+
date: 2023-09-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: wcc-api
|
@@ -24,20 +24,6 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 0.3.1
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: wcc-data
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - "~>"
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: 0.3.3
|
34
|
-
type: :runtime
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - "~>"
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: 0.3.3
|
41
27
|
description: REST Client for accessing the WCC Media library
|
42
28
|
email:
|
43
29
|
- dev@watermark.org
|
@@ -55,6 +41,7 @@ files:
|
|
55
41
|
- lib/wcc/media/cacheable.rb
|
56
42
|
- lib/wcc/media/client.rb
|
57
43
|
- lib/wcc/media/client/response.rb
|
44
|
+
- lib/wcc/media/enumerated_type.rb
|
58
45
|
- lib/wcc/media/live_stream.rb
|
59
46
|
- lib/wcc/media/message.rb
|
60
47
|
- lib/wcc/media/playlist.rb
|
@@ -85,7 +72,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
85
72
|
- !ruby/object:Gem::Version
|
86
73
|
version: '0'
|
87
74
|
requirements: []
|
88
|
-
rubygems_version: 3.
|
75
|
+
rubygems_version: 3.4.11
|
89
76
|
signing_key:
|
90
77
|
specification_version: 4
|
91
78
|
summary: ''
|