dynect_rest 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.0
1
+ 0.3.0
@@ -173,6 +173,7 @@ class DynectRest
173
173
  response = block.call
174
174
  response.body
175
175
  rescue RestClient::Exception => e
176
+ puts "I have #{e.inspect} with #{e.http_code}"
176
177
  if e.http_code == 307
177
178
  get(e.response)
178
179
  end
@@ -69,7 +69,14 @@ class DynectRest
69
69
  record =~ /^#{resource_path(:full)}\/#{fqdn}\/(\d+)$/
70
70
  raw_rr_list << self.get(fqdn, $1)
71
71
  end
72
- raw_rr_list.length == 1 ? raw_rr_list[0] : raw_rr_list
72
+ case raw_rr_list.length
73
+ when 0
74
+ raise DynectRest::Exceptions::RequestFailed, "Cannot find #{record_type} record for #{fqdn}"
75
+ when 1
76
+ raw_rr_list[0]
77
+ else
78
+ raw_rr_list
79
+ end
73
80
  end
74
81
  end
75
82
 
@@ -85,7 +92,7 @@ class DynectRest
85
92
 
86
93
  def save(replace=false)
87
94
  if record_id
88
- @dynect.put("#{resource_path}/#{@fqdn}/#{@record_id}", self)
95
+ @dynect.put("#{resource_path}/#{@fqdn}/#{record_id}", self)
89
96
  else
90
97
  if replace == true || replace == :replace
91
98
  @dynect.put("#{resource_path}/#{@fqdn}", self)
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
- - 2
7
+ - 3
8
8
  - 0
9
- version: 0.2.0
9
+ version: 0.3.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - Adam Jacob