m2x 1.0.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +42 -30
- data/lib/m2x/client.rb +150 -64
- data/lib/m2x/device.rb +147 -0
- data/lib/m2x/distribution.rb +53 -0
- data/lib/m2x/key.rb +49 -0
- data/lib/m2x/resource.rb +40 -0
- data/lib/m2x/response.rb +42 -0
- data/lib/m2x/stream.rb +111 -0
- data/lib/m2x/version.rb +4 -2
- data/lib/m2x.rb +8 -43
- data/m2x.gemspec +1 -1
- metadata +7 -6
- data/lib/m2x/batches.rb +0 -79
- data/lib/m2x/blueprints.rb +0 -64
- data/lib/m2x/datasources.rb +0 -64
- data/lib/m2x/feeds.rb +0 -194
- data/lib/m2x/keys.rb +0 -59
data/lib/m2x/keys.rb
DELETED
@@ -1,59 +0,0 @@
|
|
1
|
-
class M2X
|
2
|
-
|
3
|
-
# Wrapper for AT&T M2X Keys API
|
4
|
-
#
|
5
|
-
# See https://m2x.att.com/developer/documentation/keys for AT&T M2X
|
6
|
-
# HTTP Keys API documentation.
|
7
|
-
class Keys
|
8
|
-
# Creates a new M2X Keys API wrapper
|
9
|
-
#
|
10
|
-
# See M2X::Client for a description of the client API.
|
11
|
-
def initialize(client)
|
12
|
-
@client = client
|
13
|
-
end
|
14
|
-
|
15
|
-
# List all the Master API Keys that belongs to the user associated
|
16
|
-
# with the AT&T M2X API key supplied when initializing M2X
|
17
|
-
def list
|
18
|
-
@client.get("/keys")
|
19
|
-
end
|
20
|
-
|
21
|
-
# Return the details of the API Key supplied
|
22
|
-
def view(key)
|
23
|
-
@client.get("/keys/#{URI.encode(key.to_s)}")
|
24
|
-
end
|
25
|
-
|
26
|
-
# Delete the supplied API Key
|
27
|
-
def delete(key)
|
28
|
-
@client.delete("/keys/#{URI.encode(key.to_s)}")
|
29
|
-
end
|
30
|
-
|
31
|
-
# Create a new API Key
|
32
|
-
#
|
33
|
-
# Note that, according to the parameters sent, you can create a
|
34
|
-
# Master API Key or a Feed/Stream API Key. See
|
35
|
-
# https://m2x.att.com/developer/documentation/keys#Create-Key for
|
36
|
-
# details on the parameters accepted by this method.
|
37
|
-
def create(params)
|
38
|
-
@client.post("/keys", nil, params, "Content-Type" => "application/json")
|
39
|
-
end
|
40
|
-
|
41
|
-
# Update API Key properties
|
42
|
-
#
|
43
|
-
# This method accepts the same parameters as create API Key and
|
44
|
-
# has the same validations. Note that the Key token cannot be
|
45
|
-
# updated through this method.
|
46
|
-
def update(key, params)
|
47
|
-
@client.put("/keys/#{URI.encode(key.to_s)}", nil, params, "Content-Type" => "application/json")
|
48
|
-
end
|
49
|
-
|
50
|
-
# Regenerate an API Key token
|
51
|
-
#
|
52
|
-
# Note that if you regenerate the key that you're using for
|
53
|
-
# authentication then you would need to change your scripts to
|
54
|
-
# start using the new key token for all subsequent requests.
|
55
|
-
def regenerate(key)
|
56
|
-
@client.post("/keys/#{URI.encode(key.to_s)}/regenerate", nil, {})
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|