m2x 2.1.0 → 2.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9affc8594c00bbcb4dd5b570afdc9deacb6ae493
4
- data.tar.gz: 204e7043534ee6b80c32475f5200ae4e9db6f87c
3
+ metadata.gz: 113f7943534da2d33e88c0d3a6d1a9635eb978a7
4
+ data.tar.gz: 8dd90a58bc94561b2bb133667ad6dfe27e16284c
5
5
  SHA512:
6
- metadata.gz: 53641a6fad6d8ae91d37cdbee0fadf02efe4082391e29f82252415378dfa4ce9514a29a1614a2f635ce1faf86a6409f46f12cc454b77b71bc2f08bb1b61110b3
7
- data.tar.gz: 1e77ac43920349303a243cda56c7e707c447a5fe0a75163223ed6e847ec26eddad4c556aa8b83cb3a5fcf9f4d29463c6ec4ab35cac10221bfe19c6948cff2c67
6
+ metadata.gz: d62e6954c2f678be2308ef02e12a2ef2803948f6dedeb77de0073083107577daab2c577a667add676d0ccd42db813a873da7bd4b7cc8f29ca8454735a4200d34
7
+ data.tar.gz: bff82ec70417c205b14500c9aa5ba12d1000986253c32e64def2b66401688294fe2028af7346d08468b374b81aa67c133bb93a22e6bb743b91f3d2d2c60b6449
data/README.md CHANGED
@@ -50,6 +50,24 @@ This provides an interface to your data in M2X
50
50
 
51
51
  Refer to the documentation on each class for further usage instructions.
52
52
 
53
+ ## Time
54
+
55
+ For devices that do not have a Real Time Clock, M2X provides a set of endpoints that returns the server's time.
56
+
57
+ ```ruby
58
+ m2x.time
59
+ => {"seconds"=>1435970368, "millis"=>1435970368451, "iso8601"=>"2015-07-04T00:39:28.451Z"}
60
+
61
+ m2x.time_seconds
62
+ => "1435970400"
63
+
64
+ m2x.time_millis
65
+ => "1435970418134"
66
+
67
+ m2x.time_iso8601
68
+ => "2015-07-04T00:40:37.504Z"
69
+ ```
70
+
53
71
  ## Example
54
72
 
55
73
  In order to run this example, you will need a `Device ID` and `API Key`. If you don't have any, access your M2X account, create a new [Device](https://m2x.att.com/devices), and copy the `Device ID` and `API Key` values. The following script will send your CPU load average to three different streams named `load_1m`, `load_5m` and `load_15`. Check that there's no need to create a stream in order to write values into it.
@@ -118,6 +118,22 @@ class M2X::Client
118
118
  M2X::Client::Key.list(self)
119
119
  end
120
120
 
121
+ def time
122
+ get("/time").json
123
+ end
124
+
125
+ def time_seconds
126
+ get("/time/seconds").raw
127
+ end
128
+
129
+ def time_millis
130
+ get("/time/millis").raw
131
+ end
132
+
133
+ def time_iso8601
134
+ get("/time/iso8601").raw
135
+ end
136
+
121
137
  # Define methods for accessing M2X REST API
122
138
  [:get, :post, :put, :delete, :head, :options, :patch].each do |verb|
123
139
  define_method verb do |path, qs=nil, params=nil, headers=nil|
@@ -1,5 +1,5 @@
1
1
  module M2X
2
2
  class Client
3
- VERSION = "2.1.0"
3
+ VERSION = "2.2.0"
4
4
  end
5
5
  end
@@ -3,10 +3,9 @@
3
3
  require "time"
4
4
  require "pp"
5
5
 
6
- # require "m2x"
7
6
  require_relative "./m2x"
8
7
 
9
- $m2x = M2X::Client.new("cdc032a8d7bfbf1ce5948a8c474eaa25")
8
+ $m2x = M2X::Client.new("cdc032a8d7bfbf1ce5948a8c474eaa25", "http://staging-api.m2x.sl.attcompute.com")
10
9
  $running = true
11
10
 
12
11
  stop = Proc.new { $running = false }
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: 2.1.0
4
+ version: 2.2.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: 2015-04-02 00:00:00.000000000 Z
13
+ date: 2015-07-04 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