m2x 0.1.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/m2x/version.rb +1 -1
- data/lib/megatest.rb +52 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5ec355421314977e15e2c05ae0eb1efc9d0177d4
|
4
|
+
data.tar.gz: ed401f222ce4c00a41e2d347a1fcafb268a2d433
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f1e7b7bac788b62e4868e16073d048bb104e64984c1fbe08df3d1e47fccd2b01482a10f67b096b7dacfa9e37644a6031ec3d1750af88eda41e61d273d5289815
|
7
|
+
data.tar.gz: cdde61bc4b9f577c5d9bbaf85f6ebfd079f158c3bbbc75e8caeb9305837d536d4e9ada1715100332d59dcafd87ca8e59c82f7cd90bebd20d7e3f40f1c521c658
|
data/lib/m2x/version.rb
CHANGED
data/lib/megatest.rb
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "time"
|
4
|
+
require "pp"
|
5
|
+
|
6
|
+
require_relative "./m2x"
|
7
|
+
|
8
|
+
m2x = M2X::Client.new("cdc032a8d7bfbf1ce5948a8c474eaa25")#, "http://localhost:9393")
|
9
|
+
|
10
|
+
arduino = m2x.create_device(name: "My Arduino test", description: "Long test of Ruby gem", visibility: "private")
|
11
|
+
|
12
|
+
arduino.create_stream("temperature")
|
13
|
+
arduino.create_stream("humidity")
|
14
|
+
arduino.create_stream("loudness")
|
15
|
+
|
16
|
+
arduino.post_updates({
|
17
|
+
values: {
|
18
|
+
temperature: [
|
19
|
+
{ timestamp: (Time.now - 2).iso8601, value: rand(0..37) },
|
20
|
+
{ timestamp: (Time.now + 2).iso8601, value: rand(0..37) }
|
21
|
+
],
|
22
|
+
humidity: [
|
23
|
+
{ timestamp: (Time.now - 3).iso8601, value: rand(0..100) },
|
24
|
+
{ timestamp: (Time.now + 3).iso8601, value: rand(0..100) }
|
25
|
+
]
|
26
|
+
},
|
27
|
+
location: { latitude: 80.3712, longitude: 100, elevation: 300 }
|
28
|
+
})
|
29
|
+
|
30
|
+
loudness = arduino.stream("loudness")
|
31
|
+
|
32
|
+
loudness.post_values(1000.times.map{ |i| { timestamp: (Time.now + i).iso8601, value: rand(0..120) } })
|
33
|
+
|
34
|
+
loudness.update_value(rand(90..9999))
|
35
|
+
|
36
|
+
raspberries = m2x.create_distribution(name: "Raspberries", description: "Group of raspberries", visibility: "private")
|
37
|
+
|
38
|
+
all_raspberries = 10.times.map{ |i| raspberries.add_device(i.to_s) }
|
39
|
+
|
40
|
+
all_raspberries.each do |device|
|
41
|
+
device.update_location(latitude: rand(-90..90), longitude: rand(-180..180), elevation: rand(0..7000))
|
42
|
+
end
|
43
|
+
|
44
|
+
pp loudness.stats.json
|
45
|
+
pp loudness.sampling(interval: 1).json
|
46
|
+
pp loudness.values.json
|
47
|
+
|
48
|
+
loudness.delete_values!((Time.now - 3600).iso8601, Time.now.iso8601)
|
49
|
+
|
50
|
+
loudness.delete!
|
51
|
+
arduino.delete!
|
52
|
+
raspberries.delete!
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: m2x
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Leandro López
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2014-
|
13
|
+
date: 2014-11-26 00:00:00.000000000 Z
|
14
14
|
dependencies: []
|
15
15
|
description: AT&T’s M2X is a cloud-based fully managed data storage service for network
|
16
16
|
connected machine-to-machine (M2M) devices. From trucks and turbines to vending
|
@@ -34,6 +34,7 @@ files:
|
|
34
34
|
- lib/m2x/feeds.rb
|
35
35
|
- lib/m2x/keys.rb
|
36
36
|
- lib/m2x/version.rb
|
37
|
+
- lib/megatest.rb
|
37
38
|
- m2x.gemspec
|
38
39
|
homepage: http://github.com/attm2x/m2x-ruby
|
39
40
|
licenses:
|
@@ -60,3 +61,4 @@ signing_key:
|
|
60
61
|
specification_version: 4
|
61
62
|
summary: Ruby client for AT&T M2X
|
62
63
|
test_files: []
|
64
|
+
has_rdoc:
|