azure_media_service 0.2.4 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -0
- data/lib/azure_media_service.rb +9 -18
- data/lib/azure_media_service/config.rb +1 -3
- data/lib/azure_media_service/request.rb +6 -6
- data/lib/azure_media_service/version.rb +1 -1
- data/spec/azure_media_service_spec.rb +45 -0
- data/spec/spec_helper.rb +1 -2
- metadata +5 -5
- data/spec/azure_media_service_ruby_spec.rb +0 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 71f4bc0b6d12e836eaa7e2c95f1344a3a90eff01
|
4
|
+
data.tar.gz: 8ff7876544613206adf74cb817640b7832d8712f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: edf416e36b0e34be8285b65449c3f1ad6fca45c68a2e42e88aa2a5d8c124b361872535e4a7aa1744f4e674b78d1904bfdd812ad8eeb0460951916284e8136524
|
7
|
+
data.tar.gz: 8682d8330056f87c8fb3a76be508cdf6f0599cb2fe9b3d8391fa354b62d0fba0108cd4e3351d7ceaa6076461c229ab09501eda2729ee606424e3e3884151c860
|
data/README.md
CHANGED
@@ -24,6 +24,9 @@ Or install it yourself as:
|
|
24
24
|
AzureMediaService.configure do |config|
|
25
25
|
cofig.id = 'xxxxxxxx'
|
26
26
|
config.secret = 'xxxxxxxxxxxxxxxxxx'
|
27
|
+
config.token_uri = 'https://login.microsoft.com/{tenant_id}/oauth2/token'
|
28
|
+
config.media_uri = 'https://{service}.restv2.{region}.media.azure.net/api/'
|
29
|
+
config.api_version = '2.xx' # Defaults to 2.9
|
27
30
|
end
|
28
31
|
|
29
32
|
# upload file
|
data/lib/azure_media_service.rb
CHANGED
@@ -21,33 +21,24 @@ module AzureMediaService
|
|
21
21
|
@@tasks = {}
|
22
22
|
|
23
23
|
class << self
|
24
|
+
attr_accessor :id
|
25
|
+
attr_accessor :token_uri
|
26
|
+
attr_accessor :media_uri
|
27
|
+
attr_accessor :api_version
|
28
|
+
attr_accessor :secret
|
24
29
|
|
25
30
|
def configure
|
26
31
|
yield self
|
27
32
|
end
|
28
33
|
|
29
34
|
def request
|
30
|
-
|
35
|
+
@request ||= Request.new(
|
36
|
+
client_id: @id, client_secret: @secret, tokenURI: @token_uri, mediaURI: @media_uri, api_version: @api_version
|
37
|
+
)
|
31
38
|
end
|
32
39
|
|
33
40
|
def service
|
34
|
-
|
35
|
-
end
|
36
|
-
|
37
|
-
def id=(v)
|
38
|
-
@@id = v
|
39
|
-
end
|
40
|
-
|
41
|
-
def id
|
42
|
-
@@id
|
43
|
-
end
|
44
|
-
|
45
|
-
def secret=(v)
|
46
|
-
@@secret = v
|
47
|
-
end
|
48
|
-
|
49
|
-
def secret
|
50
|
-
@@secret
|
41
|
+
@service ||= Service.new
|
51
42
|
end
|
52
43
|
|
53
44
|
def add_encode_task(name, task)
|
@@ -123,17 +123,17 @@ module AzureMediaService
|
|
123
123
|
|
124
124
|
@config = config || {}
|
125
125
|
# @config[:mediaURI] = "https://media.windows.net/API/"
|
126
|
-
@config[:mediaURI]
|
127
|
-
@config[:tokenURI]
|
128
|
-
@config[:client_id]
|
129
|
-
@config[:client_secret]
|
126
|
+
@config[:mediaURI] || raise(MediaServiceError.new('Media URI missing, please specify in config'))
|
127
|
+
@config[:tokenURI] || raise(MediaServiceError.new('Token URI missing, please specify in config'))
|
128
|
+
@config[:client_id] || raise(MediaServiceError.new('Client ID missing, please specify in config'))
|
129
|
+
@config[:client_secret] || raise(MediaServiceError.new('Client secret missing, please specify in config'))
|
130
130
|
|
131
131
|
@default_headers = {
|
132
132
|
"Content-Type" => "application/json;odata=verbose",
|
133
133
|
"Accept" => "application/json;odata=verbose",
|
134
134
|
"DataServiceVersion" => "3.0",
|
135
135
|
"MaxDataServiceVersion" => "3.0",
|
136
|
-
"x-ms-version" =>
|
136
|
+
"x-ms-version" => @config[:api_version] || Config::API_VERSION
|
137
137
|
}
|
138
138
|
end
|
139
139
|
|
@@ -156,7 +156,7 @@ module AzureMediaService
|
|
156
156
|
client_id: @config[:client_id],
|
157
157
|
client_secret: @config[:client_secret],
|
158
158
|
grant_type: 'client_credentials',
|
159
|
-
|
159
|
+
resource: 'https://rest.media.azure.net'
|
160
160
|
}
|
161
161
|
end
|
162
162
|
|
@@ -0,0 +1,45 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe AzureMediaService do
|
4
|
+
context '#configure should allow to set' do
|
5
|
+
it 'id' do
|
6
|
+
AzureMediaService.configure do |config|
|
7
|
+
config.id = 'client_id'
|
8
|
+
end
|
9
|
+
|
10
|
+
expect(AzureMediaService.id).to eq('client_id')
|
11
|
+
end
|
12
|
+
|
13
|
+
it 'secret' do
|
14
|
+
AzureMediaService.configure do |config|
|
15
|
+
config.secret = 'client_secret'
|
16
|
+
end
|
17
|
+
|
18
|
+
expect(AzureMediaService.secret).to eq('client_secret')
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'token_uri' do
|
22
|
+
AzureMediaService.configure do |config|
|
23
|
+
config.token_uri = 'https://login.microsoft.com/tenant-id-goes-here/oauth2/token'
|
24
|
+
end
|
25
|
+
|
26
|
+
expect(AzureMediaService.token_uri).to eq('https://login.microsoft.com/tenant-id-goes-here/oauth2/token')
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'media_uri' do
|
30
|
+
AzureMediaService.configure do |config|
|
31
|
+
config.media_uri = 'https://media-service-name.restv2.westeurope.media.azure.net/api/'
|
32
|
+
end
|
33
|
+
|
34
|
+
expect(AzureMediaService.media_uri).to eq('https://media-service-name.restv2.westeurope.media.azure.net/api/')
|
35
|
+
end
|
36
|
+
|
37
|
+
it 'api_version' do
|
38
|
+
AzureMediaService.configure do |config|
|
39
|
+
config.api_version = '2.17'
|
40
|
+
end
|
41
|
+
|
42
|
+
expect(AzureMediaService.api_version).to eq('2.17')
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: azure_media_service
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- murayama
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-05-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -139,7 +139,7 @@ files:
|
|
139
139
|
- lib/azure_media_service/request.rb
|
140
140
|
- lib/azure_media_service/service.rb
|
141
141
|
- lib/azure_media_service/version.rb
|
142
|
-
- spec/
|
142
|
+
- spec/azure_media_service_spec.rb
|
143
143
|
- spec/spec_helper.rb
|
144
144
|
homepage: https://github.com/murayama/azure_media_service_ruby
|
145
145
|
licenses:
|
@@ -161,10 +161,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
161
161
|
version: '0'
|
162
162
|
requirements: []
|
163
163
|
rubyforge_project:
|
164
|
-
rubygems_version: 2.
|
164
|
+
rubygems_version: 2.6.14.1
|
165
165
|
signing_key:
|
166
166
|
specification_version: 4
|
167
167
|
summary: Azure Media Service SDK for ruby
|
168
168
|
test_files:
|
169
|
-
- spec/
|
169
|
+
- spec/azure_media_service_spec.rb
|
170
170
|
- spec/spec_helper.rb
|