mtgsy 0.3.0 → 0.3.1
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/CHANGELOG.rdoc +6 -0
- data/README.md +7 -0
- data/lib/mtgsy/api_client.rb +22 -10
- data/lib/mtgsy/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6460a4c709215cff95ed1eddeda82621f02e795b
|
|
4
|
+
data.tar.gz: ae185e397c3eb983ce93ccf0eb472ecd3095c517
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 379e75a84cf175cb24c9f94b047ee22cd0faaed88b752e7cdbe8e80c5346c279420311cd7d1258523f48c494a37ad8fca3d3313a9c7e26816d9e752621e1d26a
|
|
7
|
+
data.tar.gz: a9d328297a397973e6bc6664cee2824dc6f775b25799d5b79ae94b17016c2c60bb66d9cb708d878b8ab3c673ec80d9105bd64c3d2eab2fb3fc3c5ac266cd725a
|
data/CHANGELOG.rdoc
CHANGED
data/README.md
CHANGED
|
@@ -41,6 +41,13 @@ Or install it yourself as:
|
|
|
41
41
|
client.records("CNAME") # Returns an array of all CNAME records in the zone
|
|
42
42
|
client.records("AAAA") # Returns an array of all AAAA records in the zone
|
|
43
43
|
|
|
44
|
+
## Search records by name, data, type, aux, ttl. You can search using one or many:
|
|
45
|
+
client.search(name: "myrecord") # Returns all records whose name matches __exactly__.
|
|
46
|
+
client.search(data: "123.123.123.123") # Returns all records whose data matches __exactly__.
|
|
47
|
+
client.search(type: "A") # Returns all A records.
|
|
48
|
+
client.search(type: "A", data: "123.123.123.123") # Returns all A records whose data also matches __exactly__.
|
|
49
|
+
client.search(ttl: 900) # Returns all records whose ttl is 900.
|
|
50
|
+
|
|
44
51
|
## List all possible records types:
|
|
45
52
|
client.record_types?
|
|
46
53
|
|
data/lib/mtgsy/api_client.rb
CHANGED
|
@@ -32,9 +32,7 @@ module Mtgsy
|
|
|
32
32
|
aux = options[:aux ] ? options[:aux].to_s : @aux.to_s
|
|
33
33
|
ttl = options[:ttl ] ? options[:ttl].to_s : @ttl.to_s
|
|
34
34
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
what_happened?(@agent, command)
|
|
35
|
+
post_wrapper([ command, name, type, data, aux, ttl ], @agent, command)
|
|
38
36
|
end
|
|
39
37
|
|
|
40
38
|
def delete_record(options={})
|
|
@@ -45,9 +43,7 @@ module Mtgsy
|
|
|
45
43
|
aux = options[:aux ] ? options[:aux].to_s : nil
|
|
46
44
|
ttl = options[:ttl ] ? options[:ttl].to_s : nil
|
|
47
45
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
what_happened?(@agent, command)
|
|
46
|
+
post_wrapper([ command, name, type, data, aux, ttl ], @agent, command)
|
|
51
47
|
end
|
|
52
48
|
|
|
53
49
|
def update_record(options={})
|
|
@@ -58,9 +54,7 @@ module Mtgsy
|
|
|
58
54
|
aux = options[:aux ] ? options[:aux].to_s : nil
|
|
59
55
|
ttl = options[:ttl ] ? options[:ttl].to_s : nil
|
|
60
56
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
what_happened?(@agent, command)
|
|
57
|
+
post_wrapper([ command, name, type, data, aux, ttl ], @agent, command)
|
|
64
58
|
end
|
|
65
59
|
|
|
66
60
|
alias :add :add_record
|
|
@@ -127,7 +121,20 @@ module Mtgsy
|
|
|
127
121
|
end
|
|
128
122
|
|
|
129
123
|
private
|
|
124
|
+
def post_wrapper(data, agent, command)
|
|
125
|
+
begin
|
|
126
|
+
post_to_mtgsy(data)
|
|
127
|
+
rescue RuntimeError => e
|
|
128
|
+
puts e.message
|
|
129
|
+
else
|
|
130
|
+
what_happened?(agent, command)
|
|
131
|
+
end
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
|
|
130
135
|
def post_to_mtgsy(params)
|
|
136
|
+
raise "ERROR: Domain name is required." unless @domainname
|
|
137
|
+
|
|
131
138
|
command = params[Mtgsy::POST_COMMAND]
|
|
132
139
|
name = params[Mtgsy::POST_NAME]
|
|
133
140
|
type = params[Mtgsy::POST_TYPE]
|
|
@@ -167,7 +174,12 @@ module Mtgsy
|
|
|
167
174
|
when 305
|
|
168
175
|
$stderr.puts "Domain not found"
|
|
169
176
|
when 310
|
|
170
|
-
|
|
177
|
+
case command
|
|
178
|
+
when "deleterecord"
|
|
179
|
+
$stderr.puts "Record not found"
|
|
180
|
+
else
|
|
181
|
+
$stderr.puts "Record not found / problem adding record"
|
|
182
|
+
end
|
|
171
183
|
when 200
|
|
172
184
|
$stderr.puts "Insufficcient information supplied"
|
|
173
185
|
end
|
data/lib/mtgsy/version.rb
CHANGED