kollus 0.0.1
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 +7 -0
- data/lib/kollus.rb +67 -0
- metadata +44 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 14cc7823e16b7dfaff5e3d7923b53d004278b7ae
|
4
|
+
data.tar.gz: e843e9e8a47563812ee7727d7f217463d8372632
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: fd3aef5156dcf8c13241680d9cecd68ce923fab636797d49683d72cac4793aa4eb516c55949c866ce5a4dc87da381dec48f5c815005b8ee3b56945aaf89b48f9
|
7
|
+
data.tar.gz: 40e1124535ff9ac09d2779f12972d9c654d4010f12fc9b961b666f207fe7bcef094ce4f4ba6cbbc511c7de03b8c65cb311c65d002378e385de4ff9bf4965d405
|
data/lib/kollus.rb
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
require 'net/http'
|
2
|
+
require 'json'
|
3
|
+
|
4
|
+
class Kollus
|
5
|
+
def initialize(account_id, account_key, api_token)
|
6
|
+
@id = account_id
|
7
|
+
@key = account_key
|
8
|
+
@token = api_token
|
9
|
+
end
|
10
|
+
|
11
|
+
def media(media_content_key, media_profile_key = nil, awt_code = nil, expire_time = 7200, play_list = nil)
|
12
|
+
api_uri = URI('http://api.kr.kollus.com/0/media_auth/media_token/get_media_link_by_userid?access_token=' + @token)
|
13
|
+
params = {
|
14
|
+
client_user_id: @id,
|
15
|
+
security_key: @key,
|
16
|
+
media_content_key: media_content_key,
|
17
|
+
media_profile_key: media_profile_key,
|
18
|
+
awt_code: awt_code,
|
19
|
+
expire_time: expire_time,
|
20
|
+
play_list: play_list
|
21
|
+
}
|
22
|
+
|
23
|
+
response = Net::HTTP.post_form(api_uri, params)
|
24
|
+
# TODO: Error handling
|
25
|
+
|
26
|
+
response = JSON.parse response.body
|
27
|
+
# TODO: Error handling
|
28
|
+
|
29
|
+
unless response['error'] == 0
|
30
|
+
# TODO: Error handling
|
31
|
+
return false
|
32
|
+
end
|
33
|
+
|
34
|
+
response['result']['media_token']
|
35
|
+
end
|
36
|
+
|
37
|
+
def upload_uri(title = nil, expire_time = 600, encrypted = true, audio = false)
|
38
|
+
api_uri = URI('http://api.kr.kollus.com/0/media_auth/upload/create_url.json?access_token=' + @token)
|
39
|
+
params = {
|
40
|
+
# 값의 범위는 0 < expire_time <= 21600 입니다. 빈값을 보내거나 항목 자체를 제거하면 기본 600초로 설정됩니다.
|
41
|
+
expire_time: expire_time,
|
42
|
+
# 업로드한 파일이 속할 카테고리의 키(API를 이용하여 확득 가능)입니다. 빈값을 보내 거나 항목 자체를 제거하면 '없음'에 속합니다.
|
43
|
+
category_key: 'bw2z2ngbkatkqx77',
|
44
|
+
# 입력한 제목을 컨텐츠의 제목으로 강제지정합니다. 이 값을 보내지 않거나 빈값으로 보내면 기본 적으로 파일명이 제목으로 사용됩니다.
|
45
|
+
title: title,
|
46
|
+
# 0은 일반 업로드, 1은 암호화 업로드입니다. 암호화 업로드시 파일이 암호화 되어 Kollus의 전용 플레이어로만 재생됩니다.
|
47
|
+
is_encryption_upload: encrypted ? 1 : 0,
|
48
|
+
# 0은 비디오 업로드, 1은 음원 파일 업로드입니다.
|
49
|
+
is_audio_upload: audio ? 1 : 0,
|
50
|
+
# 파일의 분할 업로드를 지원하기 위한 값입니다. 추후 제공될 기능이며, 현재는 동작하지 않습니다.
|
51
|
+
is_multipart_upload: 0
|
52
|
+
}
|
53
|
+
|
54
|
+
response = Net::HTTP.post_form(api_uri, params)
|
55
|
+
# TODO: Error handling
|
56
|
+
|
57
|
+
response = JSON.parse response.body
|
58
|
+
# TODO: Error handling
|
59
|
+
|
60
|
+
unless response['error'] == 0
|
61
|
+
# TODO: Error handling
|
62
|
+
return false
|
63
|
+
end
|
64
|
+
|
65
|
+
response['result']['upload_url']
|
66
|
+
end
|
67
|
+
end
|
metadata
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: kollus
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Hyeon Kim
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-10-10 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: Kollus API written in ruby.
|
14
|
+
email: simnalamburt@gmail.com
|
15
|
+
executables: []
|
16
|
+
extensions: []
|
17
|
+
extra_rdoc_files: []
|
18
|
+
files:
|
19
|
+
- lib/kollus.rb
|
20
|
+
homepage: https://github.com/simnalamburt/kollus-ruby
|
21
|
+
licenses:
|
22
|
+
- MIT
|
23
|
+
metadata: {}
|
24
|
+
post_install_message:
|
25
|
+
rdoc_options: []
|
26
|
+
require_paths:
|
27
|
+
- lib
|
28
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
29
|
+
requirements:
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
34
|
+
requirements:
|
35
|
+
- - ">="
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
requirements: []
|
39
|
+
rubyforge_project:
|
40
|
+
rubygems_version: 2.4.5.1
|
41
|
+
signing_key:
|
42
|
+
specification_version: 4
|
43
|
+
summary: Kollus API written in ruby
|
44
|
+
test_files: []
|