humure-client 0.2.0 → 0.3.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: 3f53494bebc1398f8675d50642e9520e87998625
4
- data.tar.gz: 50b72fcd3fa75a1bb68d4a4aabadee4a22a7123a
3
+ metadata.gz: 3830b1bd61030c8c5b0535d0ab0b5e78e380f957
4
+ data.tar.gz: fc76cb3635fe13b531ad786cbe31a2a496940389
5
5
  SHA512:
6
- metadata.gz: 2ff792c836f14df38c7be41a52abb90846d72e47c5b028437b8c5a9182cf30afebc075b752979b651835f65ad94438888e8820adaaabbefd74eece2176b64475
7
- data.tar.gz: 6123161312f48af3aa6f4850c54870d20c8f445b606cebc918a8ef9a131a5124041a087f38081dc62c7542f29ed4981f7e97909bc79499d5452fcf914147b2dd
6
+ metadata.gz: aa29827a0e166b86ee7ca800385debeb45c97a75275ae4233dcdc14fd0f131c6c7775a94d3dc2f1404d63b8b73245b6da6268a82e84b70f763c1a56e77960010
7
+ data.tar.gz: 15c1e4aaefcc20787a0d1ea137efb1841b9c913533fd02a64a73f94347cf359f7d0389a8c2aef87b6a3675a0d325913960ec7d8654a76dac49ba319581a5fbdf
data/README.md CHANGED
@@ -17,8 +17,8 @@ And then execute:
17
17
  ```ruby
18
18
  require 'humure-client'
19
19
 
20
- thing = HumureClient.new
21
- # thing = HumureClient.new(url: "http://localhost:4000")
20
+ thing = HumureClient.new(token: "the_token")
21
+ # thing = HumureClient.new(token: "the_token", url: "http://localhost:4000")
22
22
 
23
23
  thing.temperature
24
24
  # => 26.0
@@ -30,7 +30,8 @@ class HumureClient
30
30
  protected
31
31
 
32
32
  def get_request(path)
33
- resp = Net::HTTP.get_response(uri(path))
33
+ http = Net::HTTP.new(uri(path).host, uri(path).port)
34
+ resp = http.get(uri(path).path, { "X-Sensor" => sensor, "X-Token" => token })
34
35
  process_response(resp)
35
36
  rescue SocketError
36
37
  nil
@@ -1,6 +1,8 @@
1
1
  class HumureClient
2
2
 
3
- attr_accessor :url
3
+ attr_accessor :url,
4
+ :token,
5
+ :sensor
4
6
 
5
7
  # Initialize a new humure client
6
8
  # @param options [Hash]
@@ -9,6 +11,9 @@ class HumureClient
9
11
  instance_variable_set("@#{key}", value)
10
12
  end
11
13
 
14
+ raise ArgumentError.new("Option :token missing") if token.nil?
15
+
12
16
  @url ||= "http://localhost:3000"
17
+ @sensor ||= "fake"
13
18
  end
14
19
  end
@@ -1,3 +1,3 @@
1
1
  class HumureClient
2
- VERSION = "0.2.0"
2
+ VERSION = "0.3.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: humure-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Gogolok
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2016-03-09 00:00:00.000000000 Z
12
+ date: 2016-03-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler