domrobot 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 +4 -4
- data/lib/domrobot/sections/nameserver.rb +10 -13
- data/lib/domrobot/types/record.rb +7 -6
- data/lib/domrobot/util.rb +12 -0
- data/lib/domrobot/version.rb +1 -1
- data/lib/domrobot.rb +4 -2
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9620953c86884a216b1289e0fd50730fc27f0e19
|
4
|
+
data.tar.gz: 5e107f3811c880ccef67135be6f84021942fe560
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7d5c17209676ff90cf3e721ba290af1dc03f7cd2de29bc0e70e73b496a19db0ee2d83b4384ad1ef419206aad0b6518fbbd29ec8a8bba0b5cd339d652bd2f426b
|
7
|
+
data.tar.gz: 46792006b646cbef55fc98204279ad0f026a37a8ae4e4fcbb3f6a88516a1a818d1cbb73ce79ce203abbbaa59f1f902e0e117da801ef88f8435c55e1647639f7e
|
@@ -3,53 +3,53 @@ module Domrobot
|
|
3
3
|
class Nameserver
|
4
4
|
class << self
|
5
5
|
def check *args
|
6
|
-
args = stringify_keys args.first
|
6
|
+
args = Util.stringify_keys args.first
|
7
7
|
return false unless args["domain"]
|
8
8
|
return false unless args["ns"]
|
9
9
|
run __method__, args
|
10
10
|
end
|
11
11
|
|
12
12
|
def create *args
|
13
|
-
args = stringify_keys args.first
|
13
|
+
args = Util.stringify_keys args.first
|
14
14
|
return false unless args["domain"]
|
15
15
|
return false unless args["type"]
|
16
16
|
run __method__, args
|
17
17
|
end
|
18
18
|
|
19
19
|
def createRecord *args
|
20
|
-
args = stringify_keys args.first
|
20
|
+
args = Util.stringify_keys args.first
|
21
21
|
return false unless args["domain"]
|
22
22
|
return false unless args["type"]
|
23
23
|
run __method__, args
|
24
24
|
end
|
25
25
|
|
26
26
|
def info *args
|
27
|
-
args = stringify_keys args.first
|
27
|
+
args = Util.stringify_keys args.first
|
28
28
|
run __method__, args
|
29
29
|
end
|
30
30
|
|
31
31
|
def list *args
|
32
|
-
args = stringify_keys args.first
|
32
|
+
args = Util.stringify_keys args.first
|
33
33
|
run __method__, args
|
34
34
|
end
|
35
35
|
|
36
36
|
def update *args
|
37
|
-
args = stringify_keys args.first
|
37
|
+
args = Util.stringify_keys args.first
|
38
38
|
run __method__, args
|
39
39
|
end
|
40
40
|
|
41
41
|
def delete *args
|
42
|
-
args = stringify_keys args.first
|
42
|
+
args = Util.stringify_keys args.first
|
43
43
|
run __method__, args
|
44
44
|
end
|
45
45
|
|
46
46
|
def updateRecord *args
|
47
|
-
args = stringify_keys args.first
|
47
|
+
args = Util.stringify_keys args.first
|
48
48
|
return false unless args["id"]
|
49
49
|
run __method__, args
|
50
50
|
end
|
51
51
|
def deleteRecord *args
|
52
|
-
args = stringify_keys args.first
|
52
|
+
args = Util.stringify_keys args.first
|
53
53
|
return false unless args["id"]
|
54
54
|
run __method__, args
|
55
55
|
end
|
@@ -57,14 +57,11 @@ module Domrobot
|
|
57
57
|
private
|
58
58
|
def run method, params
|
59
59
|
Domrobot.login
|
60
|
-
Domrobot.run(object,method,params
|
60
|
+
Domrobot.run(object,method,Util.stringify_keys(params))
|
61
61
|
end
|
62
62
|
def object
|
63
63
|
"nameserver"
|
64
64
|
end
|
65
|
-
def stringify_keys params
|
66
|
-
params.map{|k,v|["#{k}",v]}.to_h
|
67
|
-
end
|
68
65
|
end
|
69
66
|
end
|
70
67
|
end
|
@@ -5,7 +5,7 @@ module Domrobot
|
|
5
5
|
class << self
|
6
6
|
def where params={}
|
7
7
|
return unless params[:domain]
|
8
|
-
Domrobot.nameserver.info(domain
|
8
|
+
Domrobot.nameserver.info("domain" => params[:domain])["resData"]["record"].select do |record_data|
|
9
9
|
params.reject{|k,v|k==:domain}.collect do |property,value|
|
10
10
|
record_data[property.to_s].match(value) != nil
|
11
11
|
end.reduce(:&)
|
@@ -18,16 +18,17 @@ module Domrobot
|
|
18
18
|
end
|
19
19
|
end
|
20
20
|
def save
|
21
|
-
|
21
|
+
puts self.to_h
|
22
|
+
Domrobot.nameserver.createRecord Util.stringify_keys(self.to_h).reject{|k,v|k=="id"}
|
22
23
|
end
|
23
24
|
def update
|
24
|
-
Domrobot.nameserver.updateRecord
|
25
|
+
Domrobot.nameserver.updateRecord Util.stringify_keys(self.to_h)..reject{|k,v|%w{type domain}.include? k}
|
25
26
|
end
|
26
27
|
def delete
|
27
|
-
Domrobot.nameserver.deleteRecord({"id"
|
28
|
+
Domrobot.nameserver.deleteRecord({"id" => self.id})
|
28
29
|
end
|
29
|
-
def
|
30
|
-
|
30
|
+
def to_h
|
31
|
+
@table
|
31
32
|
end
|
32
33
|
end
|
33
34
|
end
|
data/lib/domrobot/version.rb
CHANGED
data/lib/domrobot.rb
CHANGED
@@ -1,4 +1,7 @@
|
|
1
1
|
require "domrobot/version"
|
2
|
+
|
3
|
+
require "domrobot/util"
|
4
|
+
|
2
5
|
require "domrobot/config"
|
3
6
|
require "inwx/domrobot"
|
4
7
|
|
@@ -18,8 +21,7 @@ module Domrobot
|
|
18
21
|
@login = result["code"] == 1000
|
19
22
|
end
|
20
23
|
def run object, method, params
|
21
|
-
|
22
|
-
robot.call(object.to_s, method.to_s, params)
|
24
|
+
robot.call(object.to_s, method.to_s, Util.stringify_keys(params))
|
23
25
|
end
|
24
26
|
def nameserver
|
25
27
|
Domrobot::Sections::Nameserver
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: domrobot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mathias Kaufmann
|
@@ -165,6 +165,7 @@ files:
|
|
165
165
|
- lib/domrobot/subdomain.rb
|
166
166
|
- lib/domrobot/types.rb
|
167
167
|
- lib/domrobot/types/record.rb
|
168
|
+
- lib/domrobot/util.rb
|
168
169
|
- lib/domrobot/version.rb
|
169
170
|
homepage: https://domrobot.stei.gr
|
170
171
|
licenses: []
|