wcc-media-client 0.6.0 → 0.7.0

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: 0bcc93bdeb901295a7e4b9d4e958622910a2e28a6019446ca56bcbf0d0989a15
4
- data.tar.gz: 88ed882ee01d56ca74ac934307ab65619b463b728b78736dce3d66ae44bfce24
3
+ metadata.gz: c3ded80f5c2f0db54965af27eacaad2bf7f78b0daf8f8e52979205f5d79cac1a
4
+ data.tar.gz: d7fe5b6207e5b97d520d3615ce0d17d94bfdf7a760621cbca0d5d227b8d6e702
5
5
  SHA512:
6
- metadata.gz: 732e7474858a343be900bc06f90b97d88fb9df1c951a011cb6bc1f3e5845ff5deec1537e2f20c03d831bed6e8e342a68231ecfa44563c748c3678daa4d1f7385
7
- data.tar.gz: da6a31215ad7f346fffa07493ad066e9ed89653a853880b9a10d86ac7e0c4ca0e5d4d0a88bcecac008fef8e98a63b98f38e2f69e3ba4f492b38bc3e1cc23fa3f
6
+ metadata.gz: 78db8c5105186be203f6ce8e3017c8714137e4f163b29c37e0793246bb2e5b49c1c752a1dbd68774b73002fedd51de253a53a11f1129be8f98c0435bbb9b3235
7
+ data.tar.gz: ce354d84eac11a10703d735aab7ebb1dbeee754b4ec58979f2d93fe081a52984e9758f5fb20a15fbadcfae160e21a863cb99da0ff957b254dcd4ed6d222cd2d8
@@ -45,7 +45,7 @@ module WCC::Media::ActiveRecordShim
45
45
  end
46
46
 
47
47
  def model_name
48
- name
48
+ ActiveModel::Name.new(self, nil, name)
49
49
  end
50
50
 
51
51
  def table_name
@@ -80,9 +80,9 @@ module WCC::Media::ActiveRecordShim
80
80
  endpoint = @endpoint || klass.name.split('::').last.downcase
81
81
  key = @key || klass.name.split('::').last.downcase
82
82
  klass.instance_eval do
83
- define_singleton_method('filters') { filters }
84
- define_singleton_method('endpoint') { endpoint }
85
- define_singleton_method('key') { key }
83
+ define_singleton_method(:filters) { filters }
84
+ define_singleton_method(:endpoint) { endpoint }
85
+ define_singleton_method(:key) { key }
86
86
  end
87
87
  end
88
88
 
@@ -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
@@ -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|
@@ -1,9 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- gem 'wcc-data'
4
- require 'wcc/data/enumerated_type'
3
+ require_relative 'enumerated_type'
5
4
 
6
- class WCC::Media::TagGroup < WCC::Data::EnumeratedType
5
+ class WCC::Media::TagGroup < WCC::Media::EnumeratedType
7
6
  attributes :id, :name, :key
8
7
 
9
8
  def matches?(value)
@@ -2,6 +2,6 @@
2
2
 
3
3
  module WCC
4
4
  module Media
5
- VERSION = '0.6.0'
5
+ VERSION = '0.7.0'
6
6
  end
7
7
  end
@@ -25,7 +25,4 @@ Gem::Specification.new do |spec|
25
25
  spec.require_paths = ['lib']
26
26
 
27
27
  spec.add_runtime_dependency 'wcc-api', '>= 0.3.1'
28
- spec.add_runtime_dependency 'wcc-auth'
29
- spec.add_runtime_dependency 'wcc-base', '~> 0.3.1'
30
- spec.add_runtime_dependency 'wcc-data', '~> 0.3.3'
31
28
  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.6.0
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Watermark Dev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-10-13 00:00:00.000000000 Z
11
+ date: 2023-09-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: wcc-api
@@ -24,48 +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-auth
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: '0'
34
- type: :runtime
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - ">="
39
- - !ruby/object:Gem::Version
40
- version: '0'
41
- - !ruby/object:Gem::Dependency
42
- name: wcc-base
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - "~>"
46
- - !ruby/object:Gem::Version
47
- version: 0.3.1
48
- type: :runtime
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - "~>"
53
- - !ruby/object:Gem::Version
54
- version: 0.3.1
55
- - !ruby/object:Gem::Dependency
56
- name: wcc-data
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - "~>"
60
- - !ruby/object:Gem::Version
61
- version: 0.3.3
62
- type: :runtime
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - "~>"
67
- - !ruby/object:Gem::Version
68
- version: 0.3.3
69
27
  description: REST Client for accessing the WCC Media library
70
28
  email:
71
29
  - dev@watermark.org
@@ -83,6 +41,7 @@ files:
83
41
  - lib/wcc/media/cacheable.rb
84
42
  - lib/wcc/media/client.rb
85
43
  - lib/wcc/media/client/response.rb
44
+ - lib/wcc/media/enumerated_type.rb
86
45
  - lib/wcc/media/live_stream.rb
87
46
  - lib/wcc/media/message.rb
88
47
  - lib/wcc/media/playlist.rb
@@ -113,7 +72,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
113
72
  - !ruby/object:Gem::Version
114
73
  version: '0'
115
74
  requirements: []
116
- rubygems_version: 3.3.22
75
+ rubygems_version: 3.1.6
117
76
  signing_key:
118
77
  specification_version: 4
119
78
  summary: ''