ten_thousand_feet 0.0.35 → 0.0.38

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: 02a2eb0bcb948b41cdf72037aa5588e1087baa84
4
- data.tar.gz: 620397df791670781639963ed3db159af45e8a2c
3
+ metadata.gz: bf168de32e44baf6e8a127f6dd114ebf1f48a443
4
+ data.tar.gz: 14291d3beed4f985a29090157f28589c5b7218c0
5
5
  SHA512:
6
- metadata.gz: a2de5aa6d597c75b0327a99cc2f20083e6a4e101bc695056e37d28c0aa490bde7b5f7071b88a6d5755a91f72fed795f118d776b9a5d7d3c9b47c53a22fa003be
7
- data.tar.gz: a9ad73a2e700f51c4144a1e7204d959d1272a29e7b1cbb482c4708a20d7e355ef838af31a52dd59ec8038181d0521066c6182709dc698b271dbe2bbee68d5564
6
+ metadata.gz: 5807731746b861b033d90fd94a409dea3e31b438c4c9f2908aa9f1fdb7fedbf3f01980dd21110868f71dc38bc9f5a6fc1263bc52518533df1944a77ed524adab
7
+ data.tar.gz: 057f469a02940fd29a56fbbcef7b5ee0c982a685082ba910503980f64eb2e5ded3a8cee7b958b4f14106070c0df6e9e0bc2306c0d7d914ca0ed8ca6581e4176b
@@ -32,30 +32,49 @@ module TenThousandFeet
32
32
  { auth: @auth }
33
33
  end
34
34
 
35
+ def query_string(options)
36
+ nodes = (options.count - 1)
37
+ params = "?"
38
+
39
+ options.each_with_index do |(key, value), index|
40
+ if index == nodes
41
+ params += key.to_s + "=" + value
42
+ else
43
+ params += key.to_s + "=" + value + "&"
44
+ end
45
+ end
46
+
47
+ params
48
+ end
49
+
50
+ def full_url(path, options)
51
+ if options.empty?
52
+ api_url + path
53
+ else
54
+ api_url + path + query_string(options)
55
+ end
56
+ end
57
+
35
58
  def get(path, options = {})
36
- params = default_options.merge(options)
37
- response = RestClient.get(api_url + path, params)
59
+ response = RestClient.get(full_url(path, options), default_options)
38
60
 
39
61
  JSON.parse(response)
40
62
  end
41
63
 
42
64
  def post(path, options = {})
43
- params = default_options.merge(options)
44
- response = RestClient.post(api_url + path, params)
65
+ response = RestClient.post(full_url(path, options), default_options)
45
66
 
46
67
  JSON.parse(response)
47
68
  end
48
69
 
49
70
  def put(path, options = {})
50
- params = default_options.merge(options)
51
- response = RestClient.put(api_url + path, params)
71
+ response = RestClient.put(full_url(path, options), default_options)
52
72
 
53
73
  JSON.parse(response)
54
74
  end
55
75
 
56
76
  def delete(path, options = {})
57
- params = default_options.merge(options)
58
- RestClient.delete(api_url + path, params)
77
+ RestClient.delete(full_url(path, options), default_options)
59
78
  end
60
79
  end
61
80
  end
@@ -1,3 +1,3 @@
1
1
  module TenThousandFeet
2
- VERSION = "0.0.35"
2
+ VERSION = "0.0.38"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ten_thousand_feet
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.35
4
+ version: 0.0.38
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kyle Suss