wf4ever-transformation-client 0.3.1 → 0.4.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 +15 -0
- data/Gemfile +1 -1
- data/README.rdoc +25 -6
- data/Rakefile +3 -3
- data/VERSION +1 -1
- data/lib/wf4ever/transformation-client.rb +42 -6
- data/test/test_transformation-client.rb +36 -2
- data/wf4ever-transformation-client.gemspec +11 -10
- metadata +27 -22
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
ZGQ5NzNjN2M3ZDhlYTg0NjNmMDdmOTRjYmZiZmIyZTg0MjlmNmIxMQ==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
MTMxMjdjZTY3OWNkMzQyY2Q4ZjZmNjIyZTEwZGQ4YWVmYjkzNDU0OQ==
|
7
|
+
SHA512:
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
MjNhOTQ5YmVhM2E1YmI2MWFiZTllMmRhMGQxOGRlZjk2NDkyMTEwOWFjNTc4
|
10
|
+
MjM1ZjA1N2JkYTE1YTQ0Y2U4MmU3ODQ4NzViZTc1ZDc3NzE0MTg5NmY0ZmQ0
|
11
|
+
MjAyZDBjMzRmNDcwMWNmZjRiYjg0Zjg0N2JlMDFiZWYwOWQ0NDQ=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
ZjY0NzFiY2U2NzIwZWNhNGU3OTk2Y2U1YTEwNjA2ZmE1MDUxMGYzYjE0YjQ4
|
14
|
+
YTk0NmVmODU2ZjVlMjI0MGZlODNkOWFhOTFjYmVjOTAxMmJjNzA4NDMxMWYz
|
15
|
+
ZmE4ZjE3ZmZiN2JlMTVhNjMyMDA3OWQ5MzY1N2E5M2JhMjdmYTI=
|
data/Gemfile
CHANGED
data/README.rdoc
CHANGED
@@ -1,20 +1,39 @@
|
|
1
1
|
= transformation-client
|
2
2
|
|
3
|
-
|
3
|
+
This is a Ruby client library for submitting jobs to the
|
4
|
+
Wf4Ever wf-ro transformation service - for details, see
|
5
|
+
http://www.wf4ever-project.org/wiki/display/docs/Wf-RO+transformation+service+API
|
6
|
+
|
7
|
+
== Usage
|
4
8
|
Require the gem
|
5
9
|
require 'wf4ever/transformation-client'
|
6
10
|
|
7
11
|
To create a job:
|
8
|
-
|
12
|
+
service = "http://example.com/wf-ro/jobs"
|
13
|
+
resource = "http://example.net/workflow.t2flow"
|
14
|
+
format = "application/vnd.taverna.t2flow+xml"
|
15
|
+
ro = "http://example.com/RODL/RO/myResearch/"
|
16
|
+
token = "e5e02dd4-9e29-43f0-890c-729d66c46a9b"
|
17
|
+
|
18
|
+
job_uri = Wf4Ever::TransformationClient.create_job(service, resource, format, ro, token)
|
19
|
+
|
20
|
+
You can optionally provide a list of additional resources to extract to
|
21
|
+
which folders in the RO.
|
22
|
+
|
23
|
+
extract = { :nested => "http://example.com/RODL/RO/myResearch/folder1" }
|
24
|
+
job_uri = Wf4Ever::TransformationClient.create_job(service, resource, format, ro, token, extract)
|
9
25
|
|
10
26
|
To check the status of a job
|
11
|
-
status = Wf4Ever::TransformationClient.check_job(
|
27
|
+
status = Wf4Ever::TransformationClient.check_job(job_uri)["status"]
|
12
28
|
|
13
29
|
To cancel a job
|
14
|
-
Wf4Ever::TransformationClient.cancel_job(
|
30
|
+
Wf4Ever::TransformationClient.cancel_job(job_uri)
|
31
|
+
|
15
32
|
|
16
33
|
== Copyright
|
17
34
|
|
18
|
-
Copyright (c) 2012
|
19
|
-
|
35
|
+
Copyright (c) 2012-2013 University of Manchester.
|
36
|
+
|
37
|
+
This software is freely available under the MIT License. See LICENSE.txt
|
38
|
+
for further details.
|
20
39
|
|
data/Rakefile
CHANGED
@@ -15,12 +15,12 @@ require 'jeweler'
|
|
15
15
|
Jeweler::Tasks.new do |gem|
|
16
16
|
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
17
17
|
gem.name = "wf4ever-transformation-client"
|
18
|
-
gem.homepage = "http://github.com/
|
18
|
+
gem.homepage = "http://github.com/myExperiment/transformation-client"
|
19
19
|
gem.license = "MIT"
|
20
20
|
gem.summary = "Client to interact with Wf4ever's RO Transformation Service"
|
21
21
|
gem.description = "Client to interact with Wf4ever's RO Transformation Service"
|
22
|
-
gem.email = "
|
23
|
-
gem.authors = ["Finn Bacall"]
|
22
|
+
gem.email = "bugs@myexperiment.org"
|
23
|
+
gem.authors = ["Finn Bacall", "Stian Soiland-Reyes"]
|
24
24
|
# dependencies defined in Gemfile
|
25
25
|
end
|
26
26
|
Jeweler::RubygemsDotOrgTasks.new
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.4.0
|
@@ -5,18 +5,51 @@ module Wf4Ever
|
|
5
5
|
class TransformationClient
|
6
6
|
|
7
7
|
##
|
8
|
-
#
|
9
|
-
|
8
|
+
# Create a transformation job and returns its URI, which can be
|
9
|
+
# used with check_job() and cancel_job()
|
10
|
+
#
|
11
|
+
# uri -- The URI for the wf-ro service endpoint, e.g.
|
12
|
+
# "http://example.com/wf-ro/jobs"
|
13
|
+
# resource - The URI for the workflow resource to transform, e.g.
|
14
|
+
# "http://www.example.net/workflow.t2flow"
|
15
|
+
# format - the media type of the resource, e.g.
|
16
|
+
# "application/vnd.taverna.t2flow+xml"
|
17
|
+
# ro - the URI for the research object within an RODL service,
|
18
|
+
# where the transformed and extracted resources are to be uploaded
|
19
|
+
# token - token for authenticating access to the RODL
|
20
|
+
# extract -
|
21
|
+
# (optional) hash of folders where to extract additional
|
22
|
+
# resources. The main workflow is always extracted, but will
|
23
|
+
# only be placed into a folder if it is given in the hash. Other
|
24
|
+
# resource types are only extracted if listed in the map.
|
25
|
+
#
|
26
|
+
# The extract keys should be one of:
|
27
|
+
# - :main -- transformed workflow
|
28
|
+
# - :nested -- nested workflows
|
29
|
+
# - :scripts -- embedded scripts (e.g. beanshell, R)
|
30
|
+
# - :services -- external services (e.g. WSDL, REST)
|
31
|
+
#
|
32
|
+
# The extract values are URIs to RODL folders within the RO where to
|
33
|
+
# extract the resource. A value using the keyword :ro means to
|
34
|
+
# extract the particular resource without aggregating it in any
|
35
|
+
# particular folder.
|
36
|
+
def self.create_job(uri, resource, format, ro, token, extract={:main=>:ro})
|
10
37
|
uri = URI(uri)
|
11
38
|
job_uri = nil
|
39
|
+
## Replace :ro with the ro URI as per wf-ro REST API
|
40
|
+
# We'll do this in a new hash to not modify our incoming hash
|
41
|
+
# TODO: Avoid Perl-like syntax below..
|
42
|
+
extract = extract.each_with_object({}) { |(k,v), h| h[k] = v==:ro ? ro : v }
|
43
|
+
|
12
44
|
Net::HTTP.start(uri.host, uri.port || 80) do |http|
|
13
45
|
body = {
|
14
46
|
"resource" => resource,
|
15
47
|
"format" => format,
|
16
48
|
"ro" => ro,
|
17
|
-
"token" => token
|
49
|
+
"token" => token,
|
50
|
+
"extract" => extract
|
18
51
|
}.to_json
|
19
|
-
|
52
|
+
|
20
53
|
headers = {"content-type" => "application/json"}
|
21
54
|
|
22
55
|
response = http.post(uri.request_uri, body, headers)
|
@@ -31,11 +64,14 @@ module Wf4Ever
|
|
31
64
|
end
|
32
65
|
|
33
66
|
##
|
34
|
-
#
|
67
|
+
# Check wf-ro transformation job status.
|
68
|
+
#
|
69
|
+
# Return a hash containing:
|
35
70
|
# ["resource"] the resource being transformed
|
36
71
|
# ["format"] the content type of the resource
|
37
72
|
# ["ro"] the URI of the RO being created
|
38
73
|
# ["status"] the status of the transformation job
|
74
|
+
# ["extract"] the resource type to extract, to which folder
|
39
75
|
def self.check_job(uri)
|
40
76
|
uri = URI(uri)
|
41
77
|
Net::HTTP.start(uri.host, uri.port || 80) do |http|
|
@@ -52,7 +88,7 @@ module Wf4Ever
|
|
52
88
|
end
|
53
89
|
|
54
90
|
##
|
55
|
-
#
|
91
|
+
# Cancel wf-ro transformation job and returns true if it succeeds.
|
56
92
|
def self.cancel_job(uri)
|
57
93
|
uri = URI(uri)
|
58
94
|
Net::HTTP.start(uri.host, uri.port || 80) do |http|
|
@@ -9,8 +9,42 @@ class TestTransformationClient < Test::Unit::TestCase
|
|
9
9
|
RO = "http://sandbox.wf4ever-project.org/rodl/ROs/FinnsTest/"
|
10
10
|
|
11
11
|
def test_can_create
|
12
|
-
uri = Wf4Ever::TransformationClient.create_job(SERVICE_URI, RESOURCE, T2FLOW_FORMAT, RO, OAUTH_TOKEN)
|
13
|
-
assert_not_nil uri
|
12
|
+
@uri = Wf4Ever::TransformationClient.create_job(SERVICE_URI, RESOURCE, T2FLOW_FORMAT, RO, OAUTH_TOKEN)
|
13
|
+
assert_not_nil @uri
|
14
|
+
status = Wf4Ever::TransformationClient.check_job(@uri)
|
15
|
+
#puts status
|
16
|
+
assert_equal(RESOURCE, status["resource"])
|
17
|
+
assert_equal(T2FLOW_FORMAT, status["format"])
|
18
|
+
assert_equal(RO, status["ro"])
|
19
|
+
# :ro default should become 'main'
|
20
|
+
assert_equal(RO, status["extract"]["main"])
|
21
|
+
## The remaining folders should not be listed
|
22
|
+
assert_nil(status["extract"]["nested"])
|
23
|
+
assert_nil(status["extract"]["scripts"])
|
24
|
+
assert_nil(status["extract"]["services"])
|
25
|
+
end
|
26
|
+
|
27
|
+
def setup
|
28
|
+
@uri = nil
|
29
|
+
end
|
30
|
+
|
31
|
+
def teardown
|
32
|
+
Wf4Ever::TransformationClient.cancel_job(@uri) if @uri
|
33
|
+
end
|
34
|
+
|
35
|
+
def test_with_extract
|
36
|
+
extract = {:nested => RO + "folderNested", :scripts => :ro, :main => RO + "folderMain"}
|
37
|
+
@uri = Wf4Ever::TransformationClient.create_job(SERVICE_URI, RESOURCE, T2FLOW_FORMAT, RO, OAUTH_TOKEN, extract)
|
38
|
+
assert_not_nil @uri
|
39
|
+
status = Wf4Ever::TransformationClient.check_job(@uri)
|
40
|
+
# puts status
|
41
|
+
assert_equal(RESOURCE, status["resource"])
|
42
|
+
assert_equal(T2FLOW_FORMAT, status["format"])
|
43
|
+
assert_equal(RO, status["ro"])
|
44
|
+
assert_equal(RO + "folderMain", status["extract"]["main"])
|
45
|
+
assert_equal(RO + "folderNested", status["extract"]["nested"])
|
46
|
+
assert_equal(RO, status["extract"]["scripts"])
|
47
|
+
assert_nil(status["extract"]["services"])
|
14
48
|
end
|
15
49
|
|
16
50
|
end
|
@@ -2,16 +2,17 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
+
# stub: wf4ever-transformation-client 0.4.0 ruby lib
|
5
6
|
|
6
7
|
Gem::Specification.new do |s|
|
7
8
|
s.name = "wf4ever-transformation-client"
|
8
|
-
s.version = "0.
|
9
|
+
s.version = "0.4.0"
|
9
10
|
|
10
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
-
s.authors = ["Finn Bacall"]
|
12
|
-
s.date = "
|
12
|
+
s.authors = ["Finn Bacall", "Stian Soiland-Reyes"]
|
13
|
+
s.date = "2013-12-20"
|
13
14
|
s.description = "Client to interact with Wf4ever's RO Transformation Service"
|
14
|
-
s.email = "
|
15
|
+
s.email = "bugs@myexperiment.org"
|
15
16
|
s.extra_rdoc_files = [
|
16
17
|
"LICENSE.txt",
|
17
18
|
"README.rdoc"
|
@@ -29,27 +30,27 @@ Gem::Specification.new do |s|
|
|
29
30
|
"test/test_transformation-client.rb",
|
30
31
|
"wf4ever-transformation-client.gemspec"
|
31
32
|
]
|
32
|
-
s.homepage = "http://github.com/
|
33
|
+
s.homepage = "http://github.com/myExperiment/transformation-client"
|
33
34
|
s.licenses = ["MIT"]
|
34
35
|
s.require_paths = ["lib"]
|
35
|
-
s.rubygems_version = "1.
|
36
|
+
s.rubygems_version = "2.1.11"
|
36
37
|
s.summary = "Client to interact with Wf4ever's RO Transformation Service"
|
37
38
|
|
38
39
|
if s.respond_to? :specification_version then
|
39
|
-
s.specification_version =
|
40
|
+
s.specification_version = 4
|
40
41
|
|
41
42
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
42
43
|
s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
|
43
|
-
s.add_development_dependency(%q<bundler>, ["~> 1.1
|
44
|
+
s.add_development_dependency(%q<bundler>, ["~> 1.1"])
|
44
45
|
s.add_development_dependency(%q<jeweler>, ["~> 1.8.4"])
|
45
46
|
else
|
46
47
|
s.add_dependency(%q<rdoc>, ["~> 3.12"])
|
47
|
-
s.add_dependency(%q<bundler>, ["~> 1.1
|
48
|
+
s.add_dependency(%q<bundler>, ["~> 1.1"])
|
48
49
|
s.add_dependency(%q<jeweler>, ["~> 1.8.4"])
|
49
50
|
end
|
50
51
|
else
|
51
52
|
s.add_dependency(%q<rdoc>, ["~> 3.12"])
|
52
|
-
s.add_dependency(%q<bundler>, ["~> 1.1
|
53
|
+
s.add_dependency(%q<bundler>, ["~> 1.1"])
|
53
54
|
s.add_dependency(%q<jeweler>, ["~> 1.8.4"])
|
54
55
|
end
|
55
56
|
end
|
metadata
CHANGED
@@ -1,51 +1,60 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wf4ever-transformation-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.4.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Finn Bacall
|
8
|
+
- Stian Soiland-Reyes
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-12-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rdoc
|
16
|
-
requirement:
|
17
|
-
none: false
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
18
17
|
requirements:
|
19
18
|
- - ~>
|
20
19
|
- !ruby/object:Gem::Version
|
21
20
|
version: '3.12'
|
22
21
|
type: :development
|
23
22
|
prerelease: false
|
24
|
-
version_requirements:
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - ~>
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: '3.12'
|
25
28
|
- !ruby/object:Gem::Dependency
|
26
29
|
name: bundler
|
27
|
-
requirement:
|
28
|
-
none: false
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
29
31
|
requirements:
|
30
32
|
- - ~>
|
31
33
|
- !ruby/object:Gem::Version
|
32
|
-
version: 1.1
|
34
|
+
version: '1.1'
|
33
35
|
type: :development
|
34
36
|
prerelease: false
|
35
|
-
version_requirements:
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - ~>
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '1.1'
|
36
42
|
- !ruby/object:Gem::Dependency
|
37
43
|
name: jeweler
|
38
|
-
requirement:
|
39
|
-
none: false
|
44
|
+
requirement: !ruby/object:Gem::Requirement
|
40
45
|
requirements:
|
41
46
|
- - ~>
|
42
47
|
- !ruby/object:Gem::Version
|
43
48
|
version: 1.8.4
|
44
49
|
type: :development
|
45
50
|
prerelease: false
|
46
|
-
version_requirements:
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - ~>
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: 1.8.4
|
47
56
|
description: Client to interact with Wf4ever's RO Transformation Service
|
48
|
-
email:
|
57
|
+
email: bugs@myexperiment.org
|
49
58
|
executables: []
|
50
59
|
extensions: []
|
51
60
|
extra_rdoc_files:
|
@@ -63,32 +72,28 @@ files:
|
|
63
72
|
- test/helper.rb
|
64
73
|
- test/test_transformation-client.rb
|
65
74
|
- wf4ever-transformation-client.gemspec
|
66
|
-
homepage: http://github.com/
|
75
|
+
homepage: http://github.com/myExperiment/transformation-client
|
67
76
|
licenses:
|
68
77
|
- MIT
|
78
|
+
metadata: {}
|
69
79
|
post_install_message:
|
70
80
|
rdoc_options: []
|
71
81
|
require_paths:
|
72
82
|
- lib
|
73
83
|
required_ruby_version: !ruby/object:Gem::Requirement
|
74
|
-
none: false
|
75
84
|
requirements:
|
76
85
|
- - ! '>='
|
77
86
|
- !ruby/object:Gem::Version
|
78
87
|
version: '0'
|
79
|
-
segments:
|
80
|
-
- 0
|
81
|
-
hash: 4569034392740922883
|
82
88
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
83
|
-
none: false
|
84
89
|
requirements:
|
85
90
|
- - ! '>='
|
86
91
|
- !ruby/object:Gem::Version
|
87
92
|
version: '0'
|
88
93
|
requirements: []
|
89
94
|
rubyforge_project:
|
90
|
-
rubygems_version: 1.
|
95
|
+
rubygems_version: 2.1.11
|
91
96
|
signing_key:
|
92
|
-
specification_version:
|
97
|
+
specification_version: 4
|
93
98
|
summary: Client to interact with Wf4ever's RO Transformation Service
|
94
99
|
test_files: []
|