TACore 4.0.1 → 4.0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1f75c89cea08134c5a2b93e4843887f67ff504a8
4
- data.tar.gz: 9cd0c5e3dbdee6002dab82fa2540c3b096840b1e
3
+ metadata.gz: 91e89416ab0144902af68c5423f39de783374dc4
4
+ data.tar.gz: 0e30500d825dc444bd35dfaff52337ad2c79e05c
5
5
  SHA512:
6
- metadata.gz: 5b2792d03d8bb65a9db9258de9a01e4b6cb7b4857b13347c4b919ebf201abef2b7dcd870e7a8567d623964d83b62cf2a6549430c1f5a6bb5ea769289d17102c0
7
- data.tar.gz: 45b5a453814e9033bc8532ea300e44767b6c89abc22f58e90f620f23d0501b524411789ff6a6a6cae97c44a8b6045442125a6a4348e74f840b6a55027e7b02f6
6
+ metadata.gz: 829846ec0f378344e9c539b6848b52ebbd109d7d029221735b279fc7efd1ff5426579f6d48c162c9bf19c5053eafab11bfdb224295b6d6b035c4c7c8a630cf8a
7
+ data.tar.gz: c11d9ebcf6fd4b76dd9672058ec3fecf3d564e03fe2d334ca88a1a38421ec93a9276acb31e0f61f35bf6aecdaf109fae09c44491fde459d1b388822ad6073ab9
@@ -131,6 +131,7 @@ module TACore
131
131
  require 'tacore/venue'
132
132
  require 'tacore/device'
133
133
  require 'tacore/gateway'
134
+ require 'tacore/webhook'
134
135
  require 'tacore/app'
135
136
 
136
137
 
@@ -19,14 +19,14 @@ module TACore
19
19
  # @param token [String] Application Token after Authentication
20
20
  # @return [Object] in JSON format
21
21
  def self.devices(token)
22
- request(:get, '/application/iris', {}, {"token": token})
22
+ request(:get, '/application/devices', {}, {"token": token})
23
23
  end
24
24
 
25
25
  # Get all Cirrus gateways assigned to your application
26
26
  # @param token [String] Application Token after Authentication
27
27
  # @return [Object] in JSON format
28
28
  def self.gateways(token)
29
- request(:get, '/application/cirrus', {}, {"token": token})
29
+ request(:get, '/application/gateways', {}, {"token": token})
30
30
  end
31
31
 
32
32
  end
@@ -24,7 +24,7 @@ module TACore
24
24
  # @param client_id [String] used from {Client.create}
25
25
  # @return [Object] in JSON format
26
26
  def self.find(token, client_id)
27
- request(:get, '/client/',{}, {"token": token, "client-id" => client_id})
27
+ request(:get, '/client/' + client_id.to_s, {}, {"token": token})
28
28
  end
29
29
 
30
30
  # Update a client details via api_key
@@ -34,14 +34,14 @@ module TACore
34
34
  # @return [Object] in JSON format
35
35
  # @note The `client` object currently only supports `name`
36
36
  def self.update(token, client_id, client = {})
37
- request(:put, '/client/', client, {"token": token, "client-id" => client_id})
37
+ request(:put, '/client/' + client_id.to_s, {"token": token})
38
38
  end
39
39
 
40
40
  # Delete a client by id
41
41
  # @param token [String] Client Token after Authentication
42
42
  # @param client_id [String] used from {Client.create}
43
43
  def self.destroy(token, client_id)
44
- request(:delete, '/client/', {"token": token, "client-id" => client_id})
44
+ request(:delete, '/client/' + client_id.to_s, {"token": token})
45
45
  end
46
46
 
47
47
  # Get all devices assigned to this client-id
@@ -49,7 +49,7 @@ module TACore
49
49
  # @param client_id [String] used from {Client.create}
50
50
  # @return [Object] in JSON format
51
51
  def self.devices(token, client_id)
52
- request(:get, '/client/devices',{}, {"token": token, "client-id" => client_id})
52
+ request(:get, '/client/' + client_id.to_s + '/devices',{}, {"token": token})
53
53
  end
54
54
 
55
55
  # Get all gateways assigned to this client-id
@@ -57,7 +57,7 @@ module TACore
57
57
  # @param client_id [String] used from {Client.create}
58
58
  # @return [Object] in JSON format
59
59
  def self.gateways(token, client_id)
60
- request(:get, '/client/gateways',{}, {"token": token, "client-id" => client_id})
60
+ request(:get, '/client/' + client_id.to_s + '/gateways',{}, {"token": token})
61
61
  end
62
62
 
63
63
  # Get all Venues created by this client-id
@@ -65,7 +65,7 @@ module TACore
65
65
  # @param client_id [String] used from {Client.create}
66
66
  # @return [Object] in JSON format
67
67
  def self.venues(token, client_id)
68
- request(:get, '/client/venues',{}, {"token": token, "client-id" => client_id})
68
+ request(:get, '/client/' + client_id.to_s + '/venues',{}, {"token": token})
69
69
  end
70
70
 
71
71
  end
@@ -9,7 +9,7 @@ module TACore
9
9
  # @param device [Object] Venue ID as a value
10
10
  # @return [Object] in JSON format
11
11
  def self.update(token, client_id, device_id, device = {})
12
- request(:put, '/device/' + device_id.to_s, device, {"client-id" => client_id, "token": token})
12
+ request(:put, '/device/' + device_id.to_s, device, {"token": token})
13
13
  end
14
14
 
15
15
  # Find device by device_id
@@ -18,15 +18,7 @@ module TACore
18
18
  # @param device_id [Integer] Device ID
19
19
  # @return [Object] in JSON format
20
20
  def self.find(token, client_id, device_id)
21
- request(:get, '/device/' + device_id.to_s,{}, {"client-id" => client_id, "token": token})
22
- end
23
-
24
- # Display all devices that belong to this Client
25
- # @param token [String] Client Token after Authentication
26
- # @param client_id [String] used from {Client.create}
27
- # @return [Array<Object, Object>] in JSON format
28
- def self.all(token, client_id)
29
- request(:get, '/client/devices/', {}, {"token": token, "client-id" => client_id})
21
+ request(:get, '/device/' + device_id.to_s,{}, {"token": token})
30
22
  end
31
23
 
32
24
  # Display all iris devices that belong to this application
@@ -1,15 +1,6 @@
1
1
  module TACore
2
2
  # => Gateway class methods
3
3
  class Gateway < Auth
4
-
5
- # Get all gateways that belong to a client
6
- # @param token [String] Client Token after Authentication
7
- # @param client_id [String] used from {Client.create}
8
- # @return [Array<Object, Object>] in JSON format
9
- def self.all(token, client_id)
10
- request(:get, '/client/gateways/', {}, {token: token, "client-id" => client_id})
11
- end
12
-
13
4
  # Shows the devices that are seen by the gateway id
14
5
  # @param token [String] Client Token after Authentication
15
6
  # @param client_id [String] used from {Client.create}
@@ -2,32 +2,39 @@ module TACore
2
2
  # => Venue is used to group devices for Clients, Venue could be a location or an area within a location.
3
3
  # It is important to note that all Venue methods require the use a client_id see {Client.create}.
4
4
  class Venue < Auth
5
- # Create a new Venue under a Client.
5
+ # Create a new Venue
6
+ # @param token [String] Client Token after Authentication
7
+ # @param venue [Object] Venue params
8
+ # @note Venue currently only accepts 'name'
9
+ # @return [Object] in JSON format
10
+ def self.create(token, venue = {})
11
+ request(:post, '/venue', venue, {"token": token})
12
+ end
13
+
14
+ # Update a Venue.
6
15
  # @param token [String] Client Token after Authentication
7
- # @param client_id [String] used from {Client.create}
8
16
  # @param venue [Object] Venue params
9
17
  # @note Venue currently only accepts 'name'
10
18
  # @return [Object] in JSON format
11
- def self.create(token, client_id, venue = {})
12
- request(:post, '/venue', venue, {"client-id" => client_id, "token": token})
19
+ def self.update(token, venue = {})
20
+ request(:put, '/venue', venue, {"token": token})
13
21
  end
14
22
 
15
23
  # Get back Venue information
16
24
  # @param token [String] Client Token after Authentication
17
- # @param client_id [String] used from {Client.create}
18
25
  # @param venue_id [String] used from {Venue.create}
19
26
  # @return [Object] in JSON format
20
- def self.find(token, client_id, venue_id)
21
- request(:get, '/venue/' + venue_id.to_s,{}, {"client-id" => client_id, "token": token})
27
+ def self.find(token, venue_id)
28
+ request(:get, '/venue/' + venue_id.to_s,{}, {"token": token})
22
29
  end
23
30
 
24
31
  # Display all Venues for the client
25
32
  # @param token [String] Client Token after Authentication
26
33
  # @param client_id [String] used from {Client.create}
27
34
  # @return [Array<Object, Object>] in JSON format
28
- def self.all(token, client_id)
35
+ def self.all(token)
29
36
  # returns all venues that belong to this client
30
- request(:get, '/client/venues', {}, {"token": token, "client-id" => client_id})
37
+ request(:get, '/venues', {}, {"token": token})
31
38
  end
32
39
 
33
40
  # This method will permanently remove the venue from the API.
@@ -35,17 +42,24 @@ module TACore
35
42
  # @param client_id [String] used from {Client.create}
36
43
  # @param venue_id [String] the Key of the Venue from {Venue.create}
37
44
  # @return [Hash, status: 410] in JSON format
38
- def self.destroy(token, client_id, venue_id)
39
- request(:delete, '/venue/' + venue_id.to_s,{}, {"client-id" => client_id, "token": token})
45
+ def self.destroy(token, venue_id)
46
+ request(:delete, '/venue/' + venue_id.to_s,{}, {"token": token})
40
47
  end
41
48
 
42
49
  # Get all devices belonging to the given venue
43
50
  # @param token [String] Client Token after Authentication
44
- # @param client_id [String] used from {Client.create}
45
51
  # @param venue_id [String] the Key of the Venue from {Venue.create}
46
- # @return [Hash, status: 410] in JSON format
47
- def self.devices(token, client_id, venue_id)
48
- request(:get, '/venue/' + venue_id.to_s + '/devices',{}, {"client-id" => client_id, "token": token})
52
+ # @return [Hash, status: 200] in JSON format
53
+ def self.devices(token, venue_id)
54
+ request(:get, '/venue/' + venue_id.to_s + '/devices',{}, {"token": token})
55
+ end
56
+
57
+ # Get all gateways belonging to the given venue
58
+ # @param token [String] Client Token after Authentication
59
+ # @param venue_id [String] the Key of the Venue from {Venue.create}
60
+ # @return [Hash, status: 200] in JSON format
61
+ def self.devices(token, venue_id)
62
+ request(:get, '/venue/' + venue_id.to_s + '/gateways',{}, {"token": token})
49
63
  end
50
64
  end
51
65
  end
@@ -0,0 +1,40 @@
1
+ module TACore
2
+ # => Webhooks allow the THINaer API to push updated/new data to a callback you select.
3
+ # => NOTE: As of 4.1.0 Webhooks are in the Alpha Stage
4
+ # It is important to note Webhooks will act independently of any client or venue id's. This means that when the
5
+ # API updates a record in it's own database regardless of the data changed it will send an update if the object belongs to your application ID
6
+ # Webhook API Docs (https://documenter.getpostman.com/view/150459/thinaer/2PMs5i#webhook)
7
+ class Webhook < Auth
8
+ # Create a new Webhook under your Application.
9
+ # @param token [String] Client Token after Authentication
10
+ # @param webhook [Object] Webhook params
11
+ # @note Webhook currently only accepts 'callback, encryption, dataType' (https://documenter.getpostman.com/view/150459/thinaer/2PMs5i#webhook)
12
+ # @return [Object] in JSON format
13
+ def self.create(token, webhook = {})
14
+ request(:post, '/webhook', webhook, { "token": token })
15
+ end
16
+
17
+ # Find an already created Webhook by ID
18
+ # @param token [String] Client Token after Authentication
19
+ # @param webhook_id [Integer] The webhook ID returned from {Webhook.create}
20
+ # @return [Object] in JSON format
21
+ def self.find(token, webhook_id)
22
+ request(:get, '/webhook/' + webhook_id.to_s, {}, { "token": token })
23
+ end
24
+
25
+ # Update an existing webhook by ID
26
+ # @param webhook_id [Integer] The webhook ID returned from {Webhook.create} or {Webhook.find}
27
+ # @param webhook [Object] Webhook params
28
+ # @return [Object] in JSON format
29
+ def self.update(token, webhook_id, webhook ={})
30
+ request(:put, '/webhook/' + webhook_id.to_s, webhook, { "token": token })
31
+ end
32
+
33
+ # Delete a webhook by ID
34
+ # @param webhook_id [Integer] The webhook ID returned from {Webhook.create} or {Webhook.find}
35
+ # @return [Object] in JSON format (Object of the full Application)
36
+ def self.delete(token, webhook_id)
37
+ request(:delete, '/webhook/' + webhook_id.to_s, {}, { "token": token })
38
+ end
39
+ end
40
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: TACore
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.1
4
+ version: 4.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Greg Winn
@@ -53,6 +53,7 @@ files:
53
53
  - lib/tacore/device.rb
54
54
  - lib/tacore/gateway.rb
55
55
  - lib/tacore/venue.rb
56
+ - lib/tacore/webhook.rb
56
57
  homepage: http://thinaer.io
57
58
  licenses:
58
59
  - MIT