zype 0.6.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b2df35c63862b6279b75af1200befc0f356b7845de8edc15f93231a690d7cf29
4
- data.tar.gz: f20b634c31d01fd1086955cbe16df0e56b80811a35afb56244e921e95103b381
3
+ metadata.gz: d1630781dc6b0e4329810d4b21b4c2a2636c18d6893cf00f6d5c8d560e75f111
4
+ data.tar.gz: a8ac71d7ca6112aa24e7740c90753689bc372f8962813ccf5443e9b7168e93d2
5
5
  SHA512:
6
- metadata.gz: a252f56f298e93d5fad37283ba032f86143ee7aa6d5413f20933a51d7b135eb9b282fa98bf93365a82873386b21398045f66b74dca22b76a5d8f91eb7d11fc76
7
- data.tar.gz: 238177938f1e94770fdbe99c192a6b40ca0a00b717515074d003eff2d1bd1704e0007081d14d4620567095051ca278d4bc41361b15d1fd0e247e88357fc21d6e
6
+ metadata.gz: 4d6e49d8de2fb7b8fe73cd59441bca8cf921ef9c89278510c940145e125fc231e34a9695299c01684f1f9cc80106b843d387d88872e14ae2cd89b9be585fe63b
7
+ data.tar.gz: ca28609f4888a9ede6f5e1c2659328ecfa2d918b3670246b27defb0b5618ab8a43e2dd7233a9ad2081b15e4b02c1eb2bc015da3d21a325aa5d036ae279b634ca
@@ -0,0 +1,33 @@
1
+ module Zype
2
+ # The Subtitle Playlists API allows users to integrate subtitles with HLS manifests from a Zype video source.
3
+ # It’s a simple way to add subtitles which will be supported in all platforms that implement the Apple HLS specification.
4
+ # This class does not support all, find and update methods
5
+ #
6
+ # @since 0.7.0
7
+ class SubtitlePlaylists < Zype::BaseModel
8
+ %i[all find update].each do |mtd|
9
+ send(:define_method, mtd) do
10
+ raise NoMethodError
11
+ end
12
+ end
13
+
14
+ # Creates a new subtitle via the API.
15
+ # Files must be hosted and be accessible with a URL
16
+ #
17
+ # @param video_id [String] ID of the video to assign to the subtitle
18
+ # @param params [Hash] the properties of the subtitle
19
+ # @return [Hash] the newly created subtitle
20
+ def create(video_id:, params:)
21
+ client.execute(method: :post, path: "/videos/#{video_id}/subtitle_playlists", params: params)
22
+ end
23
+
24
+ # Deletes an existing subtitle via the API
25
+ #
26
+ # @param language [String] language of the playlist - must be full name - not code
27
+ # @param video_id [String] ID of the video the subtitle belongs to
28
+ # @return [Hash] the deleted subtitle
29
+ def delete(language:, video_id:)
30
+ client.execute(method: :delete, path: "/videos/#{video_id}/subtitle_playlists/#{language}")
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,56 @@
1
+ module Zype
2
+ # Work with subtitles for a specific video
3
+ #
4
+ # @since 0.7.0
5
+ class Subtitles < Zype::BaseModel
6
+ # Returns all subtitles for given video - add params to filter
7
+ #
8
+ # @param video_id [String] ID of video to get subtitles for
9
+ # @param params [Hash] the metadata to filter objects by
10
+ # @return [Array<Hash>] the subtitles returned from the API
11
+ def all(video_id:, params: {})
12
+ client.execute(method: :get, path: "/videos/#{video_id}/subtitles", params: params)
13
+ end
14
+
15
+ # Returns subtitle matching ID
16
+ #
17
+ # @param id [String] the ID of the object
18
+ # @param video_id [String] ID of the video the subtitle belongs to
19
+ # @return [Hash] the object returned from the API
20
+ def find(id:, video_id:)
21
+ client.execute(method: :get, path: "/videos/#{video_id}/subtitles/#{id}")
22
+ end
23
+
24
+ # Creates a new subtitle via the API.
25
+ # Files must be base64 encoded
26
+ # @example to base64 encode a file with Ruby
27
+ # require 'base64'
28
+ # Base64.encode64(File.open("file_path", "rb").read)
29
+ #
30
+ # @param video_id [String] ID of the video to assign to the subtitle
31
+ # @param params [Hash] the properties of the subtitle
32
+ # @return [Hash] the newly created subtitle
33
+ def create(video_id:, params:)
34
+ client.execute(method: :post, path: "/videos/#{video_id}/subtitles", params: params)
35
+ end
36
+
37
+ # Updates an existing subtitle via the API
38
+ #
39
+ # @param id [String] the ID of the object
40
+ # @param video_id [String] ID of the video the subtitle belongs to
41
+ # @param params [Hash] the properties to be updated
42
+ # @return [Hash] the updated subtitle
43
+ def update(id:, video_id:, params:)
44
+ client.execute(method: :put, path: "/videos/#{video_id}/subtitles/#{id}", params: params)
45
+ end
46
+
47
+ # Deletes an existing subtitle via the API
48
+ #
49
+ # @param id [String] the ID of the object
50
+ # @param video_id [String] ID of the video the subtitle belongs to
51
+ # @return [Hash] the deleted subtitle
52
+ def delete(id:, video_id:)
53
+ client.execute(method: :delete, path: "/videos/#{video_id}/subtitles/#{id}")
54
+ end
55
+ end
56
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zype
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
  - Zype
@@ -67,6 +67,8 @@ files:
67
67
  - lib/zype/models/encoders.rb
68
68
  - lib/zype/models/live_events.rb
69
69
  - lib/zype/models/playlists.rb
70
+ - lib/zype/models/subtitle_playlists.rb
71
+ - lib/zype/models/subtitles.rb
70
72
  - lib/zype/models/videos.rb
71
73
  homepage: http://rubygems.org/gems/zype
72
74
  licenses: