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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a790360dbbb27d700ed672b733e5bddba655d1e8
4
- data.tar.gz: c3b8fd632274ef52429f68d983510272c587c5eb
3
+ metadata.gz: 10ce676b5c9c86b013b9c5f311b95c5fca7ae912
4
+ data.tar.gz: 9527b81b6d60262c757aa0bc8e40415505114fd9
5
5
  SHA512:
6
- metadata.gz: 8795c5ab4e6b944f0892415f54fa550e5f523d8a1f22d9e4414b40fa2c4420d5e3192af130d20c308659a6e94556f0386c21c659542c0c1518f7f2e671c449bc
7
- data.tar.gz: b6a9ef01aa5c5d41b90dfee813690ea5ffe3fe698adb400dd0bb61a9fcd8de5f81ae9fd1a4e1f6ceaa811dd30e121dfbbcc403c28abb86d5c9db8cfd267c5b83
6
+ metadata.gz: d537eb5ac23328cba3a49392d2d3173c2ee43dab729706e837a364575e639699ead900438ce7e8839fe579a7d559b7c297b202741dbaaaa22e5834d3e49451a6
7
+ data.tar.gz: f56fedf746aa9b5c2c7502644d38d486c433492f0b3862353c389cf18124dae36ed86cbb3be906ff927529063fcbd0c09b3e4fa6364a0f055cfb53cbb2ed7490
data/README.md CHANGED
@@ -1,8 +1,6 @@
1
1
  # Stsplatform
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/stsplatform`. To experiment with that code, run `bin/console` for an interactive prompt.
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
 
@@ -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)
@@ -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)
@@ -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)
@@ -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
- #TODO: move classes onto their own files
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
 
@@ -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,4 +1,6 @@
1
1
  module STSPlatform
2
+
3
+ # A custom error that makes it easier to track errors when debugging.
2
4
  class STSPlatformError < StandardError
3
5
  end
4
6
  end
@@ -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)
@@ -1,3 +1,3 @@
1
1
  module Stsplatform
2
- VERSION = "0.0.1"
2
+ VERSION = "0.1.0"
3
3
  end
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.1
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-22 00:00:00.000000000 Z
11
+ date: 2015-07-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json