globodns_client 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0c26434dc9b3be19c2a94ddf9358ef8a0bb574dc
4
- data.tar.gz: 9b575524550b1ad79868d5c8e26508f35f43b1ac
3
+ metadata.gz: e35e941e02ee142eda1040a567eac897b800b0eb
4
+ data.tar.gz: 4f702623973663c2324ae50259d134238a357c61
5
5
  SHA512:
6
- metadata.gz: 10357b24abcd70987f1a44721ba76225d061b3f20eee3b395c979ee48369c56b422b7b839fecf0422ab90e6eb74e1d5833a11b8ef3ec7c9082a29eb1a67e8534
7
- data.tar.gz: eb1b3fa03366843538c8f83c38d82d3b0b83fddfdff83bd431295fb177b2e2dfb737d78ea86b568ca49011905c96002ac7c81f5eaded4919b3566aa127e1e49f
6
+ metadata.gz: 9505892c9313960d16a64b84801dc291d3e04a999a88fbbca57475aa847079c0e5771c195abc871c8df500cdc6a8acb601a58e4e2ac14cb697ea4881f3abd65f
7
+ data.tar.gz: 257a5a7ccbd8f5c62e1b0d1a71aa7bd87296c7f87b4ecde31156d131291ed659e6294e9f2de79e5c282606c713fcd7c29da581c9754ad5058de079fe7f3784d3
@@ -31,17 +31,21 @@ module GlobodnsClient
31
31
  raise GlobodnsClient::NotFound, "Couldn't find a proper zone for '#{key}'"
32
32
  end
33
33
  end
34
- res.is_a?(Array) ? res[0]['domain'] : res
34
+ res
35
35
  end
36
36
 
37
- def get_record(key, kind, zone = nil)
38
- zone = get_zone(key, kind) if zone.nil?
39
- host = get_host(key, zone, kind)
40
- response = request('get', 'record', host, zone['id'], kind)
41
- response.each do |r|
42
- return r[kind.downcase] unless r[kind.downcase].nil?
37
+ def get_record(key, kind, zones=[] )
38
+ zones.flatten!
39
+ res = []
40
+ zones = get_zone(key, kind) if zones.nil?
41
+ zones.each do |zone|
42
+ host = get_host(key, zone, kind)
43
+ response = request('get', 'record', host, zone['domain']['id'], kind)
44
+ response.each do |r|
45
+ res << r[kind.downcase] unless r[kind.downcase].nil?
46
+ end
43
47
  end
44
- false
48
+ res.empty? ? false : res
45
49
  end
46
50
 
47
51
  def new_record(key, kind, value)
@@ -76,9 +80,9 @@ module GlobodnsClient
76
80
 
77
81
  def get_host(key, zone, kind)
78
82
  if kind.eql?('A')
79
- host = key.split('.'+zone['name'])[0]
83
+ host = key.split('.'+zone['domain']['name'])[0]
80
84
  elsif kind.eql?('PTR')
81
- case zone['name'].count('.')
85
+ case zone['domain']['name'].count('.')
82
86
  when 4, 5
83
87
  host = key.split('.').last
84
88
  when 3
@@ -1,3 +1,3 @@
1
1
  module GlobodnsClient
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: globodns_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ernesto Thorp
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-09-24 00:00:00.000000000 Z
11
+ date: 2015-11-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client