mtgsy 0.3.0 → 0.3.1

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: d8de684ba598b5206bc2766c30b62cb6609bdc76
4
- data.tar.gz: 6e9bb17d708a1d88f894b07f1dde106a2cfa0c29
3
+ metadata.gz: 6460a4c709215cff95ed1eddeda82621f02e795b
4
+ data.tar.gz: ae185e397c3eb983ce93ccf0eb472ecd3095c517
5
5
  SHA512:
6
- metadata.gz: 9a77fc5398d06bf09d7d3222c9aaac3df01efc3bd9c75a48a46e2b1aef4bc5d668c8a18c7ee2cac3b0a62ddbe8743f0693890c1687399f774333c2e06c83d9a4
7
- data.tar.gz: 439c005fe1896d5d46cc7858531bad6fdf107c6f5779ffb1242ea29e7d237146efb93a0cf60eda0a2fee50f022d1638fb80265c93eb16cc454e7646ff3f808c2
6
+ metadata.gz: 379e75a84cf175cb24c9f94b047ee22cd0faaed88b752e7cdbe8e80c5346c279420311cd7d1258523f48c494a37ad8fca3d3313a9c7e26816d9e752621e1d26a
7
+ data.tar.gz: a9d328297a397973e6bc6664cee2824dc6f775b25799d5b79ae94b17016c2c60bb66d9cb708d878b8ab3c673ec80d9105bd64c3d2eab2fb3fc3c5ac266cd725a
data/CHANGELOG.rdoc CHANGED
@@ -1,3 +1,9 @@
1
+ === 0.3.1
2
+
3
+ * Bugfixes
4
+ * Added an exception when no domain name is given so the user actually knows
5
+ what's up. Before it looked like a random code error.
6
+
1
7
  === 0.3.0
2
8
 
3
9
  * New Features
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
 
@@ -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
- post_to_mtgsy([ command, name, type, data, aux, ttl ])
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
- post_to_mtgsy([ command, name, type, data, aux, ttl ])
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
- post_to_mtgsy([ command, name, type, data, aux, ttl ])
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
- $stderr.puts "Record not found / problem adding record"
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
@@ -1,3 +1,3 @@
1
1
  module Mtgsy
2
- VERSION = "0.3.0"
2
+ VERSION = "0.3.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mtgsy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jason Barnett