wcc-media-client 0.3.1 → 0.3.2

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
  SHA1:
3
- metadata.gz: ae861b2a0282094c1a6a654cb7633f44ebe26b5e
4
- data.tar.gz: 3cc46b3c4e5b5a37cc8d9bc2513d485816097e8e
3
+ metadata.gz: dac7679ba7a19002b4440ec0faad0b9ef3e83ffc
4
+ data.tar.gz: 9fc410442fc3337dfbc122694b8f248833eed88f
5
5
  SHA512:
6
- metadata.gz: da804233f30538abd41390a3b78d29838fd7107677c0015d708f25ddd8395d283e70cbc765a787b21682741b63483a338a311fb4508d48a3f9c7b823c738a408
7
- data.tar.gz: ae3438b8a7a5411e9cb0f5f459d45042699a45a78dbea576264a773a54ef661c4e9aaae197a5ceed453832ba3a76eb1372d3db86d62e9fa9b43c8691eff611a5
6
+ metadata.gz: 0fcefbe6c05c432a7fbec918e518aa556b5d99dfbbe3c9499303c599970f05073cb3868e41825846eab0832538926c88adac14dd2b4cbcf87e91aa6881cf85a4
7
+ data.tar.gz: 431608868ed4c849c303078cc1afeaeebe1c996b68c63f3674d2c3ee78e08d59318110caccd5e7ebaf2539d2bf916f0f289fba977df7bdf3e4d0e08587fb6508
data/Guardfile ADDED
@@ -0,0 +1,32 @@
1
+ directories %w[lib spec]
2
+
3
+ group :red_green_refactor, halt_on_fail: true do
4
+ guard :rspec, cmd: 'bundle exec rspec --order rand', all_on_start: false do
5
+ require 'guard/rspec/dsl'
6
+ dsl = Guard::RSpec::Dsl.new(self)
7
+
8
+ # RSpec files
9
+ rspec = dsl.rspec
10
+ watch(rspec.spec_helper) { rspec.spec_dir }
11
+ watch(rspec.spec_support) { rspec.spec_dir }
12
+ watch(rspec.spec_files)
13
+
14
+ # Ruby files
15
+ ruby = dsl.ruby
16
+ dsl.watch_spec_files_for(ruby.lib_files)
17
+ end
18
+
19
+ guard :rubocop, cli: ['--display-cop-names'] do
20
+ watch(%r{.+\.rb$})
21
+ watch(%r{(?:.+/)?\.rubocop(?:_todo)?\.yml$}) { |m| File.dirname(m[0]) }
22
+ end
23
+ end
24
+
25
+ group :autofix do
26
+ guard :rubocop, all_on_start: false, cli: ['--auto-correct', '--display-cop-names'] do
27
+ watch(%r{.+\.rb$})
28
+ watch(%r{(?:.+/)?\.rubocop(?:_todo)?\.yml$}) { |m| File.dirname(m[0]) }
29
+ end
30
+ end
31
+
32
+ scope group: :red_green_refactor
@@ -8,8 +8,9 @@ module WCC::Media::ActiveRecordShim
8
8
  def attributes
9
9
  raw.keys.each_with_object({}) do |key, h|
10
10
  next unless respond_to?(key)
11
+
11
12
  val = public_send(key)
12
- h[key] =
13
+ h[key] =
13
14
  if val.is_a? Array
14
15
  val.map { |v| v.respond_to?(:to_h) ? v.to_h : v }
15
16
  else
@@ -20,6 +20,8 @@ class WCC::Media::Message < WCC::Media::Base
20
20
  title
21
21
  description
22
22
  series_position
23
+ topic
24
+ topics
23
25
  ].each do |att|
24
26
  define_method att do
25
27
  raw[att]
@@ -11,11 +11,20 @@ class WCC::Media::Speaker < WCC::Media::Base
11
11
  end
12
12
 
13
13
  %w[
14
- featured
15
14
  name
16
15
  ].each do |att|
17
16
  define_method att do
18
17
  raw[att]
19
18
  end
20
19
  end
20
+
21
+ %w[
22
+ searchable
23
+ featured
24
+ ].each do |att|
25
+ define_method att do
26
+ raw[att]
27
+ end
28
+ alias_method "#{att}?", att
29
+ end
21
30
  end
data/lib/wcc/media/tag.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  require_relative 'base'
2
+ require_relative 'tag_group'
2
3
 
3
4
  class WCC::Media::Tag < WCC::Media::Base
4
5
  active_record_shim do
@@ -15,4 +16,10 @@ class WCC::Media::Tag < WCC::Media::Base
15
16
  raw[att]
16
17
  end
17
18
  end
19
+
20
+ def tag_group
21
+ return unless key = raw.dig('tag_group', 'key')
22
+
23
+ WCC::Media::TagGroup[key.to_sym]
24
+ end
18
25
  end
@@ -0,0 +1,24 @@
1
+ gem 'wcc-data'
2
+ require 'wcc/data/enumerated_type'
3
+
4
+ class WCC::Media::TagGroup < WCC::Data::EnumeratedType
5
+ attributes :id, :name, :key
6
+
7
+ def matches?(value)
8
+ [id, key, self].include?(value)
9
+ end
10
+
11
+ def tags
12
+ Tag.where(tag_group_id: id)
13
+ end
14
+
15
+ def self.db
16
+ TAG_GROUPS
17
+ end
18
+ end
19
+
20
+ TAG_GROUPS = [
21
+ { id: 1, name: "Channels", key: :channels },
22
+ { id: 2, name: "Ministries", key: :ministries },
23
+ { id: 3, name: "Meta", key: :meta },
24
+ ]
@@ -1,5 +1,5 @@
1
1
  module WCC
2
2
  module Media
3
- VERSION = '0.3.1'.freeze
3
+ VERSION = '0.3.2'.freeze
4
4
  end
5
5
  end
@@ -25,8 +25,12 @@ 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-data', '~> 0.2.0'
28
29
 
29
30
  spec.add_development_dependency 'byebug'
31
+ spec.add_development_dependency 'guard', '~> 2.15'
32
+ spec.add_development_dependency 'guard-rspec', '~> 4.7'
33
+ spec.add_development_dependency 'guard-rubocop', '~> 1.3'
30
34
  spec.add_development_dependency 'http', '> 1.0', '< 3.0'
31
35
  spec.add_development_dependency 'httplog', '~> 1.0'
32
36
  spec.add_development_dependency 'rake', '~> 12.3'
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.3.1
4
+ version: 0.3.2
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-02-11 00:00:00.000000000 Z
11
+ date: 2019-02-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: wcc-api
@@ -24,6 +24,20 @@ 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.2.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.2.0
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: byebug
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -38,6 +52,48 @@ dependencies:
38
52
  - - ">="
39
53
  - !ruby/object:Gem::Version
40
54
  version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: guard
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '2.15'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '2.15'
69
+ - !ruby/object:Gem::Dependency
70
+ name: guard-rspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '4.7'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '4.7'
83
+ - !ruby/object:Gem::Dependency
84
+ name: guard-rubocop
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '1.3'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '1.3'
41
97
  - !ruby/object:Gem::Dependency
42
98
  name: http
43
99
  requirement: !ruby/object:Gem::Requirement
@@ -152,6 +208,7 @@ files:
152
208
  - ".gitignore"
153
209
  - ".rubocop.yml"
154
210
  - Gemfile
211
+ - Guardfile
155
212
  - README.md
156
213
  - lib/wcc/media/active_record_shim.rb
157
214
  - lib/wcc/media/base.rb
@@ -162,6 +219,7 @@ files:
162
219
  - lib/wcc/media/series.rb
163
220
  - lib/wcc/media/speaker.rb
164
221
  - lib/wcc/media/tag.rb
222
+ - lib/wcc/media/tag_group.rb
165
223
  - lib/wcc/media/version.rb
166
224
  - rakefile
167
225
  - wcc-media-client.gemspec
@@ -185,7 +243,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
185
243
  version: '0'
186
244
  requirements: []
187
245
  rubyforge_project:
188
- rubygems_version: 2.6.11
246
+ rubygems_version: 2.5.2
189
247
  signing_key:
190
248
  specification_version: 4
191
249
  summary: ''