stsplatform 0.0.1 → 0.1.0
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 +4 -4
- data/README.md +1 -3
- data/lib/stsplatform/client.rb +15 -0
- data/lib/stsplatform/data.rb +7 -0
- data/lib/stsplatform/fields.rb +7 -0
- data/lib/stsplatform/orgs.rb +7 -0
- data/lib/stsplatform/requesthandler.rb +2 -1
- data/lib/stsplatform/sensors.rb +8 -0
- data/lib/stsplatform/stsplatformerror.rb +2 -0
- data/lib/stsplatform/stsplatformresponse.rb +6 -0
- data/lib/stsplatform/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 10ce676b5c9c86b013b9c5f311b95c5fca7ae912
|
|
4
|
+
data.tar.gz: 9527b81b6d60262c757aa0bc8e40415505114fd9
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d537eb5ac23328cba3a49392d2d3173c2ee43dab729706e837a364575e639699ead900438ce7e8839fe579a7d559b7c297b202741dbaaaa22e5834d3e49451a6
|
|
7
|
+
data.tar.gz: f56fedf746aa9b5c2c7502644d38d486c433492f0b3862353c389cf18124dae36ed86cbb3be906ff927529063fcbd0c09b3e4fa6364a0f055cfb53cbb2ed7490
|
data/README.md
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
# Stsplatform
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
TODO: Delete this and the text above, and describe your gem
|
|
3
|
+
This gem allows you to use the STS Platform API, including the community version WoTKit.
|
|
6
4
|
|
|
7
5
|
## Dependencies
|
|
8
6
|
|
data/lib/stsplatform/client.rb
CHANGED
|
@@ -2,6 +2,21 @@ require "stsplatform/version"
|
|
|
2
2
|
|
|
3
3
|
module STSPlatform
|
|
4
4
|
|
|
5
|
+
|
|
6
|
+
# The base class of this library.
|
|
7
|
+
# Params:
|
|
8
|
+
# +config+:: (optional) a configuration dictionary
|
|
9
|
+
# Returns:
|
|
10
|
+
# +STSPlatformResponse+:: object containing "data" and "code" parameters
|
|
11
|
+
# The configuration should be:
|
|
12
|
+
# {
|
|
13
|
+
# "url": "http://wotkit.sensetecnic.com/api",
|
|
14
|
+
# "auth": {}
|
|
15
|
+
# }
|
|
16
|
+
# Auth should contain either username and password or oauth key, for example:
|
|
17
|
+
# {"username":"john", "password":"smith"} or
|
|
18
|
+
# {"oauth_key":"2341lkj2f12341"}
|
|
19
|
+
|
|
5
20
|
class Client < RequestHandler
|
|
6
21
|
def initialize(config=nil)
|
|
7
22
|
super(nil)
|
data/lib/stsplatform/data.rb
CHANGED
|
@@ -2,6 +2,13 @@ require "stsplatform/version"
|
|
|
2
2
|
|
|
3
3
|
module STSPlatform
|
|
4
4
|
|
|
5
|
+
# The Data resource of the STS Platform API
|
|
6
|
+
# Params:
|
|
7
|
+
# +handler+:: a sensor object
|
|
8
|
+
# +id+:: (optional) the id (timestamp of the data), only used to delete
|
|
9
|
+
# Returns:
|
|
10
|
+
# +STSPlatformResponse+:: object containing "data" and "code" parameters
|
|
11
|
+
# Inherits from RequestHandler, with access to the get, post, put and delete methods.
|
|
5
12
|
class Data < RequestHandler
|
|
6
13
|
def initialize(handler, id="")
|
|
7
14
|
super(handler,id)
|
data/lib/stsplatform/fields.rb
CHANGED
|
@@ -2,6 +2,13 @@ require "stsplatform/version"
|
|
|
2
2
|
|
|
3
3
|
module STSPlatform
|
|
4
4
|
|
|
5
|
+
# The Fields resource of the STS Platform API
|
|
6
|
+
# Params:
|
|
7
|
+
# +handler+:: a client object
|
|
8
|
+
# +id+:: (optional) the numerical or string id of the field
|
|
9
|
+
# Returns:
|
|
10
|
+
# +STSPlatformResponse+:: object containing "data" and "code" parameters
|
|
11
|
+
# Inherits from RequestHandler, with access to the get, post, put and delete methods.
|
|
5
12
|
class Fields < RequestHandler
|
|
6
13
|
def initialize(handler, id="")
|
|
7
14
|
super(handler,id)
|
data/lib/stsplatform/orgs.rb
CHANGED
|
@@ -2,6 +2,13 @@ require "stsplatform/version"
|
|
|
2
2
|
|
|
3
3
|
module STSPlatform
|
|
4
4
|
|
|
5
|
+
# The Orgs resource of the STS Platform API
|
|
6
|
+
# Params:
|
|
7
|
+
# +handler+:: a client object
|
|
8
|
+
# +id+:: (optional) the numerical or string id of the organization
|
|
9
|
+
# Returns:
|
|
10
|
+
# +STSPlatformResponse+:: object containing "data" and "code" parameters
|
|
11
|
+
# Inherits from RequestHandler, with access to the get, post, put and delete methods.
|
|
5
12
|
class Orgs < RequestHandler
|
|
6
13
|
def initialize(handler, id="")
|
|
7
14
|
super(handler,id)
|
|
@@ -4,7 +4,8 @@ require 'json'
|
|
|
4
4
|
|
|
5
5
|
module STSPlatform
|
|
6
6
|
|
|
7
|
-
#
|
|
7
|
+
# Main handler of the library. Defines successors in the chain of responsibility
|
|
8
|
+
# and in our case handles the REST requests to the STS Platform.
|
|
8
9
|
class RequestHandler
|
|
9
10
|
attr_accessor :url, :_successor, :resource, :auth
|
|
10
11
|
|
data/lib/stsplatform/sensors.rb
CHANGED
|
@@ -2,6 +2,14 @@ require "stsplatform/version"
|
|
|
2
2
|
|
|
3
3
|
module STSPlatform
|
|
4
4
|
|
|
5
|
+
|
|
6
|
+
# The Sensors resource of the STS Platform API
|
|
7
|
+
# Params:
|
|
8
|
+
# +handler+:: a client object
|
|
9
|
+
# +id+:: (optional) the numerical or string id of the sensor
|
|
10
|
+
# Returns:
|
|
11
|
+
# +STSPlatformResponse+:: object containing "data" and "code" parameters
|
|
12
|
+
# Inherits from RequestHandler, with access to the get, post, put and delete methods.
|
|
5
13
|
class Sensors < RequestHandler
|
|
6
14
|
def initialize(handler, id="")
|
|
7
15
|
super(handler,id)
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
require 'json'
|
|
2
2
|
|
|
3
3
|
module STSPlatform
|
|
4
|
+
|
|
5
|
+
# A custom response object from our library
|
|
6
|
+
# Params:
|
|
7
|
+
# +response+:: an Net::HTTP error response
|
|
8
|
+
# Returns:
|
|
9
|
+
# +STSPlatformResponse+:: object containing "data" and "code" parameters
|
|
4
10
|
class STSPlatformResponse
|
|
5
11
|
attr_accessor :data, :code
|
|
6
12
|
def initialize(response)
|
data/lib/stsplatform/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: stsplatform
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0
|
|
4
|
+
version: 0.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- SenseTecnic
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2015-07-
|
|
11
|
+
date: 2015-07-29 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: json
|