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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6aafb84ca951dde1ebc416b4e3782c6f45b122d24c361e52b2ed30f8be9c2fff
4
- data.tar.gz: 6e3b5f9cb3a5782c93f54761da5367e6ecd796de4a0c4a2e2a9a90d0d73e10af
3
+ metadata.gz: 39be460ddd5c0d501bcb7005bc23cac9b34d4c27147290bfb5e37838c821616e
4
+ data.tar.gz: 6bfe7a4645f194eefb2aaef31e991c03fadc00aecd744c42aa08ed51745f7447
5
5
  SHA512:
6
- metadata.gz: 5fabcd08c67baadfdcb8824991ad69e9b34452e390cb786395222c1796febe2a099447fe53bdfdf6c6f2d49c6609e1c36b0f6d7b54392059491b79224401176d
7
- data.tar.gz: c1b67838dd4d1a357894685f3563d6b81837b40dad2a9ad1ae28dc6fc511b201c741acca3c9aeb61c0f24747a1f23465a64d806de278f06cf35ef3e129994508
6
+ metadata.gz: 7fac42b0316140cd07b312b4fc15ad2d2500b022e1fb061606f0db38feb16c24934fd988c8b86f10bf795e66105e39b3e1cd7b900e63041685a0a1a698d6a7cd
7
+ data.tar.gz: 4bd1daa9336394818d74cb19b51e838156fe6ce7a8852b9389067cba589d720b283f26f6351f401205b62107a5cb2f121c21412e4819224043d803778723b39b
data/.gitignore CHANGED
@@ -10,4 +10,5 @@
10
10
  # rspec failure tracking
11
11
  .rspec_status
12
12
  .ruby-version
13
- Gemfile.lock
13
+ Gemfile.lock
14
+ *.gem
@@ -1,3 +1,3 @@
1
1
  module PlanethosterApi
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -22,17 +22,28 @@ module PlanethosterApi
22
22
  end
23
23
 
24
24
  def self.domain
25
- PlanethosterApi::Domain.new(
26
- @configuration.api_user,
27
- @configuration.api_key
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
- PlanethosterApi::World.new(
33
- @configuration.api_user,
34
- @configuration.api_key
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
@@ -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[:code] = @res.code
55
+ result[:http_code] = @res.code
56
56
 
57
57
  result
58
58
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: planethoster_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - marcandreg