chili_player 0.1.3 → 0.1.4
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 +4 -4
- data/.DS_Store +0 -0
- data/Gemfile.lock +1 -1
- data/README.md +21 -13
- data/lib/chili_player/init.rb +14 -18
- data/lib/chili_player/version.rb +2 -2
- data/lib/chili_player/videos.rb +28 -24
- data/test.mp4 +0 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3e25bc13323d11d4263d32f9acb851af4d5079d6
|
4
|
+
data.tar.gz: f74e8d89ed8f693873b8990e35b37ee1879ac4fb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9e93b3e77a55362e90a7879a500d87f47f67dd07d6e445ef8840b743c2f7cafd49f2d4444d2bfb4edb6c8415f23f7233026b69571bf611bc387c6ece8dee2113
|
7
|
+
data.tar.gz: 0f528e79727f11ac6b685278b71de82588535c7023f60ac2162e27b41dc6746cd3a7314960f15b882343a188d0e9e12b29e27080ee98af7a281e989bc35ec619
|
data/.DS_Store
ADDED
Binary file
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -23,7 +23,7 @@ Or install it yourself as:
|
|
23
23
|
First of all, you need to sign in [chili player](https://player.chiligumvideos.com/) and then you need to get your credential.
|
24
24
|
After you get `token`, you can instantiate the class as in this example:
|
25
25
|
|
26
|
-
client =
|
26
|
+
client = Player.new('your-token')
|
27
27
|
|
28
28
|
## Videos
|
29
29
|
|
@@ -31,31 +31,39 @@ After you had instantiate the class, to manipulate the API endpoints we provide
|
|
31
31
|
|
32
32
|
### List all videos
|
33
33
|
|
34
|
-
response = client.
|
35
|
-
response.body
|
34
|
+
response = client.videos
|
36
35
|
|
37
|
-
This method returns
|
36
|
+
This method returns an array containing hashes of all information about the videos created, e.g:
|
37
|
+
|
38
|
+
[{"id"=>164, "data"=>"https://s3.amazonaws.com/chilihls/uploads/7d00f8054103d0a3824e59a3689743d69faf4d4b.mp4", "player_url"=>"https://player.chiligumvideos.com/d6d791b7a8", "postback_url"=>nil, "preserve_original_file"=>true, "activated"=>true, "watermark_image_url"=>nil, "watermark_link"=>nil, "watermark_position"=>nil, "wartermark_start"=>nil, "watermark_duration"=>nil, "created_at"=>"2018-06-27T16:43:28.026Z"}, {"id"=>162, "data"=>"https://s3.amazonaws.com/chilihls/uploads/d24ceab72878a4fcdb2c4b52b6d1ef0c67a2ed43.mp4", "player_url"=>"https://player.chiligumvideos.com/dff4f6b549", "postback_url"=>nil, "preserve_original_file"=>true, "activated"=>true, "watermark_image_url"=>nil, "watermark_link"=>nil, "watermark_position"=>nil, "wartermark_start"=>nil, "watermark_duration"=>nil, "created_at"=>"2018-06-19T17:56:50.498Z"}]
|
39
|
+
|
38
40
|
|
39
41
|
### Get a specific video
|
40
42
|
|
41
|
-
response = client.
|
42
|
-
|
43
|
+
response = client.video(video_id)
|
44
|
+
|
45
|
+
If video_id exists this call returns all information about the requested video, e.g:
|
43
46
|
|
44
|
-
|
47
|
+
{"id"=>5212, "data"=>"https://s3.amazonaws.com/chilihls/uploads/9f46c3365c3f20cb32d82dd795fdb664fa363d33.mp4", "player_url"=>"https://player.chiligumvideos.com/db4d980eef", "postback_url"=>nil, "preserve_original_file"=>true, "activated"=>true, "watermark_image_url"=>nil, "watermark_link"=>nil, "watermark_position"=>nil, "wartermark_start"=>nil, "watermark_duration"=>nil, "created_at"=>"2018-08-30T18:11:16.907Z"}
|
45
48
|
|
46
49
|
### Upload video
|
47
|
-
In order to upload video, you must pass as parameters the video's title
|
50
|
+
In order to upload a video, you must pass as parameters the video's title, the video file you want to upload and also optional parameters such as: name, postback_url, preserve_original_file, activated, watermark_image_url, watermark_link, watermark_position, wartermark_start, watermark_duration.
|
51
|
+
|
52
|
+
response = client.upload(name_video, video_file, video_optional_params)
|
53
|
+
|
54
|
+
This method returns all information displayed at 'Get a specific video' topic.
|
55
|
+
|
56
|
+
### Update video
|
57
|
+
In order to update a video, you must pass as parameters the video's id and also optional parameters such as: name, postback_url, preserve_original_file, activated, watermark_image_url, watermark_link, watermark_position, wartermark_start, watermark_duration. When you update the video, you cannot change the video's file.
|
48
58
|
|
49
|
-
response = client.upload(
|
50
|
-
response.body
|
59
|
+
response = client.upload(video_id, video_optional_params)
|
51
60
|
|
52
|
-
This method returns all information
|
61
|
+
This method returns all information displayed at 'Get a specific video' topic.
|
53
62
|
|
54
63
|
### Delete a video
|
55
64
|
If you want to delete a previous uploaded video, you just need to pass the id of this video
|
56
65
|
|
57
66
|
response = client.delete(video_id)
|
58
|
-
response.body
|
59
67
|
|
60
68
|
If the video_id is valid, this method returns the message `{"msg": "deleted"}`
|
61
69
|
|
@@ -75,4 +83,4 @@ The gem is available as open source under the terms of the [MIT License](https:/
|
|
75
83
|
|
76
84
|
## Code of Conduct
|
77
85
|
|
78
|
-
Everyone interacting in the ChiliPlayer project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/
|
86
|
+
Everyone interacting in the ChiliPlayer project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/chili_player/blob/master/CODE_OF_CONDUCT.md).
|
data/lib/chili_player/init.rb
CHANGED
@@ -2,28 +2,24 @@ require 'chili_player'
|
|
2
2
|
require 'chili_player/version'
|
3
3
|
require 'chili_player/videos'
|
4
4
|
require 'rest-client'
|
5
|
+
require 'json'
|
5
6
|
|
6
|
-
#
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
include RestClient
|
11
|
-
include ChiliPlayer::Videos
|
7
|
+
# init access class
|
8
|
+
class Player
|
9
|
+
include RestClient
|
10
|
+
include Videos
|
12
11
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
end
|
17
|
-
end
|
12
|
+
def initialize(options = {})
|
13
|
+
instance_variable_set('@token', options)
|
14
|
+
end
|
18
15
|
|
19
|
-
|
16
|
+
private
|
20
17
|
|
21
|
-
|
22
|
-
|
23
|
-
|
18
|
+
def header_request
|
19
|
+
{ token: @token }
|
20
|
+
end
|
24
21
|
|
25
|
-
|
26
|
-
|
27
|
-
end
|
22
|
+
def endpoint_url
|
23
|
+
ChiliPlayer::ENDPOINT_URL
|
28
24
|
end
|
29
25
|
end
|
data/lib/chili_player/version.rb
CHANGED
data/lib/chili_player/videos.rb
CHANGED
@@ -1,36 +1,40 @@
|
|
1
1
|
require 'chili_player'
|
2
2
|
require 'chili_player/init'
|
3
3
|
require 'rest-client'
|
4
|
+
require 'json'
|
4
5
|
|
5
6
|
# lib/chili_player/videos.rb
|
6
|
-
module
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
7
|
+
module Videos
|
8
|
+
def videos
|
9
|
+
JSON.parse RestClient.get(endpoint_url, header_request)
|
10
|
+
end
|
11
|
+
|
12
|
+
def video(video_id)
|
13
|
+
JSON.parse RestClient.get(endpoint_url + video_id.to_s, header_request)
|
14
|
+
end
|
12
15
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
+
def upload(name, video, options = {})
|
17
|
+
JSON.parse RestClient.post(endpoint_url, params(options, name, video),
|
18
|
+
header_request)
|
19
|
+
end
|
16
20
|
|
17
|
-
|
18
|
-
|
19
|
-
|
21
|
+
def update(video_id, options)
|
22
|
+
JSON.parse RestClient.patch(endpoint_url + video_id.to_s, params(options),
|
23
|
+
header_request)
|
24
|
+
end
|
20
25
|
|
21
|
-
|
22
|
-
|
23
|
-
|
26
|
+
def delete(video_id)
|
27
|
+
JSON.parse RestClient.delete(endpoint_url + video_id.to_s, header_request)
|
28
|
+
end
|
24
29
|
|
25
|
-
|
30
|
+
private
|
26
31
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
end
|
32
|
+
def params(options, name = nil, video = nil)
|
33
|
+
data = { video: {} }
|
34
|
+
options.delete(:data)
|
35
|
+
data[:video].merge!(options)
|
36
|
+
data[:video][:name] = name unless name.nil?
|
37
|
+
data[:video][:data] = File.new(video, 'rb') unless video.nil?
|
38
|
+
data
|
35
39
|
end
|
36
40
|
end
|
data/test.mp4
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chili_player
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Guilherme Casimiro
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-09-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: coveralls
|
@@ -87,6 +87,7 @@ executables: []
|
|
87
87
|
extensions: []
|
88
88
|
extra_rdoc_files: []
|
89
89
|
files:
|
90
|
+
- ".DS_Store"
|
90
91
|
- ".gitignore"
|
91
92
|
- ".travis.yml"
|
92
93
|
- CODE_OF_CONDUCT.md
|