wcc-media-client 0.4.9 → 0.4.10

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: 23acc95773895070b2eedbad815232b59db1aed3
4
- data.tar.gz: 63cbfac8c544ea71059f8bf7c355feed60dbda27
3
+ metadata.gz: 7acce9b696288c4c5a1a7f1d6f6c0a0f20331a1a
4
+ data.tar.gz: 1f498be5b915ebcf9de02d9c4ac02ccabb700c11
5
5
  SHA512:
6
- metadata.gz: 259858439b3d981954a4b89924a202600ed88f779e54e1c0d61316324bd32de0a613e133831edc9fba966677deb84c2091e49c46f7c54736056cd7ece4aa139c
7
- data.tar.gz: bf237cbfe2a531358221be3ba0bd8462bc072523edf8a4e4ce8384b0b700e7108fb3459160004e5cb78f47217fe10e211421054ffa9eec078d1a090f8327b5aa
6
+ metadata.gz: b30e2fec462e1b75e064328cee511d560299d05456a69ad3c5f9539a16813c60a7f827b7ff84477c30477d2527d6a7265e1a77bfbb2ae6ab6af7522d077bd0d2
7
+ data.tar.gz: 9ab9fe2f4296aa73178cff5c6eabced2e82e674da361ae36838e610ce7c74f0d8d7a8ccf778b2bcb4c8bb46cc77c5b03978b22d45903c5805c728bb7879b9546
@@ -4,6 +4,7 @@ require_relative 'series'
4
4
  require_relative 'speaker'
5
5
  require_relative 'tag'
6
6
  require_relative 'playlist'
7
+ require_relative 'live_stream'
7
8
  require_relative 'client/response'
8
9
 
9
10
  module WCC
@@ -35,7 +36,8 @@ module WCC
35
36
  'series' => WCC::Media::Series,
36
37
  'speakers' => WCC::Media::Speaker,
37
38
  'tags' => WCC::Media::Tag,
38
- 'playlists' => WCC::Media::Playlist
39
+ 'playlists' => WCC::Media::Playlist,
40
+ 'streams' => WCC::Media::LiveStream
39
41
  }.freeze
40
42
  attr_reader(*RESOURCES.keys)
41
43
 
@@ -61,7 +63,7 @@ module WCC
61
63
 
62
64
  resp = client.get(
63
65
  "#{model.endpoint}/#{id}",
64
- default_params('target').merge(params)
66
+ default_params('target').merge(params),
65
67
  )
66
68
  resp.assert_ok!
67
69
  model.new(resp.body[model.key], resp.headers.freeze)
@@ -15,7 +15,7 @@ module WCC
15
15
  end
16
16
 
17
17
  def page_items
18
- body['messages'] || body['series'] || body['speakers'] || body['tags']
18
+ body['messages'] || body['series'] || body['speakers'] || body['tags'] || body['streams']
19
19
  end
20
20
 
21
21
  def next_page_query
@@ -0,0 +1,48 @@
1
+ # frozen_string_literal: true
2
+
3
+ class WCC::Media::LiveStream < WCC::Media::Base
4
+ active_record_shim do
5
+ endpoint 'streams'
6
+ key 'stream'
7
+ filters %w[
8
+ ].freeze
9
+ end
10
+
11
+ %w[
12
+ title
13
+ description
14
+ ].each do |att|
15
+ define_method att do
16
+ raw[att]
17
+ end
18
+ end
19
+
20
+ %w[
21
+ current_event
22
+ next_event
23
+ ].each do |att|
24
+ define_method att do
25
+ Event.new(raw[att]) if raw[att]
26
+ end
27
+ end
28
+
29
+ def active?
30
+ current_event.present?
31
+ end
32
+
33
+ class Event < WCC::Media::Base
34
+ %w[
35
+ title
36
+ description
37
+ embed_code
38
+ stream_url
39
+ starts_at
40
+ ends_at
41
+ duration
42
+ ].each do |att|
43
+ define_method att do
44
+ raw[att]
45
+ end
46
+ end
47
+ end
48
+ end
@@ -8,6 +8,7 @@ class WCC::Media::Message < WCC::Media::Base
8
8
  on_or_after_date
9
9
  on_or_before_date
10
10
  tag_id
11
+ playlist_id
11
12
  speaker_id
12
13
  scripture_book_id
13
14
  series_id
@@ -37,6 +38,10 @@ class WCC::Media::Message < WCC::Media::Base
37
38
  (raw['speakers'] || []).map { |val| WCC::Media::Speaker.new(val) }
38
39
  end
39
40
 
41
+ def playlists
42
+ (raw['playlists'] || []).map { |val| WCC::Media::Playlist.new(val) }
43
+ end
44
+
40
45
  def tags
41
46
  (raw['tags'] || []).map { |val| WCC::Media::Tag.new(val) }
42
47
  end
@@ -1,5 +1,5 @@
1
1
  module WCC
2
2
  module Media
3
- VERSION = '0.4.9'.freeze
3
+ VERSION = '0.4.10'.freeze
4
4
  end
5
5
  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.9
4
+ version: 0.4.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Watermark Dev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-02-10 00:00:00.000000000 Z
11
+ date: 2020-04-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: wcc-api
@@ -357,6 +357,7 @@ files:
357
357
  - lib/wcc/media/client.rb
358
358
  - lib/wcc/media/client/response.rb
359
359
  - lib/wcc/media/engine.rb
360
+ - lib/wcc/media/live_stream.rb
360
361
  - lib/wcc/media/message.rb
361
362
  - lib/wcc/media/playlist.rb
362
363
  - lib/wcc/media/rails.rb