leftronicapi 1.3.1 → 1.3.2
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 +1 -1
- data/lib/leftronic.rb +8 -4
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MDdlYWY3MzVjYmU0ODRlMDg5NDZlNDJjMTBmMGY3NzRiZjczYWU2ZQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZWUyZGIzOGE1YmJmN2FiNWZhYjc3MTk1MjNkZGNhOGRiMzI5MDg5ZQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ODM0NDliMDgyYWU4YzZjN2MyYjQwMTI3ZWE2MDM0ZjBkM2I0M2JkMWUyMjIw
|
10
|
+
N2ViMjgzMTZmZmNlN2M3ZDY4OTNjODA2YzE0MGRjNWM5Y2M1MmYxNDJiMDk2
|
11
|
+
YWNiODE0YzViNmI3NGUxNzFiZGY1MDA2ZTA4MDhlYzQ2ZDg2YjM=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
M2YyYzkzZGZlMGEwZDVlMzdlZTkzZmRjYWI1ODEzZTJjNTY1ZWFjZWE5ZmU3
|
14
|
+
NGFhNzI5NjU1MmUwZDFlMmNjMWI3YmE5Y2NjZGM0YWE0MzA2OWQxNzlkMzIw
|
15
|
+
NTVhZWMyM2QzZGEyZDE5NTdhM2JjYmNjZDZjZTA5MTJiN2JhY2M=
|
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.2'
|
24
24
|
### dependencies defined in Gemfile
|
25
25
|
end
|
26
26
|
Jeweler::RubygemsDotOrgTasks.new
|
data/leftronicapi.gemspec
CHANGED
data/lib/leftronic.rb
CHANGED
@@ -62,23 +62,27 @@ class Leftronic
|
|
62
62
|
post stream, 'table' => data_rows
|
63
63
|
end
|
64
64
|
|
65
|
+
def clear(stream)
|
66
|
+
post stream, 'clear', 'command'
|
67
|
+
end
|
68
|
+
|
65
69
|
protected
|
66
70
|
|
67
|
-
def post(stream, params)
|
68
|
-
request = build_request(stream, params)
|
71
|
+
def post(stream, params, type='point')
|
72
|
+
request = build_request(stream, params, type)
|
69
73
|
connection = build_connection
|
70
74
|
connection.start{|http| http.request request}
|
71
75
|
params
|
72
76
|
end
|
73
77
|
|
74
|
-
def build_request(stream, params)
|
78
|
+
def build_request(stream, params, type)
|
75
79
|
request = Net::HTTP::Post.new @url.request_uri
|
76
80
|
request['Accept'] = 'application/json'
|
77
81
|
request['Content-Type'] = 'application/json'
|
78
82
|
request.body = {
|
79
83
|
'accessKey' => @key,
|
80
84
|
'streamName' => stream,
|
81
|
-
|
85
|
+
type => params
|
82
86
|
}.to_json
|
83
87
|
request
|
84
88
|
end
|