helium-ruby 0.6.0 → 0.7.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/docs/Helium.html +2 -2
- data/docs/Helium/Client.html +45 -23
- data/docs/Helium/Client/Elements.html +1 -1
- data/docs/Helium/Client/Http.html +145 -38
- data/docs/Helium/Client/Labels.html +1 -1
- data/docs/Helium/Client/Organizations.html +1 -1
- data/docs/Helium/Client/Sensors.html +1 -1
- data/docs/Helium/Client/Users.html +1 -1
- data/docs/Helium/ClientError.html +1 -1
- data/docs/Helium/Cursor.html +1 -1
- data/docs/Helium/DataPoint.html +1 -1
- data/docs/Helium/Element.html +1 -1
- data/docs/Helium/Error.html +1 -1
- data/docs/Helium/InvalidApiKey.html +1 -1
- data/docs/Helium/Label.html +1 -1
- data/docs/Helium/Organization.html +1 -1
- data/docs/Helium/Resource.html +1 -1
- data/docs/Helium/Sensor.html +1 -1
- data/docs/Helium/User.html +1 -1
- data/docs/Helium/Utils.html +1 -1
- data/docs/_index.html +1 -1
- data/docs/file.README.html +1 -1
- data/docs/index.html +1 -1
- data/docs/method_list.html +105 -89
- data/docs/top-level-namespace.html +1 -1
- data/helium-ruby.gemspec +2 -2
- data/lib/helium/client.rb +7 -2
- data/lib/helium/client/http.rb +14 -12
- data/lib/helium/version.rb +1 -1
- metadata +4 -2
@@ -102,7 +102,7 @@
|
|
102
102
|
</div>
|
103
103
|
|
104
104
|
<div id="footer">
|
105
|
-
Generated on
|
105
|
+
Generated on Wed Aug 31 12:32:54 2016 by
|
106
106
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
107
107
|
0.9.3 (ruby-2.3.1).
|
108
108
|
</div>
|
data/helium-ruby.gemspec
CHANGED
@@ -6,8 +6,8 @@ require 'helium/version'
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = "helium-ruby"
|
8
8
|
spec.version = Helium::VERSION
|
9
|
-
spec.authors = ["Andrew Allen"]
|
10
|
-
spec.email = ["allenan@helium.com"]
|
9
|
+
spec.authors = ["Andrew Allen", "Jared Morrow"]
|
10
|
+
spec.email = ["allenan@helium.com", "jared@helium.com"]
|
11
11
|
|
12
12
|
spec.summary = %q{A Ruby gem for building applications with the Helium API}
|
13
13
|
spec.description = %q{A Ruby gem for building applications with the Helium API}
|
data/lib/helium/client.rb
CHANGED
@@ -15,11 +15,16 @@ module Helium
|
|
15
15
|
include Helium::Client::Labels
|
16
16
|
include Helium::Client::Elements
|
17
17
|
|
18
|
+
API_VERSION = 1
|
19
|
+
HOST = 'api.helium.com'
|
20
|
+
PROTOCOL = 'https'
|
21
|
+
|
18
22
|
attr_accessor :api_key
|
19
23
|
|
20
24
|
def initialize(opts = {})
|
21
|
-
@api_key
|
22
|
-
@
|
25
|
+
@api_key = opts.fetch(:api_key)
|
26
|
+
@api_host = opts.fetch(:host, HOST)
|
27
|
+
@debug = opts.fetch(:debug, false)
|
23
28
|
end
|
24
29
|
|
25
30
|
def inspect
|
data/lib/helium/client/http.rb
CHANGED
@@ -1,10 +1,6 @@
|
|
1
1
|
module Helium
|
2
2
|
class Client
|
3
3
|
module Http
|
4
|
-
API_VERSION = 1
|
5
|
-
HOST = 'api.helium.com'
|
6
|
-
PROTOCOL = 'https'
|
7
|
-
|
8
4
|
BASE_HTTP_HEADERS = {
|
9
5
|
'Accept' => 'application/json',
|
10
6
|
'Content-Type' => 'application/json',
|
@@ -35,6 +31,19 @@ module Helium
|
|
35
31
|
response.code == 204
|
36
32
|
end
|
37
33
|
|
34
|
+
def base_url
|
35
|
+
"#{PROTOCOL}://#{@api_host}/v#{API_VERSION}"
|
36
|
+
end
|
37
|
+
|
38
|
+
# Contructs a proper url given a path. If the path is already a full url
|
39
|
+
# it will simply pass through
|
40
|
+
def url_for(path)
|
41
|
+
return path if path =~ /^http/
|
42
|
+
|
43
|
+
path = path.gsub(/^\//, '')
|
44
|
+
"#{base_url}/#{path}"
|
45
|
+
end
|
46
|
+
|
38
47
|
private
|
39
48
|
|
40
49
|
def http_headers
|
@@ -53,14 +62,7 @@ module Helium
|
|
53
62
|
method = opts.fetch(:method)
|
54
63
|
params = opts.fetch(:params, {})
|
55
64
|
body = opts.fetch(:body, {})
|
56
|
-
|
57
|
-
|
58
|
-
url = if path =~ /^http/
|
59
|
-
path
|
60
|
-
else
|
61
|
-
path = path.gsub(/^\//, '')
|
62
|
-
"#{PROTOCOL}://#{HOST}/v#{API_VERSION}/#{path}"
|
63
|
-
end
|
65
|
+
url = url_for(path)
|
64
66
|
|
65
67
|
Typhoeus::Request.new(url, {
|
66
68
|
method: method,
|
data/lib/helium/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: helium-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Allen
|
8
|
+
- Jared Morrow
|
8
9
|
autorequire:
|
9
10
|
bindir: exe
|
10
11
|
cert_chain: []
|
11
|
-
date: 2016-08-
|
12
|
+
date: 2016-08-31 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: typhoeus
|
@@ -223,6 +224,7 @@ dependencies:
|
|
223
224
|
description: A Ruby gem for building applications with the Helium API
|
224
225
|
email:
|
225
226
|
- allenan@helium.com
|
227
|
+
- jared@helium.com
|
226
228
|
executables: []
|
227
229
|
extensions: []
|
228
230
|
extra_rdoc_files: []
|