cps-client 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +2 -0
- data/Gemfile.lock +4 -1
- data/LICENSE +21 -0
- data/cps-client.gemspec +6 -0
- data/lib/core_ext.rb +49 -13
- data/lib/cps-client/contact.rb +11 -11
- data/lib/cps-client/domain.rb +1 -1
- data/lib/cps-client/version.rb +1 -1
- data/lib/erb/base.erb +3 -3
- data/lib/erb/contact_create.erb +14 -14
- data/lib/erb/contact_delete.erb +1 -1
- data/lib/erb/contact_domain.erb +13 -13
- data/lib/erb/contact_info.erb +1 -1
- data/lib/erb/domain_create.erb +7 -7
- data/lib/erb/domain_delete.erb +1 -1
- data/lib/erb/domain_info.erb +1 -1
- metadata +39 -6
data/Gemfile.lock
CHANGED
@@ -1,13 +1,15 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
cps-client (0.
|
4
|
+
cps-client (0.0.5)
|
5
5
|
always_verify_ssl_certificates (>= 0.2.0)
|
6
|
+
punycode4r (>= 0.2.0)
|
6
7
|
|
7
8
|
GEM
|
8
9
|
remote: http://rubygems.org/
|
9
10
|
specs:
|
10
11
|
always_verify_ssl_certificates (0.2.0)
|
12
|
+
punycode4r (0.2.0)
|
11
13
|
|
12
14
|
PLATFORMS
|
13
15
|
ruby
|
@@ -15,3 +17,4 @@ PLATFORMS
|
|
15
17
|
DEPENDENCIES
|
16
18
|
always_verify_ssl_certificates (>= 0.2.0)
|
17
19
|
cps-client!
|
20
|
+
punycode4r (>= 0.2.0)
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
== MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2008, Swank Innovations, LLC.
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/cps-client.gemspec
CHANGED
@@ -2,6 +2,10 @@
|
|
2
2
|
$:.push File.expand_path("../lib", __FILE__)
|
3
3
|
require "cps-client/version"
|
4
4
|
|
5
|
+
# to publish the gem to rubygems.org run:
|
6
|
+
# rake install
|
7
|
+
# rake release
|
8
|
+
|
5
9
|
Gem::Specification.new do |s|
|
6
10
|
s.name = "cps-client"
|
7
11
|
s.version = CPS::VERSION
|
@@ -13,6 +17,8 @@ Gem::Specification.new do |s|
|
|
13
17
|
s.description = %q{ruby api for the arp-client of cps-datensysteme.de}
|
14
18
|
|
15
19
|
s.add_dependency('always_verify_ssl_certificates', '>= 0.2.0')
|
20
|
+
s.add_dependency('punycode4r', '>= 0.2.0')
|
21
|
+
s.add_dependency('domainatrix', '>= 0.0.7')
|
16
22
|
|
17
23
|
s.rubyforge_project = "cps-client"
|
18
24
|
|
data/lib/core_ext.rb
CHANGED
@@ -1,19 +1,34 @@
|
|
1
1
|
require 'iconv'
|
2
|
+
require 'punycode'
|
3
|
+
require 'domainatrix'
|
2
4
|
|
3
5
|
class String
|
4
6
|
|
5
7
|
CONVERTION_TABLE = {
|
6
8
|
'Ç' => 'C',
|
7
9
|
'ç' => 'c',
|
8
|
-
'
|
9
|
-
'
|
10
|
-
'
|
11
|
-
'
|
12
|
-
'
|
10
|
+
'û' => 'u',
|
11
|
+
'ú' => 'u',
|
12
|
+
'ù' => 'u',
|
13
|
+
'é' => 'e',
|
14
|
+
'ê' => 'e',
|
15
|
+
'ë' => 'e',
|
16
|
+
'è' => 'e',
|
17
|
+
'â' => 'a',
|
18
|
+
'à' => 'a',
|
19
|
+
'å' => 'a',
|
20
|
+
'á' => 'a',
|
21
|
+
'ï' => 'i',
|
22
|
+
'î' => 'i',
|
23
|
+
'ì' => 'i',
|
24
|
+
'í' => 'i',
|
25
|
+
'Å' => 'A',
|
13
26
|
'É' => 'E',
|
14
27
|
'æ' => 'ae',
|
15
28
|
'Æ' => 'Ae',
|
16
|
-
'
|
29
|
+
'ô' => 'o',
|
30
|
+
'ò' => 'o',
|
31
|
+
'ó' => 'o',
|
17
32
|
'Ä' => 'Ae',
|
18
33
|
'Ö' => 'Oe',
|
19
34
|
'Ü' => 'Ue',
|
@@ -36,20 +51,41 @@ class String
|
|
36
51
|
return s
|
37
52
|
end
|
38
53
|
|
39
|
-
def
|
54
|
+
def to_punycode
|
55
|
+
result = self
|
56
|
+
if self.match(/@/)
|
57
|
+
name = self.split('@')[0]
|
58
|
+
url = Domainatrix.parse("http://"+self.split('@')[1]) # Domainatrix needs a protocol...
|
59
|
+
result = "#{name}@#{url.domain.domain_to_punycode}.#{url.public_suffix}"
|
60
|
+
elsif self.match(/./)
|
61
|
+
url = Domainatrix.parse("http://"+self)
|
62
|
+
result = "#{url.domain.domain_to_punycode}.#{url.public_suffix}"
|
63
|
+
end
|
64
|
+
return result
|
65
|
+
end
|
66
|
+
|
67
|
+
def to_iso_8859_1
|
40
68
|
begin
|
41
69
|
i = Iconv.new('ISO-8859-1', 'UTF-8') # Iconv.new(to, from)
|
42
|
-
|
43
|
-
i.close
|
44
|
-
return f
|
70
|
+
i.iconv(self.i18n_safe)
|
45
71
|
rescue
|
46
|
-
i.close
|
47
72
|
self
|
73
|
+
ensure
|
74
|
+
i.close
|
48
75
|
end
|
49
76
|
end
|
50
|
-
|
77
|
+
|
51
78
|
def blank?
|
52
79
|
self.nil? || self == ""
|
53
80
|
end
|
54
|
-
|
81
|
+
|
82
|
+
def domain_to_punycode
|
83
|
+
p = Punycode.encode(self)
|
84
|
+
unless p.match(/-$/)
|
85
|
+
"xn--#{p}"
|
86
|
+
else
|
87
|
+
p.sub(/-$/, "")
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
55
91
|
end
|
data/lib/cps-client/contact.rb
CHANGED
@@ -7,17 +7,17 @@ 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]
|
20
|
-
@email = options[:email]
|
10
|
+
@firstname = options[:firstname].to_iso_8859_1
|
11
|
+
@lastname = options[:lastname].to_iso_8859_1
|
12
|
+
@orgname = options[:orgname].nil? || options[:orgname] == "" ? "-" : options[:orgname].to_iso_8859_1
|
13
|
+
@street = options[:street].to_iso_8859_1
|
14
|
+
@postal = options[:postal].to_iso_8859_1
|
15
|
+
@city = options[:city].to_iso_8859_1
|
16
|
+
@state = options[:state].to_iso_8859_1
|
17
|
+
@iso_country = options[:iso_country].to_iso_8859_1
|
18
|
+
@phone = options[:phone].to_iso_8859_1
|
19
|
+
@fax = options[:fax].to_iso_8859_1
|
20
|
+
@email = options[:email].to_punycode
|
21
21
|
@privacy_rule = options[:privacy_rule] || ""
|
22
22
|
@contact_type = @orgname == '-' ? "person" : "organisation"
|
23
23
|
end
|
data/lib/cps-client/domain.rb
CHANGED
data/lib/cps-client/version.rb
CHANGED
data/lib/erb/base.erb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
2
|
<request>
|
3
3
|
<auth>
|
4
|
-
<cid><%= @cid.
|
5
|
-
<user><%= @uid.
|
6
|
-
<pwd><%= @pwd.
|
4
|
+
<cid><%= @cid.to_iso_8859_1 %></cid>
|
5
|
+
<user><%= @uid.to_iso_8859_1 %></user>
|
6
|
+
<pwd><%= @pwd.to_iso_8859_1 %></pwd>
|
7
7
|
</auth>
|
8
8
|
<transaction>
|
9
9
|
<%= @xml %>
|
data/lib/erb/contact_create.erb
CHANGED
@@ -1,19 +1,19 @@
|
|
1
1
|
<group>contact</group>
|
2
2
|
<action>create</action>
|
3
3
|
<attribute>contact</attribute>
|
4
|
-
<object><%= @object
|
4
|
+
<object><%= @object %></object>
|
5
5
|
<values>
|
6
|
-
<firstname><%= @firstname
|
7
|
-
<lastname><%= @lastname
|
8
|
-
<orgname><%= @orgname
|
9
|
-
<street><%= @street
|
10
|
-
<postal><%= @postal
|
11
|
-
<city><%= @city
|
12
|
-
<state><%= @state
|
13
|
-
<iso_country><%= @iso_country
|
14
|
-
<phone><%= @phone
|
15
|
-
<fax><%= @fax
|
16
|
-
<email><%= @email
|
17
|
-
<privacy_rule><%= @privacy_rule
|
18
|
-
<contact_type><%= @contact_type
|
6
|
+
<firstname><%= @firstname %></firstname>
|
7
|
+
<lastname><%= @lastname %></lastname>
|
8
|
+
<orgname><%= @orgname %></orgname>
|
9
|
+
<street><%= @street %></street>
|
10
|
+
<postal><%= @postal %></postal>
|
11
|
+
<city><%= @city %></city>
|
12
|
+
<state><%= @state %></state>
|
13
|
+
<iso_country><%= @iso_country %></iso_country>
|
14
|
+
<phone><%= @phone %></phone>
|
15
|
+
<fax><%= @fax %></fax>
|
16
|
+
<email><%= @email %></email>
|
17
|
+
<privacy_rule><%= @privacy_rule %></privacy_rule>
|
18
|
+
<contact_type><%= @contact_type %></contact_type>
|
19
19
|
</values>
|
data/lib/erb/contact_delete.erb
CHANGED
data/lib/erb/contact_domain.erb
CHANGED
@@ -1,13 +1,13 @@
|
|
1
|
-
<firstname><%= @firstname
|
2
|
-
<lastname><%= @lastname
|
3
|
-
<orgname><%= @orgname
|
4
|
-
<street><%= @street
|
5
|
-
<postal><%= @postal
|
6
|
-
<city><%= @city
|
7
|
-
<state><%= @state
|
8
|
-
<iso_country><%= @iso_country
|
9
|
-
<phone><%= @phone
|
10
|
-
<fax><%= @fax
|
11
|
-
<email><%= @email
|
12
|
-
<privacy_rule><%= @privacy_rule
|
13
|
-
<contact_type><%= @contact_type
|
1
|
+
<firstname><%= @firstname %></firstname>
|
2
|
+
<lastname><%= @lastname %></lastname>
|
3
|
+
<orgname><%= @orgname %></orgname>
|
4
|
+
<street><%= @street %></street>
|
5
|
+
<postal><%= @postal %></postal>
|
6
|
+
<city><%= @city %></city>
|
7
|
+
<state><%= @state %></state>
|
8
|
+
<iso_country><%= @iso_country %></iso_country>
|
9
|
+
<phone><%= @phone %></phone>
|
10
|
+
<fax><%= @fax %></fax>
|
11
|
+
<email><%= @email %></email>
|
12
|
+
<privacy_rule><%= @privacy_rule %></privacy_rule>
|
13
|
+
<contact_type><%= @contact_type %></contact_type>
|
data/lib/erb/contact_info.erb
CHANGED
data/lib/erb/domain_create.erb
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
<group>domain</group>
|
2
2
|
<action>create</action>
|
3
3
|
<attribute>domain</attribute>
|
4
|
-
<object><%= @domain
|
4
|
+
<object><%= @domain %></object>
|
5
5
|
<values>
|
6
|
-
<adminc><%= @adminc
|
7
|
-
<techc><%= @techc
|
8
|
-
<billc><%= @billc
|
9
|
-
<ownerc><%= @ownerc
|
6
|
+
<adminc><%= @adminc %></adminc>
|
7
|
+
<techc><%= @techc %></techc>
|
8
|
+
<billc><%= @billc %></billc>
|
9
|
+
<ownerc><%= @ownerc %></ownerc>
|
10
10
|
<dns>
|
11
|
-
<hostname><%= @ns1
|
11
|
+
<hostname><%= @ns1 %></hostname>
|
12
12
|
</dns>
|
13
13
|
<dns>
|
14
|
-
<hostname><%= @ns2
|
14
|
+
<hostname><%= @ns2 %></hostname>
|
15
15
|
</dns>
|
16
16
|
</values>
|
data/lib/erb/domain_delete.erb
CHANGED
data/lib/erb/domain_info.erb
CHANGED
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:
|
5
|
-
prerelease:
|
4
|
+
hash: 23
|
5
|
+
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 4
|
10
|
+
version: 0.0.4
|
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-01
|
18
|
+
date: 2011-04-01 00:00:00 +02:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -34,6 +34,38 @@ dependencies:
|
|
34
34
|
version: 0.2.0
|
35
35
|
type: :runtime
|
36
36
|
version_requirements: *id001
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
name: punycode4r
|
39
|
+
prerelease: false
|
40
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ">="
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
hash: 23
|
46
|
+
segments:
|
47
|
+
- 0
|
48
|
+
- 2
|
49
|
+
- 0
|
50
|
+
version: 0.2.0
|
51
|
+
type: :runtime
|
52
|
+
version_requirements: *id002
|
53
|
+
- !ruby/object:Gem::Dependency
|
54
|
+
name: domainatrix
|
55
|
+
prerelease: false
|
56
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
hash: 17
|
62
|
+
segments:
|
63
|
+
- 0
|
64
|
+
- 0
|
65
|
+
- 7
|
66
|
+
version: 0.0.7
|
67
|
+
type: :runtime
|
68
|
+
version_requirements: *id003
|
37
69
|
description: ruby api for the arp-client of cps-datensysteme.de
|
38
70
|
email:
|
39
71
|
- jfqd@blun.org
|
@@ -47,6 +79,7 @@ files:
|
|
47
79
|
- .gitignore
|
48
80
|
- Gemfile
|
49
81
|
- Gemfile.lock
|
82
|
+
- LICENSE
|
50
83
|
- Rakefile
|
51
84
|
- Readme.textile
|
52
85
|
- cps-client.gemspec
|
@@ -98,7 +131,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
98
131
|
requirements: []
|
99
132
|
|
100
133
|
rubyforge_project: cps-client
|
101
|
-
rubygems_version: 1.
|
134
|
+
rubygems_version: 1.4.1
|
102
135
|
signing_key:
|
103
136
|
specification_version: 3
|
104
137
|
summary: ruby api for the arp-client of cps-datensysteme.de
|