cps-client 0.0.6 → 0.0.7
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.
- data/LICENSE +1 -1
- data/lib/cps-client/client.rb +1 -1
- data/lib/cps-client/contact.rb +10 -10
- data/lib/cps-client/version.rb +1 -1
- data/lib/erb/base.erb +4 -4
- data/test.rb +39 -24
- metadata +4 -4
data/LICENSE
CHANGED
data/lib/cps-client/client.rb
CHANGED
@@ -71,7 +71,7 @@ module CPS
|
|
71
71
|
http.use_ssl = true if PROTO == 'https'
|
72
72
|
req = Net::HTTP::Post.new( PATH )
|
73
73
|
@response, @data = http.request(req, @request)
|
74
|
-
self.result_code
|
74
|
+
self.result_code >= '1000' && self.result_code <= '1003' ? true : false
|
75
75
|
rescue # OpenSSL::SSL::SSLError
|
76
76
|
false
|
77
77
|
end
|
data/lib/cps-client/contact.rb
CHANGED
@@ -7,16 +7,16 @@ module CPS
|
|
7
7
|
|
8
8
|
def initialize(options = {})
|
9
9
|
@object = options[:object].upcase
|
10
|
-
@firstname = options[:firstname]
|
11
|
-
@lastname = options[:lastname]
|
12
|
-
@orgname = options[:orgname].nil? || options[:orgname] == "" ? "-" : options[:orgname]
|
13
|
-
@street = options[:street]
|
14
|
-
@postal = options[:postal]
|
15
|
-
@city = options[:city]
|
16
|
-
@state = options[:state]
|
17
|
-
@iso_country = options[:iso_country].
|
18
|
-
@phone = options[:phone]
|
19
|
-
@fax = options[:fax]
|
10
|
+
@firstname = options[:firstname] rescue nil
|
11
|
+
@lastname = options[:lastname] rescue nil
|
12
|
+
@orgname = options[:orgname].nil? || options[:orgname] == "" ? "-" : options[:orgname] rescue nil
|
13
|
+
@street = options[:street] rescue nil
|
14
|
+
@postal = options[:postal] rescue nil
|
15
|
+
@city = options[:city] rescue nil
|
16
|
+
@state = options[:state] rescue nil
|
17
|
+
@iso_country = options[:iso_country].upcase rescue nil
|
18
|
+
@phone = options[:phone] rescue nil
|
19
|
+
@fax = options[:fax] rescue nil
|
20
20
|
@email = options[:email].to_punycode rescue nil
|
21
21
|
@privacy_rule = options[:privacy_rule] || ""
|
22
22
|
@contact_type = @orgname == '-' ? "person" : "organisation"
|
data/lib/cps-client/version.rb
CHANGED
data/lib/erb/base.erb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
|
-
<?xml version="1.0" encoding="
|
1
|
+
<?xml version="1.0" encoding="UTF-8" ?>
|
2
2
|
<request>
|
3
3
|
<auth>
|
4
|
-
<cid><%= @cid
|
5
|
-
<user><%= @uid
|
6
|
-
<pwd><%= @pwd
|
4
|
+
<cid><%= @cid %></cid>
|
5
|
+
<user><%= @uid %></user>
|
6
|
+
<pwd><%= @pwd %></pwd>
|
7
7
|
</auth>
|
8
8
|
<transaction>
|
9
9
|
<%= @xml %>
|
data/test.rb
CHANGED
@@ -2,10 +2,16 @@
|
|
2
2
|
|
3
3
|
require File.dirname(__FILE__) + '/lib/cps-client.rb'
|
4
4
|
|
5
|
+
DELETE_DOMAIN == false
|
6
|
+
|
7
|
+
CID = 'your-cid'
|
8
|
+
UID = 'your-uid'
|
9
|
+
PWD = 'your-pwd'
|
10
|
+
|
5
11
|
server = CPS::Client.new(
|
6
|
-
:cid =>
|
7
|
-
:uid =>
|
8
|
-
:pwd =>
|
12
|
+
:cid => CID,
|
13
|
+
:uid => UID,
|
14
|
+
:pwd => PWD,
|
9
15
|
:production => false
|
10
16
|
)
|
11
17
|
|
@@ -37,8 +43,10 @@ company_contact = CPS::Contact.new(
|
|
37
43
|
:email => 'paulaer.panter@example.com'
|
38
44
|
)
|
39
45
|
|
46
|
+
# cause of a bug in the arpote test system we need to create every time a new domain...
|
47
|
+
domain_number = (rand() * 10000).to_i.to_s
|
40
48
|
domain = CPS::Domain.new(
|
41
|
-
:domain =>
|
49
|
+
:domain => "example-domain-#{domain_number}.com",
|
42
50
|
:adminc => 'QD1234',
|
43
51
|
:techc => 'QD0001',
|
44
52
|
:billc => 'QD0001',
|
@@ -104,28 +112,35 @@ end
|
|
104
112
|
# exit 1
|
105
113
|
# end
|
106
114
|
|
107
|
-
|
108
|
-
|
109
|
-
else
|
110
|
-
puts "Error: #{server.data}"
|
111
|
-
puts "#{server.result_code}: #{server.result_message} #{server.request}"
|
112
|
-
exit 1
|
113
|
-
end
|
115
|
+
# TODO: domain.transfer
|
116
|
+
# TODO: domain.transfer_lock
|
114
117
|
|
115
|
-
if
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
118
|
+
if DELETE_DOMAIN == true
|
119
|
+
|
120
|
+
if server.query(domain.delete)
|
121
|
+
puts "Domain delete: #{server.result_code}: #{server.result_message}"
|
122
|
+
else
|
123
|
+
puts "Error: #{server.data}"
|
124
|
+
puts "#{server.result_code}: #{server.result_message} #{server.request}"
|
125
|
+
exit 1
|
126
|
+
end
|
127
|
+
|
128
|
+
if server.query(client_contact.delete)
|
129
|
+
puts "Contact deleted: #{server.result_code}: #{server.result_message}"
|
130
|
+
else
|
131
|
+
puts "Error: #{server.data}"
|
132
|
+
puts "#{server.result_code}: #{server.result_message}"
|
133
|
+
exit 1
|
134
|
+
end
|
135
|
+
|
136
|
+
if server.query(company_contact.delete)
|
137
|
+
puts "Contact deleted: #{server.result_code}: #{server.result_message}"
|
138
|
+
else
|
139
|
+
puts "Error: #{server.data}"
|
140
|
+
puts "#{server.result_code}: #{server.result_message}"
|
141
|
+
exit 1
|
142
|
+
end
|
122
143
|
|
123
|
-
if server.query(company_contact.delete)
|
124
|
-
puts "Contact deleted: #{server.result_code}: #{server.result_message}"
|
125
|
-
else
|
126
|
-
puts "Error: #{server.data}"
|
127
|
-
puts "#{server.result_code}: #{server.result_message}"
|
128
|
-
exit 1
|
129
144
|
end
|
130
145
|
|
131
146
|
exit 0
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cps-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 17
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 7
|
10
|
+
version: 0.0.7
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- jfqd
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
18
|
+
date: 2011-08-15 00:00:00 +02:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|