nominet-epp 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
data/History.md CHANGED
@@ -1,3 +1,12 @@
1
+ 0.0.8 / 2011-05-03
2
+ ==================
3
+
4
+ * Amend account:contact elements in Create operation to ensure order attribute range
5
+ * Fix sequencing of elements in account:addr block
6
+ * Fix sequencing of elements in contact:create block
7
+ * Fix sequencing of elements in account:create block
8
+ * Enforce the correct element sequencing for the domain:create operation
9
+
1
10
  0.0.7 / 2011-04-21
2
11
  ==================
3
12
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.7
1
+ 0.0.8
@@ -49,14 +49,18 @@ module NominetEPP
49
49
  node << p
50
50
  end
51
51
 
52
- acct_xml = XML::Node.new('account', nil, ns)
53
- acct_xml << create_account(acct, ns)
54
- node << acct_xml
52
+ # node << XML::Node.new('auto-period', '', ns) # placeholder
53
+
54
+ node << XML::Node.new('account', nil, ns).tap do |acct_xml|
55
+ acct_xml << create_account(acct, ns)
56
+ end
55
57
 
56
58
  node << domain_ns_xml(nameservers, ns)
57
59
 
58
- options.each do |key, value|
59
- node << XML::Node.new(key.to_s.gsub('_', '-'), value, ns)
60
+ # Enforce correct sequencing of option fields
61
+ [:first_bill, :recur_bill, :auto_bill, :next_bill, :notes].each do |key|
62
+ next if options[key].nil? || options[key] == ''
63
+ node << XML::Node.new(key.to_s.gsub('_', '-'), options[key], ns)
60
64
  end
61
65
  end
62
66
  end
@@ -86,17 +90,18 @@ module NominetEPP
86
90
  elsif acct.kind_of?(Hash)
87
91
  account('create') do |node, ns|
88
92
  node << XML::Node.new('name', acct[:name], ns)
89
- node << XML::Node.new('trad-name', acct[:trad_name], ns)
93
+ node << XML::Node.new('trad-name', acct[:trad_name], ns) unless acct[:trad_name].nil? || acct[:trad_name] == ''
90
94
  node << XML::Node.new('type', acct[:type], ns)
95
+ node << XML::Node.new('co-no', acct[:co_no], ns) unless acct[:co_no].nil? || acct[:co_no] == ''
91
96
  node << XML::Node.new('opt-out', acct[:opt_out], ns)
92
97
 
93
- acct[:contacts].each_with_index do |cont, i|
98
+ node << create_account_address(acct[:addr], ns) unless acct[:addr].nil?
99
+
100
+ acct[:contacts][0,3].each_with_index do |cont, i|
94
101
  c = XML::Node.new('contact', nil, ns)
95
- c['order'] = i.to_s
102
+ c['order'] = (i + 1).to_s # Enforce order 1-3
96
103
  node << (c << create_account_contact(cont))
97
104
  end
98
-
99
- node << create_account_address(acct[:addr], ns) unless acct[:addr].nil?
100
105
  end
101
106
  else
102
107
  raise ArgumentError, "acct must be String or Hash"
@@ -115,8 +120,9 @@ module NominetEPP
115
120
  raise ArgumentError, "Contact requires name and email keys" unless cont.has_key?(:name) && cont.has_key?(:email)
116
121
 
117
122
  contact('create') do |node, ns|
118
- cont.each do |key, value|
119
- node << XML::Node.new(key, value, ns)
123
+ [:name, :phone, :mobile, :email].each do |key|
124
+ next if cont[key].nil? || cont[key] == ''
125
+ node << XML::Node.new(key, cont[key], ns)
120
126
  end
121
127
  end
122
128
  end
@@ -132,12 +138,12 @@ module NominetEPP
132
138
  raise ArgumentError, "ns must be an xml namespace" unless ns.is_a?(XML::Namespace)
133
139
  raise ArgumentError, "Address allowed keys are street, locality, city, county, postcode, country" unless (addr.keys - [:street, :locality, :city, :county, :postcode, :country]).empty?
134
140
 
135
- addr = XML::Node.new('addr', nil, ns)
136
- addr.each do |key, value|
137
- addr << XML::Node.new(key, value, ns)
141
+ XML::Node.new('addr', nil, ns).tap do |a|
142
+ [:street, :locality, :city, :county, :postcode, :country].each do |key|
143
+ next if addr[key].nil? || addr[key] == ''
144
+ a << XML::Node.new(key, addr[key], ns)
145
+ end
138
146
  end
139
-
140
- addr
141
147
  end
142
148
 
143
149
  # Collects created account information
@@ -49,6 +49,13 @@ module NominetEPP
49
49
  # Fields +:add+ and +:rem+ options
50
50
  # - (String) +:v4+ -- IPv4 address to add or remove from the nameserver
51
51
  # - (String) +:v6+ -- IPv6 address to add or remove from the nameserver
52
+ #
53
+ # Example:
54
+ #
55
+ # fields = {:chg => 'new.ns.example.com',
56
+ # :add => {:v4 => '192.168.1.45', :v6 => '2001:db8::1'},
57
+ # :rem => {:v4 => '192.168.1.14', :v6 => '2001:db8::b'}}
58
+ #
52
59
  module Update
53
60
  # @param [Symbol] entity Entity to update, one of domain, account, contact or nameserver
54
61
  # @param [String] id Domain, Account, Contact or Nameserver to update
data/nominet-epp.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{nominet-epp}
8
- s.version = "0.0.7"
8
+ s.version = "0.0.8"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Geoff Garside"]
12
- s.date = %q{2011-04-21}
12
+ s.date = %q{2011-05-03}
13
13
  s.description = %q{Client for communicating with the Nominet EPP}
14
14
  s.email = %q{geoff@geoffgarside.co.uk}
15
15
  s.extra_rdoc_files = [
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nominet-epp
3
3
  version: !ruby/object:Gem::Version
4
- hash: 17
4
+ hash: 15
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 7
10
- version: 0.0.7
9
+ - 8
10
+ version: 0.0.8
11
11
  platform: ruby
12
12
  authors:
13
13
  - Geoff Garside
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-04-21 00:00:00 Z
18
+ date: 2011-05-03 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: shoulda