wolfram_databin 0.1.4 → 0.1.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/Gemfile +1 -1
- data/Gemfile.lock +15 -9
- data/README.md +11 -6
- data/lib/wolfram_databin.rb +5 -0
- data/lib/wolfram_databin/base.rb +23 -6
- data/test/coverage/index.html +1 -1
- data/test/test_wolfram.rb +5 -0
- data/wolfram-databin.gemspec +15 -0
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: ac27eea9336639f507d152f84a3d2afcb1679b68519e26110036b515130ec874
|
4
|
+
data.tar.gz: 56d8707bb413fd65adba7a9ce433c6875fec980eb95b21fa4ecf28d6fb80a8a0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c6749c078472ab5ef937dc3ffd434e43bdad258ba9c864f86c3e18674ab36f8ff2af923127fa55f63a9753ea6e6cdef6e95c747588431449616c8ae3cf1b781e
|
7
|
+
data.tar.gz: 21d6e72cbe380d1876577ee0873dd7983d460bc9457bbb8b47fc2a3eacf3cd9f0c4033726d060f70c7cf1e284b8c6946498d8b0664e957a58e9800bb550c6009
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,22 +1,22 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
wolfram_databin (0.1.
|
4
|
+
wolfram_databin (0.1.8)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
8
8
|
specs:
|
9
|
-
codeclimate-test-reporter (0.
|
10
|
-
simplecov (
|
9
|
+
codeclimate-test-reporter (1.0.9)
|
10
|
+
simplecov (<= 0.13)
|
11
11
|
docile (1.1.5)
|
12
|
-
hurley (0.
|
13
|
-
json (
|
14
|
-
minitest (5.
|
15
|
-
simplecov (0.
|
12
|
+
hurley (0.2)
|
13
|
+
json (2.3.1)
|
14
|
+
minitest (5.14.1)
|
15
|
+
simplecov (0.13.0)
|
16
16
|
docile (~> 1.1.0)
|
17
|
-
json (
|
17
|
+
json (>= 1.8, < 3)
|
18
18
|
simplecov-html (~> 0.10.0)
|
19
|
-
simplecov-html (0.10.
|
19
|
+
simplecov-html (0.10.2)
|
20
20
|
|
21
21
|
PLATFORMS
|
22
22
|
ruby
|
@@ -26,3 +26,9 @@ DEPENDENCIES
|
|
26
26
|
hurley
|
27
27
|
minitest
|
28
28
|
wolfram_databin!
|
29
|
+
|
30
|
+
RUBY VERSION
|
31
|
+
ruby 2.6.6p146
|
32
|
+
|
33
|
+
BUNDLED WITH
|
34
|
+
1.17.3
|
data/README.md
CHANGED
@@ -4,13 +4,11 @@
|
|
4
4
|
Wolfram Databin
|
5
5
|
============
|
6
6
|
|
7
|
-
Post data to a wolfram databin. You can post just about any kind of string data to the databin. Just add more stuff to the query hash and send it. The bin id is merged with the query hash so no need to add the bin id to the query.
|
7
|
+
Post data to a wolfram databin. You can post just about any kind of string data to the databin. Just add more stuff to the query hash and send it. The query hash contains all your data. The bin id is merged with the query hash so no need to add the bin id to the query.
|
8
8
|
|
9
9
|
Note that Mathematica does not like underscores so they are converted to U like mathematica does for Java. This means that your query contents are converted from symbols to string but this has not impact on the data except that the key with an underscore now has a U in it. (eg if you send weekly_revenue it looks like weeklyUrevenue in the datadrop)
|
10
10
|
|
11
|
-
|
12
|
-
=======
|
13
|
-
http://wolfr.am/4PZWVcDT
|
11
|
+
|
14
12
|
|
15
13
|
Usage
|
16
14
|
=======
|
@@ -20,6 +18,13 @@ Usage
|
|
20
18
|
query= {time: Time.now}
|
21
19
|
res=@dbin.post_data(query)
|
22
20
|
|
23
|
-
|
21
|
+
Class usage
|
24
22
|
==============
|
25
|
-
|
23
|
+
WolframDatbin::Base contains all the code but a simple one class submission is available at WolframDatabin.submit_data(shortid, hash of data)
|
24
|
+
|
25
|
+
WolframDatbin.submit_data("4PZWVcDT",{time: Time.now})
|
26
|
+
WolframDatbin::Base.submit_data("4PZWVcDT",{time: Time.now})
|
27
|
+
|
28
|
+
Test URL
|
29
|
+
=======
|
30
|
+
http://wolfr.am/4PZWVcDT
|
data/lib/wolfram_databin.rb
CHANGED
@@ -1,7 +1,12 @@
|
|
1
1
|
$:.unshift(File.dirname(__FILE__)) unless
|
2
2
|
$:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
|
3
3
|
Dir[File.join(File.dirname(__FILE__), 'wolfram_databin/**/*.rb')].sort.each { |lib| require lib }
|
4
|
+
|
4
5
|
|
5
6
|
module WolframDatabin
|
6
7
|
VERSION = '0.0.1'
|
8
|
+
def self.submit_data(tshortid,aquery)
|
9
|
+
dbin=WolframDatabin::Base.new
|
10
|
+
dbin.submit_data(tshortid,aquery)
|
11
|
+
end
|
7
12
|
end
|
data/lib/wolfram_databin/base.rb
CHANGED
@@ -2,7 +2,7 @@ require 'rubygems'
|
|
2
2
|
require 'hurley'
|
3
3
|
module WolframDatabin
|
4
4
|
class Base
|
5
|
-
attr_accessor :shortid, :uri, :debug_flag
|
5
|
+
attr_accessor :shortid, :uri, :debug_flag, :clnt
|
6
6
|
|
7
7
|
def set_shortid(atid)
|
8
8
|
self.shortid=atid
|
@@ -20,8 +20,13 @@ module WolframDatabin
|
|
20
20
|
url="https://datadrop.wolframcloud.com/api/v1.0/Add?"
|
21
21
|
url
|
22
22
|
end
|
23
|
+
def get_url2
|
24
|
+
"https://datadrop.wolframcloud.com/api/v1.0"
|
25
|
+
end
|
23
26
|
def self.submit_data(tshortid,aquery)
|
24
27
|
dbin=WolframDatabin::Base.new
|
28
|
+
dbin.set_shortid(tshortid)
|
29
|
+
puts "WolframDatabin Gem: posting #{dbin.datadrop_url} with #{aquery.inspect} at #{Time.now}"
|
25
30
|
dbin.submit_data(tshortid,aquery)
|
26
31
|
end
|
27
32
|
def fix_query(query)
|
@@ -39,17 +44,29 @@ module WolframDatabin
|
|
39
44
|
res=self.post_data(aquery)
|
40
45
|
res
|
41
46
|
end
|
47
|
+
def build_client
|
48
|
+
if @clnt==nil then
|
49
|
+
# @clnt=HTTPClient.new
|
50
|
+
@clnt=Hurley::Client.new self.get_url2
|
51
|
+
end
|
52
|
+
@clnt
|
53
|
+
end
|
42
54
|
def post_data(query)
|
43
55
|
raise "short id not set" if self.shortid==nil
|
44
56
|
res=''
|
45
57
|
qdata={bin: self.shortid}.merge(self.fix_query(query))
|
46
58
|
begin
|
47
|
-
|
59
|
+
timeout=40
|
48
60
|
# @uri=URI.parse(self.get_url)
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
61
|
+
# c = Hurley::Client.new "https://datadrop.wolframcloud.com/api/v1.0"
|
62
|
+
# c.get "Add", :time => Time.now.iso8601, :fred => "hello"
|
63
|
+
# q=self.get_url + Hurley::Query::Flat.new(qdata).to_s
|
64
|
+
# puts "url #{q} query #{qdata}" if self.debug_flag
|
65
|
+
# res=Hurley.get(q)
|
66
|
+
@clnt=self.build_client
|
67
|
+
@clnt.request_options.timeout = timeout # set to 60
|
68
|
+
|
69
|
+
res=@clnt.get "Add", qdata
|
53
70
|
rescue Exception => e
|
54
71
|
puts "Exception: #{e.inspect}"
|
55
72
|
ensure
|
data/test/coverage/index.html
CHANGED
@@ -14,7 +14,7 @@
|
|
14
14
|
<img src="./assets/0.10.0/loading.gif" alt="loading"/>
|
15
15
|
</div>
|
16
16
|
<div id="wrapper" style="display:none;">
|
17
|
-
<div class="timestamp">Generated <abbr class="timeago" title="2015-
|
17
|
+
<div class="timestamp">Generated <abbr class="timeago" title="2015-09-06T09:12:11+08:00">2015-09-06T09:12:11+08:00</abbr></div>
|
18
18
|
<ul class="group_tabs"></ul>
|
19
19
|
|
20
20
|
<div id="content">
|
data/test/test_wolfram.rb
CHANGED
@@ -43,6 +43,11 @@ class WolframDatabinTest < Minitest::Test
|
|
43
43
|
res=@dbin.submit_data("4PZWVcDT",{submit_time: Time.now})
|
44
44
|
assert res[:success], "response should be success #{res} #{@dbin.datadrop_url}"
|
45
45
|
|
46
|
+
end
|
47
|
+
def test_toplevel_submit_classs
|
48
|
+
res = WolframDatabin.submit_data("4PZWVcDT",{submit_class: Time.now})
|
49
|
+
assert res[:success], "response should be success #{res} "
|
50
|
+
|
46
51
|
end
|
47
52
|
def test_submit_class
|
48
53
|
res = WolframDatabin::Base.submit_data("4PZWVcDT",{classubmittime: Time.now})
|
@@ -0,0 +1,15 @@
|
|
1
|
+
Gem::Specification.new do |s|
|
2
|
+
s.name = "wolfram_databin"
|
3
|
+
s.version = "0.1.9"
|
4
|
+
s.author = "Scott Sproule"
|
5
|
+
s.email = "scott.sproule@ficonab.com"
|
6
|
+
s.homepage = "http://github.com/semdinsp/wolfram_databin"
|
7
|
+
s.summary = "Wolfram databin access"
|
8
|
+
s.description = "Upload data to wolfram databin mathematica via ruby"
|
9
|
+
s.executables = ['wolfram.rb'] #should be "name.rb"
|
10
|
+
s.files = Dir["{lib,test}/**/*"] +Dir["bin/*.rb"] + Dir["[A-Z]*"] # + ["init.rb"]
|
11
|
+
s.require_path = "lib"
|
12
|
+
s.license = 'MIT'
|
13
|
+
s.rubyforge_project = s.name
|
14
|
+
s.required_rubygems_version = ">= 1.3.4"
|
15
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wolfram_databin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Scott Sproule
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-08-04 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Upload data to wolfram databin mathematica via ruby
|
14
14
|
email: scott.sproule@ficonab.com
|
@@ -114,11 +114,12 @@ files:
|
|
114
114
|
- test/coverage/index.html
|
115
115
|
- test/test_helper.rb
|
116
116
|
- test/test_wolfram.rb
|
117
|
+
- wolfram-databin.gemspec
|
117
118
|
homepage: http://github.com/semdinsp/wolfram_databin
|
118
119
|
licenses:
|
119
120
|
- MIT
|
120
121
|
metadata: {}
|
121
|
-
post_install_message:
|
122
|
+
post_install_message:
|
122
123
|
rdoc_options: []
|
123
124
|
require_paths:
|
124
125
|
- lib
|
@@ -133,9 +134,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
133
134
|
- !ruby/object:Gem::Version
|
134
135
|
version: 1.3.4
|
135
136
|
requirements: []
|
136
|
-
|
137
|
-
|
138
|
-
signing_key:
|
137
|
+
rubygems_version: 3.0.8
|
138
|
+
signing_key:
|
139
139
|
specification_version: 4
|
140
140
|
summary: Wolfram databin access
|
141
141
|
test_files: []
|