m2x 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/m2x.rb +1 -1
- data/lib/m2x/client.rb +2 -4
- data/lib/m2x/feeds.rb +5 -0
- data/m2x.gemspec +1 -1
- metadata +2 -2
data/lib/m2x.rb
CHANGED
data/lib/m2x/client.rb
CHANGED
@@ -6,11 +6,9 @@ class M2X
|
|
6
6
|
class Client
|
7
7
|
API_BASE = "http://api-m2x.att.com/v1".freeze
|
8
8
|
|
9
|
-
VERSION = "0.0.1".freeze
|
10
|
-
|
11
9
|
CA_FILE = File.expand_path("../cacert.pem", __FILE__)
|
12
10
|
|
13
|
-
USER_AGENT = "M2X/#{VERSION} (Ruby Net::HTTP)".freeze
|
11
|
+
USER_AGENT = "M2X/#{::M2X::VERSION} (Ruby Net::HTTP)".freeze
|
14
12
|
|
15
13
|
def initialize(api_key=nil, api_base=nil)
|
16
14
|
@api_base = api_base
|
@@ -89,7 +87,7 @@ class M2X
|
|
89
87
|
def default_headers
|
90
88
|
@headers ||= begin
|
91
89
|
headers = { "User-Agent" => USER_AGENT }
|
92
|
-
headers
|
90
|
+
headers.merge!("X-M2X-KEY" => @api_key) if @api_key
|
93
91
|
headers
|
94
92
|
end
|
95
93
|
end
|
data/lib/m2x/feeds.rb
CHANGED
@@ -44,6 +44,11 @@ class M2X
|
|
44
44
|
@client.get("/feeds/#{URI.encode(id)}/streams")
|
45
45
|
end
|
46
46
|
|
47
|
+
# Return the details of the supplied stream
|
48
|
+
def stream(id, name)
|
49
|
+
@client.get("/feeds/#{URI.encode(id)}/streams/#{URI.encode(name)}")
|
50
|
+
end
|
51
|
+
|
47
52
|
# Return a list with the latest values from a stream
|
48
53
|
def stream_values(id, name)
|
49
54
|
@client.get("/feeds/#{URI.encode(id)}/streams/#{URI.encode(name)}/values")
|
data/m2x.gemspec
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = "m2x"
|
5
|
-
s.version = "0.0.
|
5
|
+
s.version = "0.0.2"
|
6
6
|
s.summary = "Ruby client for AT&T M2X"
|
7
7
|
s.description = "AT&T’s M2X is a cloud-based fully managed data storage service for network connected machine-to-machine (M2M) devices. From trucks and turbines to vending machines and freight containers, M2X enables the devices that power your business to connect and share valuable data."
|
8
8
|
s.authors = ["Leandro López", "Matías Flores"]
|
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: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2013-10-
|
13
|
+
date: 2013-10-28 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
|