qm 1.1.15 → 1.1.16
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/lib/client.rb +75 -0
- data/lib/qm.rb +2 -2
- metadata +10 -23
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e8767b7a746dcce46419e987f4255affd477f5f8
|
4
|
+
data.tar.gz: 6a8f6cd3f61b501b762e1867558764265ab247c3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c57bec0075070a637469e0b7aaed349f157d74fca61190b094971a86404abaf86ad5ad96de6220e81b06da1c9d4a35f820617d816e2bfa21f1e0b1c605b94090
|
7
|
+
data.tar.gz: 2c5e9797a9046d51fd03afd1fbee912f1f6785302c497496d4aa7fec493494bb14ce7a132c73f2ac83475e75b90db4cf96ff6174a581f6d9f226d34c8e9e8b8c
|
data/lib/client.rb
ADDED
@@ -0,0 +1,75 @@
|
|
1
|
+
#- Ruby source code
|
2
|
+
|
3
|
+
#- client.rb ~~
|
4
|
+
#
|
5
|
+
# Currently, this contains simple functions that are useful for constructing
|
6
|
+
# a Ruby client, but which by themselves are still slightly too low-level to
|
7
|
+
# be convenient. They are modeled after the browser (JS) and R clients.
|
8
|
+
#
|
9
|
+
# One idea for the future is to embed one JS execution context in each
|
10
|
+
# `QMachineClient` object and then to load the latest browser client inside.
|
11
|
+
# Obviously, that won't coordinate *arbitrary* code -- or even Ruby code --
|
12
|
+
# but it will save me from rewriting a client completely from scratch because
|
13
|
+
# it is possible to add functions and objects to the JS context which are
|
14
|
+
# implemented in Ruby. Thus, instead of writing a client in Ruby that will
|
15
|
+
# act like the browser client, the idea is to make Ruby act like a browser so
|
16
|
+
# I can reuse the browser client ...
|
17
|
+
#
|
18
|
+
# ~~ (c) SRW, 20 Jul 2014
|
19
|
+
# ~~ last updated 17 Nov 2014
|
20
|
+
|
21
|
+
require 'httparty'
|
22
|
+
require 'json'
|
23
|
+
|
24
|
+
class QMachineClient
|
25
|
+
|
26
|
+
include HTTParty
|
27
|
+
|
28
|
+
def initialize(options = {mothership: 'https://api.qmachine.org'})
|
29
|
+
# This method runs when Ruby calls `QMachineClient.new`.
|
30
|
+
@ms = options[:mothership]
|
31
|
+
return
|
32
|
+
end
|
33
|
+
|
34
|
+
def get_avar(opts = {})
|
35
|
+
# This method needs documentation.
|
36
|
+
res = self.class.get("#{@ms}/box/#{opts[:box]}?key=#{opts[:key]}")
|
37
|
+
if (res.code != 200) then
|
38
|
+
raise "Error: #{res.code}"
|
39
|
+
end
|
40
|
+
return JSON.parse(res.body)
|
41
|
+
end
|
42
|
+
|
43
|
+
def get_list(opts = {})
|
44
|
+
# This method needs documentation.
|
45
|
+
res = self.class.get("#{@ms}/box/#{opts[:box]}?status=#{opts[:status]}")
|
46
|
+
if (res.code != 200) then
|
47
|
+
raise "Error: #{res.code}"
|
48
|
+
end
|
49
|
+
return JSON.parse(res.body)
|
50
|
+
end
|
51
|
+
|
52
|
+
def set_avar(opts = {})
|
53
|
+
# This method needs documentation.
|
54
|
+
res = self.class.post("#{@ms}/box/#{opts[:box]}?key=#{opts[:key]}", {
|
55
|
+
body: opts.to_json,
|
56
|
+
headers: {'Content-Type' => 'application/json'}
|
57
|
+
})
|
58
|
+
if (res.code != 201) then
|
59
|
+
raise "Error: #{res.code}"
|
60
|
+
end
|
61
|
+
return res.body
|
62
|
+
end
|
63
|
+
|
64
|
+
def uuid()
|
65
|
+
# This method needs documentation.
|
66
|
+
y = ''
|
67
|
+
while (y.length < 32) do
|
68
|
+
y += rand.to_s[/[0-9]+(?!.)/].to_i.to_s(16)
|
69
|
+
end
|
70
|
+
return y.slice(0, 32)
|
71
|
+
end
|
72
|
+
|
73
|
+
end
|
74
|
+
|
75
|
+
#- vim:set syntax=ruby:
|
data/lib/qm.rb
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
|
3
3
|
#- qm.rb ~~
|
4
4
|
# ~~ (c) SRW, 12 Apr 2013
|
5
|
-
# ~~ last updated
|
5
|
+
# ~~ last updated 17 Nov 2014
|
6
6
|
|
7
7
|
module QM
|
8
8
|
|
9
|
-
def self::launch_client(options = {})
|
9
|
+
def self::launch_client(options = {mothership: 'https://api.qmachine.org'})
|
10
10
|
# This function needs documentation.
|
11
11
|
require 'client'
|
12
12
|
return QMachineClient.new(options)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: qm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.16
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sean Wilkinson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-11-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bson_ext
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 1.
|
19
|
+
version: 1.11.1
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 1.
|
26
|
+
version: 1.11.1
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: json
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -44,28 +44,28 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - '='
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 0.13.
|
47
|
+
version: 0.13.3
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - '='
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 0.13.
|
54
|
+
version: 0.13.3
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: mongo
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - '='
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 1.
|
61
|
+
version: 1.11.1
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - '='
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 1.
|
68
|
+
version: 1.11.1
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: sinatra
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -94,20 +94,6 @@ dependencies:
|
|
94
94
|
- - '='
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: 0.3.2
|
97
|
-
- !ruby/object:Gem::Dependency
|
98
|
-
name: therubyracer
|
99
|
-
requirement: !ruby/object:Gem::Requirement
|
100
|
-
requirements:
|
101
|
-
- - '='
|
102
|
-
- !ruby/object:Gem::Version
|
103
|
-
version: 0.12.1
|
104
|
-
type: :runtime
|
105
|
-
prerelease: false
|
106
|
-
version_requirements: !ruby/object:Gem::Requirement
|
107
|
-
requirements:
|
108
|
-
- - '='
|
109
|
-
- !ruby/object:Gem::Version
|
110
|
-
version: 0.12.1
|
111
97
|
description: This is a port of the QMachine web service.
|
112
98
|
email: sean@mathbiol.org
|
113
99
|
executables: []
|
@@ -118,6 +104,7 @@ extra_rdoc_files:
|
|
118
104
|
files:
|
119
105
|
- LICENSE
|
120
106
|
- README.md
|
107
|
+
- lib/client.rb
|
121
108
|
- lib/defs-mongo.rb
|
122
109
|
- lib/qm.rb
|
123
110
|
- lib/service.rb
|
@@ -142,7 +129,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
142
129
|
version: '0'
|
143
130
|
requirements: []
|
144
131
|
rubyforge_project:
|
145
|
-
rubygems_version: 2.4.
|
132
|
+
rubygems_version: 2.4.4
|
146
133
|
signing_key:
|
147
134
|
specification_version: 4
|
148
135
|
summary: 'QMachine: A platform for World Wide Computing'
|