namecheap-client 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/namecheap-client.rb +10 -1
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 82fd94811ffc532aac0b2e9fbdf08b96660993f4196486aaea959eafea04abc8
4
- data.tar.gz: f1b24f4561d2206878ddff49daf9cb76f166d32c21e058220fa391dfc9b96b4a
3
+ metadata.gz: c66c8ab2cb269a6d84e9511188f1d3e6b391397131c7ddaeb5bea825024b9dcb
4
+ data.tar.gz: ff00284b996c1d50d9b7b5295295387aef22aecf4d791122627058d945f57621
5
5
  SHA512:
6
- metadata.gz: 5709e2b3b40e39aa7ab324246e6628e633034d6febcb76ca86913e2e598eb199dc24d82d9abbc9a2cb4f1084fa06f86f9e96be36c1da19347d6c3e31c5e9ec9f
7
- data.tar.gz: 5c2266df31eb45f91ead7cd724b84a2f73dffef4aeaaf162e3813363768151a9ab6e34b38d63257065a2739691254d0d03ac54f1c88acb9b275227a3d7612841
6
+ metadata.gz: 801959101b211c6912e3094d3aeec7ab6a6726c35c6c0233d189647de50d1a8d86153ce10285054ad9b1bfc07b1c568887abf005818ff27c2d73b4f3ebd09339
7
+ data.tar.gz: 01a7d5497f7ad6b5205e5bc58d24a89f41ec01fc5802996a352e819511a04f803b0889b2ad4530010b25bd6ee0d990aaeb4423551eb434e851ef061188b47539
@@ -154,7 +154,16 @@ class NamecheapClient
154
154
  end
155
155
 
156
156
  def parse_errors(xml_response)
157
- errors = xml_response.xpath('//Errors/Error').map(&:text)
157
+ # Parse the XML if it's a string; otherwise, assume it's already a Nokogiri document
158
+ doc = xml_response.is_a?(String) ? Nokogiri::XML(xml_response) : xml_response
159
+
160
+ # Define the namespace with a prefix (e.g., 'nc' for Namecheap)
161
+ namespaces = { 'nc' => 'http://api.namecheap.com/xml.response' }
162
+
163
+ # Use the namespace prefix in your XPath query
164
+ errors = doc.xpath('//nc:Errors/nc:Error', namespaces).map(&:text)
165
+
166
+ # Join the error messages with a semicolon and space
158
167
  errors.join('; ')
159
168
  end
160
169
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: namecheap-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Leandro Daniel Sardi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-09-24 00:00:00.000000000 Z
11
+ date: 2024-09-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: net-http