leftronicapi 1.3.2 → 1.3.3
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 +8 -8
- data/Rakefile +1 -1
- data/leftronicapi.gemspec +2 -2
- data/lib/leftronic.rb +29 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZmVmZWZkN2FjNDQ4MDdiNjUxMjAyZDJlYWIzNTU4Yjk1NjFiYjBlMQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
YTZiNDMzOGRjMmNiZTE1YmVlMjY4OWVmYjkwMWY5YjU2MmMwZDlmNA==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NzJlYzBhODA4NGQ5MzNiODMxNjYzNmQyMjk5MmE3MTJmMzMwZTA0ZTc4Njk4
|
10
|
+
MmM3ZmEzZDNiMDAxY2NlZTYyYjlkZmI3NmRlY2Y3M2UwZWM0ZTFjMzRkMTI5
|
11
|
+
ZDcxN2I0MmE0ZWNmYzg3MTRjNmVkYmViNjgzMmJiZWM2NGZhMjE=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
OTA1ZDdjYTI0OTZmNDRjMGNhNjc0ZmEwZWRjYmNkNmZmMThjZjQ0NzU4Mzgy
|
14
|
+
OGI3ZmFmZDZmZGY4Y2QwOTI3ZTc0OGEwZjcxMGY1MWVhZjI2NmJjYjkwYTA0
|
15
|
+
YzljZGI4ZGNmZGE3MjJiYmQ1OWI4YmUxYTYyNWM0NTVkN2I1MmQ=
|
data/Rakefile
CHANGED
@@ -20,7 +20,7 @@ Jeweler::Tasks.new do |gem|
|
|
20
20
|
gem.description = %Q{Provides a set of functions to update Leftronic dashboard widgets with custom data. Data is submitted by an HTTP POST request with data encoded in the JSON format.}
|
21
21
|
gem.email = "support@leftronic.com"
|
22
22
|
gem.authors = ["Leftronic"]
|
23
|
-
gem.version = '1.3.
|
23
|
+
gem.version = '1.3.3'
|
24
24
|
### dependencies defined in Gemfile
|
25
25
|
end
|
26
26
|
Jeweler::RubygemsDotOrgTasks.new
|
data/leftronicapi.gemspec
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = %q{leftronicapi}
|
3
|
-
s.version = "1.3.
|
3
|
+
s.version = "1.3.3"
|
4
4
|
|
5
5
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
6
6
|
s.authors = ["Leftronic"]
|
7
|
-
s.date = %q{2014-
|
7
|
+
s.date = %q{2014-06-02}
|
8
8
|
s.description = %q{Provides a set of functions to update Leftronic dashboard widgets with custom data. Data is submitted by an HTTP POST request with data encoded in the JSON format.}
|
9
9
|
s.email = %q{support@leftronic.com}
|
10
10
|
s.files = [
|
data/lib/leftronic.rb
CHANGED
@@ -62,6 +62,35 @@ class Leftronic
|
|
62
62
|
post stream, 'table' => data_rows
|
63
63
|
end
|
64
64
|
|
65
|
+
# Push an image url to an image widget
|
66
|
+
def push_image(stream, img_url)
|
67
|
+
post stream, 'imgUrl' => img_url
|
68
|
+
end
|
69
|
+
|
70
|
+
# Push to a label widget
|
71
|
+
def push_label(stream, label)
|
72
|
+
post stream, 'label' => label
|
73
|
+
end
|
74
|
+
|
75
|
+
# Push to an xy graph
|
76
|
+
def push_pair(stream, x, y)
|
77
|
+
if (x.class == Array) and (y.class == Array)
|
78
|
+
# Check that x and y are the same length
|
79
|
+
if x.length != y.length
|
80
|
+
raise 'Unequal array lengths.'
|
81
|
+
end
|
82
|
+
point = []
|
83
|
+
for i in 0..x.length - 1
|
84
|
+
point[i] = {'x' => x[i], 'y' => y[i]}
|
85
|
+
end
|
86
|
+
else
|
87
|
+
# Just push a single point
|
88
|
+
point = {'x' => x, 'y' => y}
|
89
|
+
end
|
90
|
+
post stream, point
|
91
|
+
end
|
92
|
+
|
93
|
+
# Clear a widget
|
65
94
|
def clear(stream)
|
66
95
|
post stream, 'clear', 'command'
|
67
96
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: leftronicapi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Leftronic
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-06-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: curb
|