cps-client 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
data/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  == MIT License
2
2
 
3
- Copyright (c) 2008, Swank Innovations, LLC.
3
+ Copyright (c) 2010 qutic development
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -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 == '1000' ? true : false
74
+ self.result_code >= '1000' && self.result_code <= '1003' ? true : false
75
75
  rescue # OpenSSL::SSL::SSLError
76
76
  false
77
77
  end
@@ -7,16 +7,16 @@ module CPS
7
7
 
8
8
  def initialize(options = {})
9
9
  @object = options[:object].upcase
10
- @firstname = options[:firstname].to_iso_8859_1 rescue nil
11
- @lastname = options[:lastname].to_iso_8859_1 rescue nil
12
- @orgname = options[:orgname].nil? || options[:orgname] == "" ? "-" : options[:orgname].to_iso_8859_1 rescue nil
13
- @street = options[:street].to_iso_8859_1 rescue nil
14
- @postal = options[:postal].to_iso_8859_1 rescue nil
15
- @city = options[:city].to_iso_8859_1 rescue nil
16
- @state = options[:state].to_iso_8859_1 rescue nil
17
- @iso_country = options[:iso_country].to_iso_8859_1 rescue nil
18
- @phone = options[:phone].to_iso_8859_1 rescue nil
19
- @fax = options[:fax].to_iso_8859_1 rescue nil
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"
@@ -7,7 +7,7 @@ module CPS
7
7
  module Version
8
8
  MAJOR = 0
9
9
  MINOR = 0
10
- PATCH = 6
10
+ PATCH = 7
11
11
  BUILD = nil
12
12
 
13
13
  STRING = [MAJOR, MINOR, PATCH, BUILD].compact.join(".")
@@ -1,9 +1,9 @@
1
- <?xml version="1.0" encoding="iso-8859-1"?>
1
+ <?xml version="1.0" encoding="UTF-8" ?>
2
2
  <request>
3
3
  <auth>
4
- <cid><%= @cid.to_iso_8859_1 %></cid>
5
- <user><%= @uid.to_iso_8859_1 %></user>
6
- <pwd><%= @pwd.to_iso_8859_1 %></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 => 'your-cid',
7
- :uid => 'your-uid',
8
- :pwd => 'your-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 => 'example-domain-123456.com',
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
- if server.query(domain.delete)
108
- puts "Domain delete: #{server.result_code}: #{server.result_message}"
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 server.query(client_contact.delete)
116
- puts "Contact deleted: #{server.result_code}: #{server.result_message}"
117
- else
118
- puts "Error: #{server.data}"
119
- puts "#{server.result_code}: #{server.result_message}"
120
- exit 1
121
- end
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: 19
4
+ hash: 17
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 6
10
- version: 0.0.6
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-06-29 00:00:00 +02:00
18
+ date: 2011-08-15 00:00:00 +02:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency