epp-ruby 3.0.0

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.
Files changed (178) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +24 -0
  3. data/.simplecov +16 -0
  4. data/.travis.yml +11 -0
  5. data/.yardopts +4 -0
  6. data/CHANGELOG.md +31 -0
  7. data/Gemfile +20 -0
  8. data/Gemfile.lock +51 -0
  9. data/LICENSE +21 -0
  10. data/README.md +95 -0
  11. data/Rakefile +20 -0
  12. data/epp-ruby.gemspec +22 -0
  13. data/examples/contact_create.rb +28 -0
  14. data/examples/domain_check.rb +11 -0
  15. data/examples/domain_create.rb +19 -0
  16. data/examples/domain_info.rb +9 -0
  17. data/examples/host_create.rb +14 -0
  18. data/gemfiles/Gemfile.ruby18 +14 -0
  19. data/lib/epp-client/client.rb +172 -0
  20. data/lib/epp-client/commands/check.rb +11 -0
  21. data/lib/epp-client/commands/command.rb +24 -0
  22. data/lib/epp-client/commands/create.rb +11 -0
  23. data/lib/epp-client/commands/delete.rb +11 -0
  24. data/lib/epp-client/commands/info.rb +11 -0
  25. data/lib/epp-client/commands/login.rb +40 -0
  26. data/lib/epp-client/commands/logout.rb +11 -0
  27. data/lib/epp-client/commands/poll.rb +28 -0
  28. data/lib/epp-client/commands/read_write_command.rb +18 -0
  29. data/lib/epp-client/commands/renew.rb +11 -0
  30. data/lib/epp-client/commands/transfer.rb +25 -0
  31. data/lib/epp-client/commands/transfer_handshake.rb +43 -0
  32. data/lib/epp-client/commands/update.rb +11 -0
  33. data/lib/epp-client/contact/check.rb +23 -0
  34. data/lib/epp-client/contact/check_response.rb +41 -0
  35. data/lib/epp-client/contact/command.rb +106 -0
  36. data/lib/epp-client/contact/create.rb +34 -0
  37. data/lib/epp-client/contact/create_response.rb +14 -0
  38. data/lib/epp-client/contact/delete.rb +21 -0
  39. data/lib/epp-client/contact/delete_response.rb +9 -0
  40. data/lib/epp-client/contact/info.rb +21 -0
  41. data/lib/epp-client/contact/info_response.rb +74 -0
  42. data/lib/epp-client/contact/response.rb +34 -0
  43. data/lib/epp-client/contact/transfer.rb +21 -0
  44. data/lib/epp-client/contact/transfer_response.rb +26 -0
  45. data/lib/epp-client/contact/update.rb +80 -0
  46. data/lib/epp-client/contact/update_response.rb +9 -0
  47. data/lib/epp-client/domain/check.rb +23 -0
  48. data/lib/epp-client/domain/check_response.rb +41 -0
  49. data/lib/epp-client/domain/command.rb +92 -0
  50. data/lib/epp-client/domain/create.rb +75 -0
  51. data/lib/epp-client/domain/create_response.rb +29 -0
  52. data/lib/epp-client/domain/delete.rb +21 -0
  53. data/lib/epp-client/domain/delete_response.rb +9 -0
  54. data/lib/epp-client/domain/info.rb +21 -0
  55. data/lib/epp-client/domain/info_response.rb +72 -0
  56. data/lib/epp-client/domain/list.rb +36 -0
  57. data/lib/epp-client/domain/renew.rb +38 -0
  58. data/lib/epp-client/domain/renew_response.rb +14 -0
  59. data/lib/epp-client/domain/response.rb +34 -0
  60. data/lib/epp-client/domain/transfer.rb +37 -0
  61. data/lib/epp-client/domain/transfer_response.rb +29 -0
  62. data/lib/epp-client/domain/update.rb +81 -0
  63. data/lib/epp-client/domain/update_response.rb +9 -0
  64. data/lib/epp-client/host/check.rb +23 -0
  65. data/lib/epp-client/host/check_response.rb +41 -0
  66. data/lib/epp-client/host/command.rb +47 -0
  67. data/lib/epp-client/host/create.rb +24 -0
  68. data/lib/epp-client/host/create_response.rb +14 -0
  69. data/lib/epp-client/host/delete.rb +21 -0
  70. data/lib/epp-client/host/delete_response.rb +9 -0
  71. data/lib/epp-client/host/info.rb +21 -0
  72. data/lib/epp-client/host/info_response.rb +42 -0
  73. data/lib/epp-client/host/response.rb +34 -0
  74. data/lib/epp-client/host/update.rb +76 -0
  75. data/lib/epp-client/host/update_response.rb +9 -0
  76. data/lib/epp-client/old_server.rb +25 -0
  77. data/lib/epp-client/request.rb +51 -0
  78. data/lib/epp-client/requests/abstract.rb +30 -0
  79. data/lib/epp-client/requests/command.rb +28 -0
  80. data/lib/epp-client/requests/extension.rb +28 -0
  81. data/lib/epp-client/requests/hello.rb +12 -0
  82. data/lib/epp-client/response.rb +100 -0
  83. data/lib/epp-client/response_error.rb +15 -0
  84. data/lib/epp-client/response_helper.rb +25 -0
  85. data/lib/epp-client/server.rb +330 -0
  86. data/lib/epp-client/testing.rb +59 -0
  87. data/lib/epp-client/version.rb +3 -0
  88. data/lib/epp-client/xml_helper.rb +71 -0
  89. data/lib/epp-client.rb +103 -0
  90. data/lib/epp-ruby.rb +1 -0
  91. data/test/commands/test_check_command.rb +33 -0
  92. data/test/commands/test_create_command.rb +53 -0
  93. data/test/commands/test_delete_command.rb +28 -0
  94. data/test/commands/test_info_command.rb +28 -0
  95. data/test/commands/test_login_command.rb +56 -0
  96. data/test/commands/test_logout_command.rb +22 -0
  97. data/test/commands/test_poll_command.rb +54 -0
  98. data/test/commands/test_renew_command.rb +39 -0
  99. data/test/commands/test_transfer_command.rb +37 -0
  100. data/test/commands/test_update_command.rb +60 -0
  101. data/test/contact/test_contact_check.rb +33 -0
  102. data/test/contact/test_contact_check_response.rb +88 -0
  103. data/test/contact/test_contact_create.rb +71 -0
  104. data/test/contact/test_contact_create_response.rb +33 -0
  105. data/test/contact/test_contact_delete.rb +28 -0
  106. data/test/contact/test_contact_delete_response.rb +23 -0
  107. data/test/contact/test_contact_info.rb +28 -0
  108. data/test/contact/test_contact_info_response.rb +100 -0
  109. data/test/contact/test_contact_transfer.rb +28 -0
  110. data/test/contact/test_contact_transfer_response.rb +100 -0
  111. data/test/contact/test_contact_update.rb +84 -0
  112. data/test/contact/test_contact_update_response.rb +23 -0
  113. data/test/domain/test_domain_check.rb +33 -0
  114. data/test/domain/test_domain_check_response.rb +88 -0
  115. data/test/domain/test_domain_create.rb +108 -0
  116. data/test/domain/test_domain_create_response.rb +70 -0
  117. data/test/domain/test_domain_delete.rb +28 -0
  118. data/test/domain/test_domain_delete_response.rb +23 -0
  119. data/test/domain/test_domain_info.rb +28 -0
  120. data/test/domain/test_domain_info_response.rb +146 -0
  121. data/test/domain/test_domain_renew.rb +91 -0
  122. data/test/domain/test_domain_renew_response.rb +32 -0
  123. data/test/domain/test_domain_transfer.rb +89 -0
  124. data/test/domain/test_domain_transfer_response.rb +112 -0
  125. data/test/domain/test_domain_update.rb +73 -0
  126. data/test/domain/test_domain_update_response.rb +23 -0
  127. data/test/fixtures/responses/contact/check-single.xml +20 -0
  128. data/test/fixtures/responses/contact/check.xml +27 -0
  129. data/test/fixtures/responses/contact/create.xml +19 -0
  130. data/test/fixtures/responses/contact/delete.xml +12 -0
  131. data/test/fixtures/responses/contact/info.xml +49 -0
  132. data/test/fixtures/responses/contact/transfer-query.xml +23 -0
  133. data/test/fixtures/responses/contact/transfer-request.xml +23 -0
  134. data/test/fixtures/responses/contact/update.xml +12 -0
  135. data/test/fixtures/responses/domain/check-single.xml +20 -0
  136. data/test/fixtures/responses/domain/check.xml +27 -0
  137. data/test/fixtures/responses/domain/create-pending.xml +12 -0
  138. data/test/fixtures/responses/domain/create.xml +20 -0
  139. data/test/fixtures/responses/domain/delete.xml +12 -0
  140. data/test/fixtures/responses/domain/info-no-exDate.xml +38 -0
  141. data/test/fixtures/responses/domain/info-ns-hostAttr-name-only.xml +34 -0
  142. data/test/fixtures/responses/domain/info-ns-hostAttr.xml +38 -0
  143. data/test/fixtures/responses/domain/info.xml +40 -0
  144. data/test/fixtures/responses/domain/renew.xml +19 -0
  145. data/test/fixtures/responses/domain/transfer-query.xml +24 -0
  146. data/test/fixtures/responses/domain/transfer-request.xml +24 -0
  147. data/test/fixtures/responses/domain/update.xml +12 -0
  148. data/test/fixtures/responses/greeting.xml +25 -0
  149. data/test/fixtures/responses/host/check-single.xml +20 -0
  150. data/test/fixtures/responses/host/check.xml +27 -0
  151. data/test/fixtures/responses/host/create.xml +19 -0
  152. data/test/fixtures/responses/host/delete.xml +12 -0
  153. data/test/fixtures/responses/host/info.xml +30 -0
  154. data/test/fixtures/responses/host/update.xml +12 -0
  155. data/test/helper.rb +100 -0
  156. data/test/host/test_host_check.rb +33 -0
  157. data/test/host/test_host_check_response.rb +88 -0
  158. data/test/host/test_host_create.rb +37 -0
  159. data/test/host/test_host_create_response.rb +33 -0
  160. data/test/host/test_host_delete.rb +28 -0
  161. data/test/host/test_host_delete_response.rb +23 -0
  162. data/test/host/test_host_info.rb +28 -0
  163. data/test/host/test_host_info_response.rb +72 -0
  164. data/test/host/test_host_update.rb +68 -0
  165. data/test/host/test_host_update_response.rb +23 -0
  166. data/test/requests/test_command_request.rb +16 -0
  167. data/test/requests/test_extension_request.rb +55 -0
  168. data/test/requests/test_hello_request.rb +15 -0
  169. data/test/support/schemas/all.xsd +21 -0
  170. data/test/support/schemas/contact-1.0.xsd +387 -0
  171. data/test/support/schemas/domain-1.0.xsd +432 -0
  172. data/test/support/schemas/epp-1.0.xsd +403 -0
  173. data/test/support/schemas/eppcom-1.0.xsd +93 -0
  174. data/test/support/schemas/host-1.0.xsd +240 -0
  175. data/test/test_client.rb +64 -0
  176. data/test/test_request.rb +15 -0
  177. data/test/test_server.rb +67 -0
  178. metadata +322 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 1a9a384212937da97b713b5a728f1ee179e0098abbb212b7d91e69c9a0e77415
4
+ data.tar.gz: cd988b9429ed50c45f23e470d5f8cf4f03a858444df4175d208b732f65eea084
5
+ SHA512:
6
+ metadata.gz: d5397574a26e6fd0f88696f3d8e48c563e4460d1ef2e474cfc8238946d8824cf124b1dfdbaab5f0c785bf74512081c4c1887fc1c13cac3eff9525e674f1a3e95
7
+ data.tar.gz: 94abfc7ed00ad710e4063b1139d9e345e6480d0e1f36ac630bb597520b391705f0e891fee624efe6c64348643660779aad4af7c3dfa87a1503d5af56a40d9f72
data/.gitignore ADDED
@@ -0,0 +1,24 @@
1
+ ## MAC OS
2
+ .DS_Store
3
+
4
+ ## TEXTMATE
5
+ *.tmproj
6
+ tmtags
7
+
8
+ ## EMACS
9
+ *~
10
+ \#*
11
+ .\#*
12
+
13
+ ## VIM
14
+ *.swp
15
+
16
+ ## PROJECT::GENERAL
17
+ .bundle
18
+ coverage
19
+ rdoc
20
+ pkg
21
+
22
+ ## PROJECT::SPECIFIC
23
+ .yardoc
24
+ doc
data/.simplecov ADDED
@@ -0,0 +1,16 @@
1
+ SimpleCov.start do
2
+ add_group 'Core' do |src_file|
3
+ File.dirname(src_file.filename) =~ %r</lib(/epp-client)?$>
4
+ end
5
+
6
+ add_group 'Commands', 'lib/epp-client/commands'
7
+ add_group 'Requests', 'lib/epp-client/requests'
8
+ add_group 'Responses', 'lib/epp-client/responses'
9
+
10
+ add_group 'EPP Domain', 'lib/epp-client/domain'
11
+ add_group 'EPP Contact', 'lib/epp-client/contact'
12
+ add_group 'EPP Host', 'lib/epp-client/host'
13
+
14
+ add_filter '/.bundle/'
15
+ add_filter '/test/'
16
+ end
data/.travis.yml ADDED
@@ -0,0 +1,11 @@
1
+ language: ruby
2
+ bundler_args: --without doc coverage
3
+ rvm:
4
+ - 1.9.3
5
+ - 2.0.0
6
+ matrix:
7
+ include:
8
+ - rvm: 1.8.7
9
+ gemfile: gemfiles/Gemfile.ruby18
10
+ - rvm: ree
11
+ gemfile: gemfiles/Gemfile.ruby18
data/.yardopts ADDED
@@ -0,0 +1,4 @@
1
+ lib/**/*.rb
2
+ -r README.md
3
+ -
4
+ LICENSE
data/CHANGELOG.md ADDED
@@ -0,0 +1,31 @@
1
+ # Changelog
2
+
3
+ ## 3.0.0 (2026-04-03)
4
+
5
+ Forked from [railsguru/epp-client](https://github.com/railsguru/epp-client) v2.1.0 and published as `epp-ruby`.
6
+
7
+ ### Added
8
+ - Domain list command
9
+ - Transfer handshake command (accept/reject)
10
+ - Domain create response parser
11
+ - Examples for domain create, check, info, contact create, and host create
12
+
13
+ ### Improved
14
+ - Domain create with nameservers, registrant, and auth info support
15
+ - Domain renew with flexible period/unit options
16
+ - Domain transfer with operation type support
17
+ - Contact command improvements
18
+
19
+ ### Fixed
20
+ - Auto-load issues
21
+ - Various bug fixes
22
+
23
+ ## 2.1.0 (2014-07-04)
24
+
25
+ *Original release by Geoff Garside as epp-client*
26
+
27
+ - Domain pending response support
28
+ - Period range validations
29
+ - Multiple street support for contacts
30
+ - Host attribute namespace fix
31
+ - Domain info returns all statuses
data/Gemfile ADDED
@@ -0,0 +1,20 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in epp-client.gemspec
4
+ gemspec
5
+
6
+ gem 'rake'
7
+
8
+ group :doc do
9
+ gem 'yard'
10
+ gem 'redcarpet'
11
+ end
12
+
13
+ group :test do
14
+ gem 'shoulda'
15
+ gem 'mocha'
16
+ end
17
+
18
+ group :coverage do
19
+ gem 'simplecov', :platforms => [:ruby_19, :ruby_20, :rbx]
20
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,51 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ epp-client (2.1.0)
5
+ libxml-ruby
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ activesupport (4.0.0)
11
+ i18n (~> 0.6, >= 0.6.4)
12
+ minitest (~> 4.2)
13
+ multi_json (~> 1.3)
14
+ thread_safe (~> 0.1)
15
+ tzinfo (~> 0.3.37)
16
+ atomic (1.1.13)
17
+ i18n (0.6.5)
18
+ libxml-ruby (2.7.0)
19
+ metaclass (0.0.1)
20
+ minitest (4.7.5)
21
+ mocha (0.14.0)
22
+ metaclass (~> 0.0.1)
23
+ multi_json (1.7.9)
24
+ rake (10.1.0)
25
+ redcarpet (3.0.0)
26
+ shoulda (3.5.0)
27
+ shoulda-context (~> 1.0, >= 1.0.1)
28
+ shoulda-matchers (>= 1.4.1, < 3.0)
29
+ shoulda-context (1.1.5)
30
+ shoulda-matchers (2.3.0)
31
+ activesupport (>= 3.0.0)
32
+ simplecov (0.7.1)
33
+ multi_json (~> 1.0)
34
+ simplecov-html (~> 0.7.1)
35
+ simplecov-html (0.7.1)
36
+ thread_safe (0.1.2)
37
+ atomic
38
+ tzinfo (0.3.37)
39
+ yard (0.8.7)
40
+
41
+ PLATFORMS
42
+ ruby
43
+
44
+ DEPENDENCIES
45
+ epp-client!
46
+ mocha
47
+ rake
48
+ redcarpet
49
+ shoulda
50
+ simplecov
51
+ yard
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ Copyright (c) 2025 Vibol Teav
2
+ Copyright (c) 2010 Geoff Garside (M247 Ltd)
3
+
4
+ Permission is hereby granted, free of charge, to any person obtaining
5
+ a copy of this software and associated documentation files (the
6
+ "Software"), to deal in the Software without restriction, including
7
+ without limitation the rights to use, copy, modify, merge, publish,
8
+ distribute, sublicense, and/or sell copies of the Software, and to
9
+ permit persons to whom the Software is furnished to do so, subject to
10
+ the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be
13
+ included in all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,95 @@
1
+ # epp-ruby
2
+
3
+ Ruby client for communicating with EPP (Extensible Provisioning Protocol) services. Supports domain, contact, and host management including transfer handshake and domain listing.
4
+
5
+ Maintained fork of [railsguru/epp-client](https://github.com/railsguru/epp-client) with additional features and fixes.
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'epp-ruby'
13
+ ```
14
+
15
+ Or install it yourself:
16
+
17
+ ```
18
+ $ gem install epp-ruby
19
+ ```
20
+
21
+ ## Usage
22
+
23
+ ```ruby
24
+ require 'epp-ruby'
25
+
26
+ client = EPP::Client.new('username', 'password', 'epp.server.com')
27
+ client.hello
28
+ ```
29
+
30
+ ### Domain Check
31
+
32
+ ```ruby
33
+ resp = client.check EPP::Domain::Check.new('example.com', 'example.net')
34
+ check = EPP::Domain::CheckResponse.new(resp)
35
+ check.available?('example.com') #=> true
36
+ check.available?('example.net') #=> false
37
+ ```
38
+
39
+ ### Domain Info
40
+
41
+ ```ruby
42
+ resp = client.info EPP::Domain::Info.new('example.com')
43
+ info = EPP::Domain::InfoResponse.new(resp)
44
+ info.name #=> "example.com"
45
+ info.nameservers #=> [{"name"=>"ns1.example.net"}]
46
+ ```
47
+
48
+ ### Domain Create
49
+
50
+ ```ruby
51
+ resp = client.create EPP::Domain::Create.new('example.com', period: 1, unit: 'y',
52
+ nameservers: ['ns1.example.net', 'ns2.example.net'],
53
+ registrant: 'contact-id',
54
+ auth_info: 'secret123')
55
+ create = EPP::Domain::CreateResponse.new(resp)
56
+ ```
57
+
58
+ ### Domain Transfer
59
+
60
+ ```ruby
61
+ resp = client.transfer EPP::Domain::Transfer.new('example.com', 'auth-code', op: 'request')
62
+ ```
63
+
64
+ ### Domain List
65
+
66
+ ```ruby
67
+ resp = client.list EPP::Domain::List.new
68
+ ```
69
+
70
+ ### Transfer Handshake (Accept/Reject)
71
+
72
+ ```ruby
73
+ resp = client.transfer_handshake EPP::Commands::TransferHandshake.new('example.com', op: 'approve')
74
+ ```
75
+
76
+ ## Available Commands
77
+
78
+ * `check` — check domain/contact/host availability
79
+ * `create` — register domains, contacts, or hosts
80
+ * `delete` — remove domains, contacts, or hosts
81
+ * `info` — query domain/contact/host details
82
+ * `renew` — renew domain registration
83
+ * `transfer` — initiate or query domain transfers
84
+ * `transfer_handshake` — accept or reject pending transfers
85
+ * `update` — modify domains, contacts, or hosts
86
+ * `poll` / `ack` — poll for and acknowledge messages
87
+ * `list` — list domains
88
+
89
+ ## History
90
+
91
+ This gem is a maintained fork of [epp-client](https://github.com/railsguru/epp-client) (v2.1.0) by Geoff Garside, which has been inactive since 2014. It adds transfer handshake support, domain listing, improved domain create/renew, and various bug fixes.
92
+
93
+ ## License
94
+
95
+ MIT
data/Rakefile ADDED
@@ -0,0 +1,20 @@
1
+ #!/usr/bin/env rake
2
+ require "bundler/gem_tasks"
3
+
4
+ require 'rake/testtask'
5
+ Rake::TestTask.new(:test) do |test|
6
+ test.libs << 'lib' << 'test'
7
+ test.pattern = 'test/**/test_*.rb'
8
+ test.verbose = true
9
+ end
10
+
11
+ task :default => :test
12
+
13
+ begin
14
+ require 'yard'
15
+ YARD::Rake::YardocTask.new
16
+ rescue LoadError
17
+ task :yardoc do
18
+ abort "YARD is not available. In order to run yardoc, you must: sudo gem install yard"
19
+ end
20
+ end
data/epp-ruby.gemspec ADDED
@@ -0,0 +1,22 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/epp-client/version', __FILE__)
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.authors = ["Vibol Teav", "Geoff Garside"]
6
+ gem.email = ["vibolteav@gmail.com"]
7
+ gem.description = %q{Ruby client for communicating with EPP (Extensible Provisioning Protocol) services. Supports domain, contact, and host management with transfer handshake and domain listing.}
8
+ gem.summary = %q{EPP (Extensible Provisioning Protocol) client for Ruby}
9
+ gem.homepage = "https://github.com/tvcam/epp-ruby"
10
+ gem.license = "MIT"
11
+
12
+ gem.files = `git ls-files`.split($\)
13
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
14
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
15
+ gem.name = "epp-ruby"
16
+ gem.require_paths = ["lib"]
17
+ gem.version = EPP::VERSION
18
+
19
+ gem.extra_rdoc_files = %w(LICENSE README.md)
20
+
21
+ gem.add_dependency 'libxml-ruby'
22
+ end
@@ -0,0 +1,28 @@
1
+ require 'rubygems'
2
+ require 'epp-client'
3
+
4
+ client = EPP::Client.new('USERNAME', 'password', 'epp.test.host')
5
+
6
+ command = EPP::Contact::Create.new('admin123',
7
+ postal_info: {
8
+ name: 'Test User',
9
+ org: 'Test Organisation',
10
+ addr: {
11
+ street: "Test Building\n14 Test Road",
12
+ city: "Test City",
13
+ sp: "Test Province",
14
+ pc: "TE57 1NG",
15
+ cc: "GB"
16
+ }
17
+ },
18
+ voice: '+44.1614960000',
19
+ fax: '+44.1614960001',
20
+ email: 'user@test.host',
21
+ auth_info: { pw: '324723984' },
22
+ disclose: { "0" => %w(voice email)}
23
+ )
24
+
25
+ resp = client.create command
26
+ result = EPP::Contact::CreateResponse.new(resp)
27
+ result.id #=> "admin123"
28
+ result.creation_date #=> 2014-11-27 11:15:04 +0000
@@ -0,0 +1,11 @@
1
+ require 'rubygems'
2
+ require 'epp-client'
3
+
4
+ client = EPP::Client.new('USERNAME', 'password', 'epp.test.host')
5
+
6
+ resp = client.check EPP::Domain::Check.new('example.com', 'example.net', 'example.org')
7
+ check = EPP::Domain::CheckResponse.new(resp)
8
+
9
+ check.available?('example.com') #=> true
10
+ check.available?('example.net') #=> false
11
+ check.available?('example.org') #=> false
@@ -0,0 +1,19 @@
1
+ require 'rubygems'
2
+ require 'epp-client'
3
+
4
+ client = EPP::Client.new('USERNAME', 'password', 'epp.test.host')
5
+
6
+ command = EPP::Domain::Create.new('example.com',
7
+ period: '1y', registrant: 'test9023742684',
8
+ auth_info: { pw: 'domainpassword' },
9
+ contacts: { admin: 'admin123', tech: 'admin123', billing: 'admin123' },
10
+ nameservers: [
11
+ {name: 'ns1.example.com', ipv4: '198.51.100.53'}
12
+ {name: 'ns2.example.com', ipv4: '198.51.100.54'}
13
+ ]
14
+ )
15
+
16
+ resp = client.create command
17
+ result = EPP::Domain::CreateResponse.new(resp)
18
+ result.name #=> "example.com"
19
+ result.expiration_date #=> 2014-11-27 11:15:04 +0000
@@ -0,0 +1,9 @@
1
+ require 'rubygems'
2
+ require 'epp-client'
3
+
4
+ client = EPP::Client.new('USERNAME', 'password', 'epp.test.host')
5
+
6
+ resp = client.info EPP::Domain::Info.new('example.com')
7
+ info = EPP::Domain::InfoResponse.new(resp)
8
+ info.name #=> "example.com"
9
+ info.nameservers #=> [{"name"=>"ns1.example.net"},{"name"=>"ns2.example.net"}]
@@ -0,0 +1,14 @@
1
+ require 'rubygems'
2
+ require 'epp-client'
3
+
4
+ client = EPP::Client.new('USERNAME', 'password', 'epp.test.host')
5
+
6
+ command = EPP::Host::Create.new('ns1.example.com',
7
+ ipv4: "198.51.100.53",
8
+ ipv6: "2001:db8::53:1"
9
+ )
10
+
11
+ resp = client.create command
12
+ result = EPP::Host::CreateResponse.new(resp)
13
+ result.name #=> "ns1.example.com"
14
+ result.creation_date #=> 2014-11-27 11:15:04 +0000
@@ -0,0 +1,14 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in epp-client.gemspec
4
+ gemspec :path => '../'
5
+
6
+ gem 'rake'
7
+ gem 'i18n', '~> 0.6.11'
8
+ gem 'activesupport', '~> 3.2.14'
9
+
10
+ group :test do
11
+ gem 'shoulda-matchers', '~> 1.5.6'
12
+ gem 'shoulda'
13
+ gem 'mocha'
14
+ end
@@ -0,0 +1,172 @@
1
+ module EPP
2
+ # Front facing EPP Client.
3
+ #
4
+ # Establishes a connection to an EPP server and allows for sending commands
5
+ # to that EPP server.
6
+ class Client
7
+ # Default Service URNs
8
+ #
9
+ # Provided to make it easier for clients to add additional services to
10
+ # the default list.
11
+ #
12
+ # @example
13
+ # services = DEFAULT_SERVICES + %w(urn:ietf:params:xml:ns:secDNS-1.1)
14
+ # EPP::Client.new('username','password','epp.example.com', :services => services)
15
+ DEFAULT_SERVICES = [ Domain::NAMESPACE, Contact::NAMESPACE, Host::NAMESPACE ]
16
+
17
+ # Create new instance of EPP::Client.
18
+ #
19
+ # @param [String] tag EPP Tag
20
+ # @param [String] passwd EPP Tag password
21
+ # @param [String] host EPP Host address
22
+ # @param [Hash] options Options
23
+ # @option options [Integer] :port EPP Port number, default 700
24
+ # @option options [OpenSSL::SSL::SSLContext] :ssl_context For client certificate auth
25
+ # @option options [Boolean] :compatibility Compatibility mode, default false
26
+ # @option options [String] :lang EPP Language code, default 'en'
27
+ # @option options [String] :version EPP protocol version, default '1.0'
28
+ # @option options [Array<String>] :extensions EPP Extension URNs
29
+ # @option options [Array<String>] :services EPP Service URNs
30
+ # @option options [String] :address_family 'AF_INET' or 'AF_INET6' or either of the
31
+ # appropriate socket constants. Will cause connections to be
32
+ # limited to this address family. Default try all addresses.
33
+
34
+ def initialize(tag, passwd, host, options = {})
35
+ @tag, @passwd, @host, @options = tag, passwd, host, options
36
+ @conn = if options.delete(:compatibility) == true
37
+ OldServer.new(tag, passwd, host, options)
38
+ else
39
+ Server.new(tag, passwd, host, options)
40
+ end
41
+ end
42
+
43
+ attr_reader :tag, :passwd, :host, :options
44
+
45
+ def compatibility?
46
+ @conn.is_a?(OldServer)
47
+ end
48
+
49
+ # Returns the last request sent to the EPP server
50
+ #
51
+ # @return [Request] last request sent to the EPP server
52
+ def last_request
53
+ @conn.last_request
54
+ end
55
+
56
+ # Returns the last request sent to the EPP server
57
+ #
58
+ # @deprecated
59
+ # @return [Request] last request sent to the EPP server
60
+ def _last_request
61
+ warn "The #{self.class}#_last_request method is deprecated, please call #last_request"
62
+ last_request
63
+ end
64
+
65
+ # Returns the last response received from the EPP server
66
+ #
67
+ # @return [Response] last response received from the EPP server
68
+ def last_response
69
+ @conn.last_response
70
+ end
71
+
72
+ # Returns the last response received from the EPP server
73
+ #
74
+ # @deprecated
75
+ # @return [Response] last response received from the EPP server
76
+ def _last_response
77
+ warn "The #{self.class}#_last_response method is deprecated, please call #last_response"
78
+ last_response
79
+ end
80
+
81
+ # Returns the last error received from a login or logout request
82
+ #
83
+ # @return [ResponseError] last error received from login/logout request
84
+ def last_error
85
+ @conn.last_error
86
+ end
87
+
88
+ # Returns the last error received from a login or logout request
89
+ #
90
+ # @deprecated
91
+ # @return [ResponseError] last error received from login/logout request
92
+ def _last_error
93
+ warn "The #{self.class}#_last_error method is deprecated, please call #last_error"
94
+ last_error
95
+ end
96
+
97
+ def greeting
98
+ @conn.greeting
99
+ end
100
+
101
+ # Send hello command
102
+ def hello
103
+ @conn.connection do
104
+ @conn.hello
105
+ end
106
+ end
107
+
108
+ def check(payload, extension = nil)
109
+ check = EPP::Commands::Check.new(payload)
110
+ command(check, extension)
111
+ end
112
+
113
+ def create(payload, extension = nil)
114
+ create = EPP::Commands::Create.new(payload)
115
+ command(create, extension)
116
+ end
117
+
118
+ def delete(payload, extension = nil)
119
+ delete = EPP::Commands::Delete.new(payload)
120
+ command(delete, extension)
121
+ end
122
+
123
+ def info(payload, extension = nil)
124
+ info = EPP::Commands::Info.new(payload)
125
+ command(info, extension)
126
+ end
127
+
128
+ def renew(payload, extension = nil)
129
+ renew = EPP::Commands::Renew.new(payload)
130
+ command(renew, extension)
131
+ end
132
+
133
+ def transfer(op, payload, extension = nil)
134
+ transfer = EPP::Commands::Transfer.new(op, payload)
135
+ command(transfer, extension)
136
+ end
137
+
138
+ def update(payload, extension = nil)
139
+ update = EPP::Commands::Update.new(payload)
140
+ command(update, extension)
141
+ end
142
+
143
+ def accept_transfer(case_id)
144
+ accept_transfer = EPP::Commands::TransferHandshake.new(case_id, handshake: 'accept')
145
+ command(accept_transfer)
146
+ end
147
+
148
+ def reject_transfer(case_id)
149
+ reject_transfer = EPP::Commands::TransferHandshake.new(case_id, handshake: 'reject')
150
+ command(reject_transfer)
151
+ end
152
+
153
+ def poll
154
+ poll = EPP::Commands::Poll.new
155
+ command(poll)
156
+ end
157
+
158
+ def ack(msgID)
159
+ ack = EPP::Commands::Poll.new(msgID)
160
+ command(ack)
161
+ end
162
+
163
+ protected
164
+ def command(cmd, extension = nil)
165
+ @conn.connection do
166
+ @conn.with_login do
167
+ @conn.request(cmd, extension)
168
+ end
169
+ end
170
+ end
171
+ end
172
+ end
@@ -0,0 +1,11 @@
1
+ require File.expand_path('../read_write_command', __FILE__)
2
+
3
+ module EPP
4
+ module Commands
5
+ class Check < ReadWriteCommand
6
+ def name
7
+ 'check'
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,24 @@
1
+ module EPP
2
+ module Commands
3
+ class Command
4
+ include XMLHelpers
5
+
6
+ def set_namespaces(namespaces)
7
+ @namespaces = namespaces
8
+ end
9
+
10
+ # Receiver in XML form
11
+ # @return [XML::Document] XML of the receiver
12
+ def to_xml
13
+ epp_node(name, @namespaces || {})
14
+ end
15
+
16
+ # Convert the receiver to a string
17
+ #
18
+ # @param [Hash] opts Formatting options, passed to the XML::Document
19
+ def to_s(opts = {})
20
+ to_xml.to_s({:indent => false}.merge(opts))
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,11 @@
1
+ require File.expand_path('../read_write_command', __FILE__)
2
+
3
+ module EPP
4
+ module Commands
5
+ class Create < ReadWriteCommand
6
+ def name
7
+ 'create'
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,11 @@
1
+ require File.expand_path('../read_write_command', __FILE__)
2
+
3
+ module EPP
4
+ module Commands
5
+ class Delete < ReadWriteCommand
6
+ def name
7
+ 'delete'
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,11 @@
1
+ require File.expand_path('../read_write_command', __FILE__)
2
+
3
+ module EPP
4
+ module Commands
5
+ class Info < ReadWriteCommand
6
+ def name
7
+ 'info'
8
+ end
9
+ end
10
+ end
11
+ end