matterhorn_whymper 1.0.6 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
YWFhZWEwMGU0NzA2ZmNlMTJlNzA5Y2EyZmRiZWM4ZDY2MGEyODI3OA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZDcyYThhMzQwMzg5OGEyYTIwZTMxNDYzMjk5NzU1ZGI0ZmNmOWQ0Mw==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NGU0NThiMWRlNmU1NzNkZjI5NDY1MmY5ZTc3MGY3MDI2MzBhZjQ2NmNhYjQx
|
10
|
+
OTczMzMwYjZjZWJhNzRkMWMzNTk1YmNlMmY3NmEwNGM2ODkxNDIxMWE5NTVh
|
11
|
+
MjI3MGViYzgwYzIzYzRhM2RkOGE4MDA5MDRmZmUzN2U1NTk5MWY=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MzgxMzhiM2JiNDg5ZWM5ZTAzYjVkZDdjOWQ1MGZmZGFiNmU3ZWMyODE0NzI1
|
14
|
+
MDU1NGNjYWU0MjI5NmY1NDI0ZTY3MTIxNDQ0ODVhMWVmYjM0ZGZjY2Y2N2M5
|
15
|
+
OGQwODE4NDYzMzhlMmU2Y2I1ZmY5YjJmMDU0MjMyZjU2YzE4ZDY=
|
@@ -16,22 +16,25 @@ module Matterhorn
|
|
16
16
|
|
17
17
|
def initialize(protocol, domain, org_domain, user, password, auth_mode,
|
18
18
|
http_timeout = nil, ssl_dont_verify_cert = false, multi_tenant = true)
|
19
|
-
@
|
20
|
-
@uri
|
19
|
+
@multi_tenant = multi_tenant
|
20
|
+
@uri = if @multi_tenant
|
21
|
+
URI.parse("#{protocol}://#{org_domain.gsub(/\./, '-')}.#{domain}")
|
22
|
+
else
|
23
|
+
URI.parse("#{protocol}://#{domain}")
|
24
|
+
end
|
21
25
|
@uri.user = user
|
22
26
|
@uri.password = password
|
23
27
|
@auth_mode = auth_mode
|
24
28
|
@ssl = @uri.port == 443 ? true : false
|
25
29
|
@timeout = http_timeout
|
26
30
|
@ssl_dont_verify_cert = ssl_dont_verify_cert
|
27
|
-
@multi_tenant = multi_tenant
|
28
31
|
end
|
29
32
|
|
30
33
|
|
31
34
|
# ---------------------------------------------------------------------------- http methodes ---
|
32
35
|
|
33
36
|
def get(url)
|
34
|
-
request = Net::HTTP::Get.new(
|
37
|
+
request = Net::HTTP::Get.new(@uri.request_uri + url)
|
35
38
|
execute_request(request)
|
36
39
|
end
|
37
40
|
|
@@ -47,14 +50,14 @@ module Matterhorn
|
|
47
50
|
|
48
51
|
|
49
52
|
def put(url, params = {})
|
50
|
-
request = Net::HTTP::Put.new(
|
53
|
+
request = Net::HTTP::Put.new(@uri.request_uri + url)
|
51
54
|
request.set_form_data(params)
|
52
55
|
execute_request(request)
|
53
56
|
end
|
54
57
|
|
55
58
|
|
56
59
|
def delete(url)
|
57
|
-
request = Net::HTTP::Delete.new(
|
60
|
+
request = Net::HTTP::Delete.new(@uri.request_uri + url)
|
58
61
|
execute_request(request)
|
59
62
|
end
|
60
63
|
|
@@ -80,17 +83,8 @@ module Matterhorn
|
|
80
83
|
end
|
81
84
|
|
82
85
|
|
83
|
-
def assemble_url(url)
|
84
|
-
if @multi_tenant && !@sub_domain.empty?
|
85
|
-
@uri.request_uri + "#{@sub_domain}/" + url
|
86
|
-
else
|
87
|
-
@uri.request_uri + url
|
88
|
-
end
|
89
|
-
end
|
90
|
-
|
91
|
-
|
92
86
|
def singlepart_post(url, params)
|
93
|
-
request = Net::HTTP::Post.new(
|
87
|
+
request = Net::HTTP::Post.new(@uri.request_uri + url)
|
94
88
|
request.set_form_data(params)
|
95
89
|
request
|
96
90
|
end
|
@@ -118,7 +112,7 @@ module Matterhorn
|
|
118
112
|
mime_type = MIME::Types.type_for(File.basename(file.path)).first
|
119
113
|
end
|
120
114
|
params['BODY'] = UploadIO.new(file, mime_type, filename)
|
121
|
-
Net::HTTP::Post::Multipart.new(
|
115
|
+
Net::HTTP::Post::Multipart.new(@uri.request_uri + url, params)
|
122
116
|
end
|
123
117
|
|
124
118
|
|
@@ -5,7 +5,7 @@ module MatterhornWhymper
|
|
5
5
|
|
6
6
|
# -------------------------------------------------------------------------- const definitions ---
|
7
7
|
|
8
|
-
VERSION = "1.0
|
8
|
+
VERSION = "1.1.0"
|
9
9
|
|
10
10
|
|
11
11
|
end # -------------------------------------------------------------------- end MatterhornWhymper ---
|
data/spec/matterhorn.yml.sample
CHANGED
@@ -2,7 +2,7 @@ test:
|
|
2
2
|
p1:
|
3
3
|
endpoint:
|
4
4
|
protocol: https
|
5
|
-
domain: cast-
|
5
|
+
domain: admin.cast-test.switch.ch
|
6
6
|
user: <user>
|
7
7
|
password: <password>
|
8
8
|
auth_mode: digest
|
@@ -11,7 +11,7 @@ test:
|
|
11
11
|
p2:
|
12
12
|
endpoint:
|
13
13
|
protocol: https
|
14
|
-
domain: cast-
|
14
|
+
domain: producer.cast-test.switch.ch
|
15
15
|
user: <user>
|
16
16
|
password: <password>
|
17
17
|
auth_mode: digest
|
@@ -19,11 +19,10 @@ test:
|
|
19
19
|
multi_tenant: true
|
20
20
|
api:
|
21
21
|
protocol: https
|
22
|
-
domain:
|
22
|
+
domain: api-ng.cast-test.switch.ch
|
23
23
|
user: <user>
|
24
24
|
password: <password>
|
25
25
|
auth_mode: basic
|
26
26
|
ssl_dont_verify_cert: true
|
27
27
|
multi_tenant: true
|
28
28
|
default: p2
|
29
|
-
|
@@ -6,7 +6,7 @@ if endpoint_configured?
|
|
6
6
|
include Support::RemoteHelpers
|
7
7
|
|
8
8
|
it "creates a mediapackage" do
|
9
|
-
Matterhorn::Endpoint.open(:ingest) do |ingest_endpoint|
|
9
|
+
Matterhorn::Endpoint.open(:ingest, nil, :p1) do |ingest_endpoint|
|
10
10
|
ingest_endpoint.createMediaPackage()
|
11
11
|
mp_local = ingest_endpoint.media_package
|
12
12
|
mp_remote = ingest_endpoint.media_package('remote')
|
@@ -4,7 +4,7 @@ require 'tempfile'
|
|
4
4
|
describe Matterhorn::Endpoint::Series do
|
5
5
|
before do
|
6
6
|
@series = Matterhorn::Endpoint::create(:series, 'enil.ch')
|
7
|
-
stub_request(:head, %r
|
7
|
+
stub_request(:head, %r()).to_return(status: 200, body: '', headers: { 'WWW-Authenticate' => 'Basic realm="Matterhorn"' })
|
8
8
|
end
|
9
9
|
|
10
10
|
after do
|
@@ -14,7 +14,7 @@ describe Matterhorn::Endpoint::Series do
|
|
14
14
|
|
15
15
|
it "reads a Dublin Core document for a series" do
|
16
16
|
series_id = SecureRandom.uuid
|
17
|
-
stub_request(:get, %r(
|
17
|
+
stub_request(:get, %r(https://enil-ch.producer.cast-test.switch.ch/series/#{series_id}.xml)).to_return(status: 200, body: file_fixture_contents('series_dublin_core.xml'))
|
18
18
|
|
19
19
|
dublin_core = @series.read(series_id)
|
20
20
|
expect(dublin_core.dcterms_title).to eq('Space is Awesome')
|
@@ -22,7 +22,7 @@ describe Matterhorn::Endpoint::Series do
|
|
22
22
|
|
23
23
|
it "returns an error when reading a Dublin Core document for a non-existent series" do
|
24
24
|
series_id = SecureRandom.uuid
|
25
|
-
stub_request(:get, %r(
|
25
|
+
stub_request(:get, %r(https://enil-ch.producer.cast-test.switch.ch/series/#{series_id}.xml)).to_return(status: 404, body: '')
|
26
26
|
|
27
27
|
dublin_core = @series.read(series_id)
|
28
28
|
expect(dublin_core).to be_nil
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: matterhorn_whymper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Fritschi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-07-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: multipart-post
|