restpack-group-client 0.0.42 → 0.0.43
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.
@@ -4,7 +4,7 @@ module RestPack
|
|
4
4
|
module Client
|
5
5
|
class Api #TODO: GJ: move to common client gem
|
6
6
|
attr_accessor :options
|
7
|
-
def initialize(options = {})
|
7
|
+
def initialize(options = {})
|
8
8
|
@options = {
|
9
9
|
use_https: true,
|
10
10
|
domain: 'localhost:1113',
|
@@ -18,6 +18,12 @@ module RestPack
|
|
18
18
|
json = RestClient.get(url, params: params)
|
19
19
|
Yajl::Parser.parse(json, :symbolize_keys => true)
|
20
20
|
end
|
21
|
+
|
22
|
+
def http_post(path, params = {})
|
23
|
+
url = build_url(path)
|
24
|
+
json = RestClient.post(url, params: params)
|
25
|
+
Yajl::Parser.parse(json, :symbolize_keys => true)
|
26
|
+
end
|
21
27
|
|
22
28
|
def build_url(path)
|
23
29
|
protocol = @options[:use_https] ? "https://" : "http://"
|