namecheap-client 0.1.2 → 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 +4 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f1bcf23bd469fa4342bb5b6b2f95b55c159ae97f27bb2be711868f79964a5429
4
- data.tar.gz: 7a94aeb933aca1d619a87835ab74837015bdcb729c7a10403abdec24f3d0e1b2
3
+ metadata.gz: c66c8ab2cb269a6d84e9511188f1d3e6b391397131c7ddaeb5bea825024b9dcb
4
+ data.tar.gz: ff00284b996c1d50d9b7b5295295387aef22aecf4d791122627058d945f57621
5
5
  SHA512:
6
- metadata.gz: c3c37fd4ebac4830b7e9d0bd0ffdaef2fba725b363de2ee51d0684febf01887ece815c0b8f7333a5241682f374aa5248b72efc2efc181c39b72da444931c7711
7
- data.tar.gz: 4d85b6ed4ba2a748813b6977e14675ec88c5f6f5fe5bafe4c83bcfea67632f25fe3d894fd52e0fbb1bdad39a68921a74afc252adfc3283046f8013194f6ecfcd
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.2
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-23 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
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 0.13.10
47
+ version: 1.13.10
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 0.13.10
54
+ version: 1.13.10
55
55
  description: A simple Ruby client library for interacting with the [Namecheap API](https://www.namecheap.com/support/api/intro/),
56
56
  allowing you to manage your domains programmatically.
57
57
  email: leandro@massprospecting.com