planethoster_api 0.0.2 → 0.0.3
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/.gitignore +2 -1
- data/lib/planethoster_api/version.rb +1 -1
- data/lib/planethoster_api.rb +19 -8
- data/lib/utilities/api_client.rb +2 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 39be460ddd5c0d501bcb7005bc23cac9b34d4c27147290bfb5e37838c821616e
|
4
|
+
data.tar.gz: 6bfe7a4645f194eefb2aaef31e991c03fadc00aecd744c42aa08ed51745f7447
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7fac42b0316140cd07b312b4fc15ad2d2500b022e1fb061606f0db38feb16c24934fd988c8b86f10bf795e66105e39b3e1cd7b900e63041685a0a1a698d6a7cd
|
7
|
+
data.tar.gz: 4bd1daa9336394818d74cb19b51e838156fe6ce7a8852b9389067cba589d720b283f26f6351f401205b62107a5cb2f121c21412e4819224043d803778723b39b
|
data/.gitignore
CHANGED
data/lib/planethoster_api.rb
CHANGED
@@ -22,17 +22,28 @@ module PlanethosterApi
|
|
22
22
|
end
|
23
23
|
|
24
24
|
def self.domain
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
25
|
+
creds_wrap do
|
26
|
+
PlanethosterApi::Domain.new(
|
27
|
+
@configuration.api_user,
|
28
|
+
@configuration.api_key
|
29
|
+
)
|
30
|
+
end
|
29
31
|
end
|
30
32
|
|
31
33
|
def self.world
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
34
|
+
creds_wrap do
|
35
|
+
PlanethosterApi::World.new(
|
36
|
+
@configuration.api_user,
|
37
|
+
@configuration.api_key
|
38
|
+
)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def self.creds_wrap
|
43
|
+
if @configuration.nil?
|
44
|
+
raise "api_key and api_user are not defined - Please refer to documentation and configure credentials: https://github.com/PlanetHoster/planethoster-ruby"
|
45
|
+
end
|
46
|
+
yield
|
36
47
|
end
|
37
48
|
|
38
49
|
end
|
data/lib/utilities/api_client.rb
CHANGED
@@ -47,12 +47,12 @@ module Utilities
|
|
47
47
|
@req.add_field "#{k}", "#{v}"
|
48
48
|
end
|
49
49
|
|
50
|
-
@res = HTTP.start(@uri.hostname, @uri.port) {|http|
|
50
|
+
@res = HTTP.start(@uri.hostname, @uri.port, use_ssl: true) {|http|
|
51
51
|
http.request(@req)
|
52
52
|
}
|
53
53
|
|
54
54
|
result = JSON.parse(@res.body)
|
55
|
-
result[:
|
55
|
+
result[:http_code] = @res.code
|
56
56
|
|
57
57
|
result
|
58
58
|
end
|