epp-eis 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.markdown CHANGED
@@ -20,7 +20,9 @@ In Gemfile add it as a gem:
20
20
  :key => OpenSSL::PKey::RSA.new(File.open('priv_key.pem'))
21
21
  )
22
22
 
23
- server.is_domain_available?('fraktal.ee') #=> false
23
+ server.command_session do
24
+ server.is_domain_available?('fraktal.ee') #=> false
25
+ end
24
26
 
25
27
  ## TODO
26
28
 
data/epp-eis.gemspec CHANGED
@@ -20,7 +20,5 @@ Gem::Specification.new do |s|
20
20
 
21
21
  s.add_runtime_dependency 'epp-nokogiri'
22
22
 
23
- s.add_development_dependency 'rspec'
24
- s.add_development_dependency 'guard'
25
- s.add_development_dependency 'guard-rspec'
23
+ %w(rake rspec guard guard-rspec rb-fsevent).each { |d| s.add_development_dependency(d) }
26
24
  end
@@ -153,7 +153,7 @@ module Epp
153
153
  xml.check {
154
154
  xml.check('xmlns:contact' => XML_NS_CONTACT, 'xsi:schemaLocation' => XML_CONTACT_SCHEMALOC) {
155
155
  xml.parent.namespace = xml.parent.namespace_definitions.first
156
- contacts.each { |contact| xml.id_ contact }
156
+ contacts.each { |contact| xml['contact'].id_ contact }
157
157
  }
158
158
  }
159
159
  xml.clTRID UUIDTools::UUID.timestamp_create.to_s
@@ -170,19 +170,19 @@ module Epp
170
170
  xml.create {
171
171
  xml.create('xmlns:contact' => XML_NS_CONTACT, 'xsi:schemaLocation' => XML_CONTACT_SCHEMALOC) {
172
172
  xml.parent.namespace = xml.parent.namespace_definitions.first
173
- xml.id_ contact
174
- xml.postalInfo {
175
- xml.name name
176
- xml.addr {
177
- xml.street street
178
- xml.city city
179
- xml.pc postal_code
180
- xml.cc country_code
173
+ xml['contact'].id_ contact
174
+ xml['contact'].postalInfo {
175
+ xml['contact'].name name
176
+ xml['contact'].addr {
177
+ xml['contact'].street street
178
+ xml['contact'].city city
179
+ xml['contact'].pc postal_code
180
+ xml['contact'].cc country_code
181
181
  }
182
182
  }
183
- xml.voice voice
184
- xml.email email
185
- xml.ident ident, 'type' => ident_type
183
+ xml['contact'].voice voice
184
+ xml['contact'].email email
185
+ xml['contact'].ident ident, 'type' => ident_type
186
186
  }
187
187
  }
188
188
  xml.clTRID UUIDTools::UUID.timestamp_create.to_s
@@ -200,7 +200,7 @@ module Epp
200
200
  xml.delete {
201
201
  xml.delete('xmlns:contact' => XML_NS_CONTACT, 'xsi:schemaLocation' => XML_CONTACT_SCHEMALOC) {
202
202
  xml.parent.namespace = xml.parent.namespace_definitions.first
203
- xml.id_ contact
203
+ xml['contact'].id_ contact
204
204
  }
205
205
  }
206
206
  xml.clTRID UUIDTools::UUID.timestamp_create.to_s
@@ -217,7 +217,7 @@ module Epp
217
217
  xml.info {
218
218
  xml.info('xmlns:contact' => XML_NS_CONTACT, 'xsi:schemaLocation' => XML_CONTACT_SCHEMALOC) {
219
219
  xml.parent.namespace = xml.parent.namespace_definitions.first
220
- xml.id_ contact
220
+ xml['contact'].id_ contact
221
221
  }
222
222
  }
223
223
  xml.clTRID UUIDTools::UUID.timestamp_create.to_s
@@ -238,23 +238,23 @@ module Epp
238
238
  xml.update {
239
239
  xml.update('xmlns:contact' => XML_NS_CONTACT, 'xsi:schemaLocation' => XML_CONTACT_SCHEMALOC) {
240
240
  xml.parent.namespace = xml.parent.namespace_definitions.first
241
- xml.id_ contact
241
+ xml['contact'].id_ contact
242
242
  if [name, street, city, postal_code, country_code].any?{ |item| !item.nil? }
243
- xml.postalInfo {
244
- xml.name name if name
243
+ xml['contact'].postalInfo {
244
+ xml['contact'].name name if name
245
245
  if [street, city, postal_code, country_code].any?{ |item| !item.nil? }
246
- xml.addr {
247
- xml.street street if street
248
- xml.city city if city
249
- xml.pc postal_code if postal_code
250
- xml.cc country_code if country_code
246
+ xml['contact'].addr {
247
+ xml['contact'].street street if street
248
+ xml['contact'].city city if city
249
+ xml['contact'].pc postal_code if postal_code
250
+ xml['contact'].cc country_code if country_code
251
251
  }
252
252
  end
253
253
  }
254
254
  end
255
- xml.voice voice if voice
256
- xml.email email if email
257
- xml.ident ident, 'type' => ident_type
255
+ xml['contact'].voice voice if voice
256
+ xml['contact'].email email if email
257
+ xml['contact'].ident ident, 'type' => ident_type
258
258
  }
259
259
  }
260
260
  append_legal_document(xml, legal_document, legal_doc_type)
@@ -213,11 +213,11 @@ module Epp
213
213
  xml.create {
214
214
  xml.create('xmlns:domain' => XML_NS_DOMAIN, 'xsi:schemaLocation' => XML_DOMAIN_SCHEMALOC) {
215
215
  xml.parent.namespace = xml.parent.namespace_definitions.first
216
- xml.name domain
217
- xml.period '1', 'unit' => 'y'
218
- xml.nsset nsset
219
- xml.registrant registrant
220
- [admins].flatten.each { |admin| xml.admin admin }
216
+ xml['domain'].name domain
217
+ xml['domain'].period '1', 'unit' => 'y'
218
+ xml['domain'].nsset nsset
219
+ xml['domain'].registrant registrant
220
+ [admins].flatten.each { |admin| xml['domain'].admin admin }
221
221
  }
222
222
  }
223
223
  append_legal_document(xml, legal_document, legal_doc_type)
@@ -241,7 +241,7 @@ module Epp
241
241
  xml.delete {
242
242
  xml.delete('xmlns:domain' => XML_NS_DOMAIN, 'xsi:schemaLocation' => XML_DOMAIN_SCHEMALOC) {
243
243
  xml.parent.namespace = xml.parent.namespace_definitions.first
244
- xml.name domain
244
+ xml['domain'].name domain
245
245
  }
246
246
  }
247
247
  append_legal_document(xml, legal_document, legal_doc_type)
@@ -265,7 +265,7 @@ module Epp
265
265
  xml.info {
266
266
  xml.info('xmlns:domain' => XML_NS_DOMAIN, 'xsi:schemaLocation' => XML_DOMAIN_SCHEMALOC) {
267
267
  xml.parent.namespace = xml.parent.namespace_definitions.first
268
- xml.name domain
268
+ xml['domain'].name domain
269
269
  }
270
270
  }
271
271
  xml.clTRID UUIDTools::UUID.timestamp_create.to_s
@@ -287,9 +287,9 @@ module Epp
287
287
  xml.renew {
288
288
  xml.renew('xmlns:domain' => XML_NS_DOMAIN, 'xsi:schemaLocation' => XML_DOMAIN_SCHEMALOC) {
289
289
  xml.parent.namespace = xml.parent.namespace_definitions.first
290
- xml.name domain
291
- xml.curExpDate current_expire_date
292
- xml.period '1', 'unit' => 'y'
290
+ xml['domain'].name domain
291
+ xml['domain'].curExpDate current_expire_date
292
+ xml['domain'].period '1', 'unit' => 'y'
293
293
  }
294
294
  }
295
295
  xml.clTRID UUIDTools::UUID.timestamp_create.to_s
@@ -311,8 +311,8 @@ module Epp
311
311
  xml.transfer('op' => 'request') {
312
312
  xml.transfer('xmlns:domain' => XML_NS_DOMAIN, 'xsi:schemaLocation' => XML_DOMAIN_SCHEMALOC) {
313
313
  xml.parent.namespace = xml.parent.namespace_definitions.first
314
- xml.name domain
315
- xml.authInfo auth_info
314
+ xml['domain'].name domain
315
+ xml['domain'].authInfo auth_info
316
316
  }
317
317
  }
318
318
  append_legal_document(xml, legal_document, legal_doc_type)
@@ -341,22 +341,22 @@ module Epp
341
341
  xml.update {
342
342
  xml.update('xmlns:domain' => XML_NS_DOMAIN, 'xsi:schemaLocation' => XML_DOMAIN_SCHEMALOC) {
343
343
  xml.parent.namespace = xml.parent.namespace_definitions.first
344
- xml.name domain
344
+ xml['domain'].name domain
345
345
  if !add_admins.nil? && !add_admins.empty?
346
- xml.add {
347
- add_admins.each { |add_admin| xml.admin add_admin }
346
+ xml['domain'].add {
347
+ add_admins.each { |add_admin| xml['domain'].admin add_admin }
348
348
  }
349
349
  end
350
350
  if !rem_admins.nil? && !rem_admins.empty?
351
- xml.rem {
352
- rem_admins.each { |rem_admin| xml.admin rem_admin }
351
+ xml['domain'].rem {
352
+ rem_admins.each { |rem_admin| xml['domain'].admin rem_admin }
353
353
  }
354
354
  end
355
355
  if [nsset, registrant, auth_info].any?{ |item| !item.nil? }
356
- xml.chg {
357
- xml.nsset nsset if nsset
358
- xml.registrant registrant if registrant
359
- xml.auth_info auth_info if auth_info
356
+ xml['domain'].chg {
357
+ xml['domain'].nsset nsset if nsset
358
+ xml['domain'].registrant registrant if registrant
359
+ xml['domain'].auth_info auth_info if auth_info
360
360
  }
361
361
  end
362
362
  }
@@ -383,14 +383,14 @@ module Epp
383
383
  xml.check('xmlns:domain' => XML_NS_DOMAIN, 'xsi:schemaLocation' => XML_DOMAIN_SCHEMALOC) {
384
384
  xml.parent.namespace = xml.parent.namespace_definitions.first
385
385
  domains.each do |domain|
386
- xml.name domain
386
+ xml['domain'].name domain
387
387
  end
388
388
  }
389
389
  }
390
390
  xml.clTRID UUIDTools::UUID.timestamp_create.to_s
391
391
  }
392
392
  end
393
-
393
+
394
394
  DomainCheckResponse.new(send_request(builder.to_xml))
395
395
  end
396
396
 
@@ -11,7 +11,7 @@ module Epp
11
11
  xml.extension {
12
12
  xml.extdata('xmlns:eis' => 'urn:ee:eis:xml:epp:eis-1.0', 'xsi:schemaLocation' => 'urn:ee:eis:xml:epp:eis-1.0 eis-1.0.xsd') {
13
13
  xml.parent.namespace = xml.parent.namespace_definitions.first
14
- xml.legalDocument Base64.encode64(legal_document), 'type' => legal_doc_type
14
+ xml['eis'].legalDocument Base64.encode64(legal_document), 'type' => legal_doc_type
15
15
  }
16
16
  }
17
17
  end
data/lib/epp-eis/nsset.rb CHANGED
@@ -133,7 +133,7 @@ module Epp
133
133
  xml.check {
134
134
  xml.check('xmlns:nsset' => XML_NS_NSSET, 'xsi:schemaLocation' => XML_NSSET_SCHEMALOC) {
135
135
  xml.parent.namespace = xml.parent.namespace_definitions.first
136
- nssets.each { |nsset| xml.id_ nsset }
136
+ nssets.each { |nsset| xml['nsset'].id_ nsset }
137
137
  }
138
138
  }
139
139
  xml.clTRID UUIDTools::UUID.timestamp_create.to_s
@@ -150,14 +150,14 @@ module Epp
150
150
  xml.create {
151
151
  xml.create('xmlns:nsset' => XML_NS_NSSET, 'xsi:schemaLocation' => XML_NSSET_SCHEMALOC) {
152
152
  xml.parent.namespace = xml.parent.namespace_definitions.first
153
- xml.id_ nsset
153
+ xml['nsset'].id_ nsset
154
154
  nameservers.each do |nameserver|
155
- xml.ns {
156
- xml.name nameserver[0]
157
- xml.addr nameserver[1]
155
+ xml['nsset'].ns {
156
+ xml['nsset'].name nameserver[0]
157
+ xml['nsset'].addr nameserver[1]
158
158
  }
159
159
  end
160
- xml.tech contact
160
+ xml['nsset'].tech contact
161
161
  }
162
162
  }
163
163
  xml.clTRID UUIDTools::UUID.timestamp_create.to_s
@@ -174,7 +174,7 @@ module Epp
174
174
  xml.delete {
175
175
  xml.delete('xmlns:nsset' => XML_NS_NSSET, 'xsi:schemaLocation' => XML_NSSET_SCHEMALOC) {
176
176
  xml.parent.namespace = xml.parent.namespace_definitions.first
177
- xml.id_ nsset
177
+ xml['nsset'].id_ nsset
178
178
  }
179
179
  }
180
180
  xml.clTRID UUIDTools::UUID.timestamp_create.to_s
@@ -191,7 +191,7 @@ module Epp
191
191
  xml.info {
192
192
  xml.info('xmlns:nsset' => XML_NS_NSSET, 'xsi:schemaLocation' => XML_NSSET_SCHEMALOC) {
193
193
  xml.parent.namespace = xml.parent.namespace_definitions.first
194
- xml.id_ nsset
194
+ xml['nsset'].id_ nsset
195
195
  }
196
196
  }
197
197
  xml.clTRID UUIDTools::UUID.timestamp_create.to_s
@@ -213,22 +213,22 @@ module Epp
213
213
  xml.update {
214
214
  xml.update('xmlns:nsset' => XML_NS_NSSET, 'xsi:schemaLocation' => XML_NSSET_SCHEMALOC) {
215
215
  xml.parent.namespace = xml.parent.namespace_definitions.first
216
- xml.id_ nsset
216
+ xml['nsset'].id_ nsset
217
217
  if add_nameservers or add_contact
218
- xml.add {
218
+ xml['nsset'].add {
219
219
  add_nameservers.each do |nameserver|
220
- xml.ns {
221
- xml.name nameserver[0]
222
- xml.addr nameserver[1]
220
+ xml['nsset'].ns {
221
+ xml['nsset'].name nameserver[0]
222
+ xml['nsset'].addr nameserver[1]
223
223
  }
224
224
  end if add_nameservers
225
- xml.tech add_contact if add_contact
225
+ xml['nsset'].tech add_contact if add_contact
226
226
  }
227
227
  end
228
228
  if rem_nameserver or rem_contact
229
- xml.rem {
230
- xml.name rem_nameserver
231
- xml.tech rem_contact
229
+ xml['nsset'].rem {
230
+ xml['nsset'].name rem_nameserver
231
+ xml['nsset'].tech rem_contact
232
232
  }
233
233
  end
234
234
  }
@@ -1,5 +1,5 @@
1
1
  module Eis
2
2
  module Epp
3
- VERSION = '1.0.1'
3
+ VERSION = '1.0.2'
4
4
  end
5
5
  end
@@ -7,100 +7,207 @@ describe Epp::Eis::ContactCommands do
7
7
  end
8
8
 
9
9
  describe 'check_contact' do
10
-
11
- context 'when response is successful' do
12
-
13
- before(:each) do
14
- @server.stub(:send_request).and_return(xml_mock('responses/contact/check_contact_1000.xml'))
10
+ before(:each) do
11
+ @server.should_receive(:send_request) do |xml|
12
+ @request = Nokogiri::XML(xml)
13
+ xml_mock('responses/contact/check_contact_1000.xml')
15
14
  end
16
-
15
+ end
16
+
17
+ context 'request' do
18
+ it 'contains contact id' do
19
+ @server.check_contact('CID:FRAKTAL:1')
20
+ expect(@request.css('contact|check contact|id', 'contact' => Epp::Eis::XML_NS_CONTACT).text).to eq('CID:FRAKTAL:1')
21
+ end
22
+ end
23
+
24
+ context 'response' do
17
25
  it 'has status code 1000' do
18
- @server.check_contact('CID:FRAKTAL:1').code.should == 1000
26
+ expect(@server.check_contact('CID:FRAKTAL:1').code).to eq(1000)
19
27
  end
20
28
 
21
29
  context 'when multiple contact names are provided' do
22
30
  it 'has multiple contact check items in response object' do
23
- @server.check_contact('CID:FRAKTAL:1', 'CID:FRAKTAL:2').items.size.should == 2
31
+ expect(@server.check_contact('CID:FRAKTAL:1', 'CID:FRAKTAL:2').items.size).to eq(2)
24
32
  end
25
33
  end
26
34
  end
27
35
  end
28
36
 
29
37
  describe 'create_contact' do
30
- context 'when response is successful' do
31
- before(:each) do
32
- @server.stub(:send_request).and_return(xml_mock('responses/contact/create_contact_1000.xml'))
33
- @response = @server.create_contact('CID:TEST:10', 'Test', 'Test Street 11-2', 'Test City', '123456', 'EE', '+372.5555555', 'test@test.com', '37812124567', 'op')
38
+ before(:each) do
39
+ @server.should_receive(:send_request) do |xml|
40
+ @request = Nokogiri::XML(xml)
41
+ xml_mock('responses/contact/create_contact_1000.xml')
34
42
  end
35
-
43
+ @response = @server.create_contact('CID:TEST:10', 'Test', 'Test Street 11-2', 'Test City', '123456', 'EE', '+372.5555555', 'test@test.com', '37812124567', 'op')
44
+ end
45
+
46
+ context 'request' do
47
+ it 'contains contact id' do
48
+ expect(@request.css('contact|create contact|id', 'contact' => Epp::Eis::XML_NS_CONTACT).text).to eq('CID:TEST:10')
49
+ end
50
+
51
+ it 'contains contact name' do
52
+ expect(@request.css('contact|create contact|postalInfo contact|name', 'contact' => Epp::Eis::XML_NS_CONTACT).text).to eq('Test')
53
+ end
54
+
55
+ it 'contains street' do
56
+ expect(@request.css('contact|create contact|postalInfo contact|addr contact|street', 'contact' => Epp::Eis::XML_NS_CONTACT).text).to eq('Test Street 11-2')
57
+ end
58
+
59
+ it 'contains city' do
60
+ expect(@request.css('contact|create contact|postalInfo contact|addr contact|city', 'contact' => Epp::Eis::XML_NS_CONTACT).text).to eq('Test City')
61
+ end
62
+
63
+ it 'contains postal code' do
64
+ expect(@request.css('contact|create contact|postalInfo contact|addr contact|pc', 'contact' => Epp::Eis::XML_NS_CONTACT).text).to eq('123456')
65
+ end
66
+
67
+ it 'contains country code' do
68
+ expect(@request.css('contact|create contact|postalInfo contact|addr contact|cc', 'contact' => Epp::Eis::XML_NS_CONTACT).text).to eq('EE')
69
+ end
70
+
71
+ it 'contains phone number' do
72
+ expect(@request.css('contact|create contact|voice', 'contact' => Epp::Eis::XML_NS_CONTACT).text).to eq('+372.5555555')
73
+ end
74
+
75
+ it 'contains phone email' do
76
+ expect(@request.css('contact|create contact|email', 'contact' => Epp::Eis::XML_NS_CONTACT).text).to eq('test@test.com')
77
+ end
78
+
79
+ it 'contains identification code' do
80
+ expect(@request.css('contact|create contact|ident', 'contact' => Epp::Eis::XML_NS_CONTACT).text).to eq('37812124567')
81
+ end
82
+
83
+ it 'contains identification type' do
84
+ expect(@request.css('contact|create contact|ident', 'contact' => Epp::Eis::XML_NS_CONTACT).first['type']).to eq('op')
85
+ end
86
+ end
87
+
88
+ context 'response' do
36
89
  it 'returns contact id' do
37
- @response.contact_id.should == 'CID:TEST:10'
90
+ expect(@response.contact_id).to eq('CID:TEST:10')
38
91
  end
39
92
 
40
93
  it 'returns contact create date' do
41
- @response.contact_create_date.should == '2010-02-08T15:50:55+02:00'
94
+ expect(@response.contact_create_date).to eq('2010-02-08T15:50:55+02:00')
42
95
  end
43
96
  end
44
97
  end
45
98
 
46
99
  describe 'info_contact' do
47
- context 'when response is successful' do
48
- before(:each) do
49
- @server.stub(:send_request).and_return(xml_mock('responses/contact/info_contact_1000.xml'))
50
- @response = @server.info_contact('CID:TEST:1')
100
+ before(:each) do
101
+ @server.should_receive(:send_request) do |xml|
102
+ @request = Nokogiri::XML(xml)
103
+ xml_mock('responses/contact/info_contact_1000.xml')
51
104
  end
52
-
105
+ @response = @server.info_contact('CID:TEST:1')
106
+ end
107
+
108
+ context 'request' do
109
+ it 'contains contact id' do
110
+ expect(@request.css('contact|info contact|id', 'contact' => Epp::Eis::XML_NS_CONTACT).text).to eq('CID:TEST:1')
111
+ end
112
+ end
113
+
114
+ context 'response' do
53
115
  it 'returns contact id' do
54
- @response.contact_id.should == 'CID:TEST:1'
116
+ expect(@response.contact_id).to eq('CID:TEST:1')
55
117
  end
56
118
 
57
119
  it 'returns roid' do
58
- @response.contact_roid.should == 'C0000000006-EPP'
120
+ expect(@response.contact_roid).to eq('C0000000006-EPP')
59
121
  end
60
122
 
61
123
  it 'returns status' do
62
- @response.contact_status.should == 'linked'
124
+ expect(@response.contact_status).to eq('linked')
63
125
  end
64
126
 
65
127
  it 'returns name' do
66
- @response.contact_name.should == 'Uus nimi ajee'
128
+ expect(@response.contact_name).to eq('Uus nimi ajee')
67
129
  end
68
130
 
69
131
  it 'returns street' do
70
- @response.contact_street.should == 'Kastani'
132
+ expect(@response.contact_street).to eq('Kastani')
71
133
  end
72
134
 
73
135
  it 'returns city' do
74
- @response.contact_city.should == 'Tallinn'
136
+ expect(@response.contact_city).to eq('Tallinn')
75
137
  end
76
138
 
77
139
  it 'returns postal code' do
78
- @response.contact_postal_code.should == '10613'
140
+ expect(@response.contact_postal_code).to eq('10613')
79
141
  end
80
142
 
81
143
  it 'returns country code' do
82
- @response.contact_country_code.should == 'EE'
144
+ expect(@response.contact_country_code).to eq('EE')
83
145
  end
84
146
 
85
147
  it 'returns contact email' do
86
- @response.contact_email.should == 'test@test.host'
148
+ expect(@response.contact_email).to eq('test@test.host')
87
149
  end
88
150
  end
89
151
  end
90
152
 
91
153
  describe 'update_contact' do
92
- context 'when response is successful' do
93
- before(:each) do
94
- @server.stub(:send_request).and_return(xml_mock('responses/contact/update_contact_1000.xml'))
95
- @response = @server.update_contact('CID:TEST:10', nil, nil, nil, nil, nil, nil, nil, nil, 'op', legal_mock('test.pdf'), 'pdf')
154
+ before(:each) do
155
+ @server.should_receive(:send_request) do |xml|
156
+ @request = Nokogiri::XML(xml)
157
+ xml_mock('responses/contact/update_contact_1000.xml')
96
158
  end
97
-
159
+ @response = @server.update_contact('CID:TEST:10', 'Test', 'Test Street 11-2', 'Test City', '123456', 'EE', '+372.5555555', 'test@test.com', '37812124567', 'op', legal_mock('test.pdf'), 'pdf')
160
+ end
161
+
162
+ context 'request' do
163
+ it 'contains contact id' do
164
+ expect(@request.css('contact|update contact|id', 'contact' => Epp::Eis::XML_NS_CONTACT).text).to eq('CID:TEST:10')
165
+ end
166
+
167
+ it 'contains contact name' do
168
+ expect(@request.css('contact|update contact|postalInfo contact|name', 'contact' => Epp::Eis::XML_NS_CONTACT).text).to eql('Test')
169
+ end
170
+
171
+ it 'contains street' do
172
+ expect(@request.css('contact|update contact|postalInfo contact|addr contact|street', 'contact' => Epp::Eis::XML_NS_CONTACT).text).to eql('Test Street 11-2')
173
+ end
174
+
175
+ it 'contains city' do
176
+ expect(@request.css('contact|update contact|postalInfo contact|addr contact|city', 'contact' => Epp::Eis::XML_NS_CONTACT).text).to eql('Test City')
177
+ end
178
+
179
+ it 'contains postal code' do
180
+ expect(@request.css('contact|update contact|postalInfo contact|addr contact|pc', 'contact' => Epp::Eis::XML_NS_CONTACT).text).to eql('123456')
181
+ end
182
+
183
+ it 'contains country code' do
184
+ expect(@request.css('contact|update contact|postalInfo contact|addr contact|cc', 'contact' => Epp::Eis::XML_NS_CONTACT).text).to eql('EE')
185
+ end
186
+
187
+ it 'contains phone number' do
188
+ expect(@request.css('contact|update contact|voice', 'contact' => Epp::Eis::XML_NS_CONTACT).text).to eql('+372.5555555')
189
+ end
190
+
191
+ it 'contains phone email' do
192
+ expect(@request.css('contact|update contact|email', 'contact' => Epp::Eis::XML_NS_CONTACT).text).to eql('test@test.com')
193
+ end
194
+
195
+ it 'contains identification code' do
196
+ expect(@request.css('contact|update contact|ident', 'contact' => Epp::Eis::XML_NS_CONTACT).text).to eql('37812124567')
197
+ end
198
+
199
+ it 'contains identification type' do
200
+ expect(@request.css('contact|update contact|ident', 'contact' => Epp::Eis::XML_NS_CONTACT).first['type']).to eql('op')
201
+ end
202
+ end
203
+
204
+ context 'response' do
98
205
  it 'returns response code' do
99
- @response.code.should == 1000
206
+ expect(@response.code).to eq(1000)
100
207
  end
101
208
 
102
209
  it 'returns response message' do
103
- @response.message.should == 'Command completed successfully'
210
+ expect(@response.message).to eq('Command completed successfully')
104
211
  end
105
212
  end
106
213
  end
@@ -7,12 +7,41 @@ describe Epp::Eis::DomainCommands do
7
7
  end
8
8
 
9
9
  describe 'create_domain' do
10
- context 'when response is successful' do
11
- before(:each) do
12
- @server.stub(:send_request).and_return(xml_mock('responses/domain/create_domain_1000.xml'))
13
- @response = @server.create_domain('testing.ee', 'name_server_set1', 'domain_registrator1', 'administrative_contact1', legal_mock('test.pdf'), 'pdf')
10
+ before(:each) do
11
+ @server.should_receive(:send_request) do |xml|
12
+ @request = Nokogiri::XML(xml)
13
+ xml_mock('responses/domain/create_domain_1000.xml')
14
+ end
15
+ @response = @server.create_domain('testing.ee', 'name_server_set1', 'domain_registrator1', ['administrative_contact1', 'administrative_contact2'], legal_mock('test.pdf'), 'pdf')
16
+ end
17
+
18
+ context 'request' do
19
+ it 'contains domain name' do
20
+ @request.css('domain|create domain|name', 'domain' => Epp::Eis::XML_NS_DOMAIN).text.should == 'testing.ee'
21
+ end
22
+
23
+ it 'contains registration period' do
24
+ @request.css('domain|create domain|period', 'domain' => Epp::Eis::XML_NS_DOMAIN).text.should == '1'
25
+ end
26
+
27
+ it 'contains registration period unit' do
28
+ @request.css('domain|create domain|period', 'domain' => Epp::Eis::XML_NS_DOMAIN).first['unit'].should == 'y'
14
29
  end
15
30
 
31
+ it 'contains nsset' do
32
+ @request.css('domain|create domain|nsset', 'domain' => Epp::Eis::XML_NS_DOMAIN).text.should == 'name_server_set1'
33
+ end
34
+
35
+ it 'contains registrant' do
36
+ @request.css('domain|create domain|registrant', 'domain' => Epp::Eis::XML_NS_DOMAIN).text.should == 'domain_registrator1'
37
+ end
38
+
39
+ it 'contains administrative contacts' do
40
+ @request.css('domain|create domain|admin', 'domain' => Epp::Eis::XML_NS_DOMAIN).collect{ |n| n.text }.should include('administrative_contact1', 'administrative_contact2')
41
+ end
42
+ end
43
+
44
+ context 'response' do
16
45
  it 'returns domain name' do
17
46
  @response.domain_name.should == 'testing.ee'
18
47
  end
@@ -7,80 +7,147 @@ describe Epp::Eis::NssetCommands do
7
7
  end
8
8
 
9
9
  describe 'check_nsset' do
10
-
11
- context 'when response is successful' do
12
-
13
- before(:each) do
14
- @server.stub(:send_request).and_return(xml_mock('responses/nsset/check_nsset_1000.xml'))
10
+ before(:each) do
11
+ @server.should_receive(:send_request) do |xml|
12
+ @request = Nokogiri::XML(xml)
13
+ xml_mock('responses/nsset/check_nsset_1000.xml')
15
14
  end
15
+ end
16
+
17
+ context 'request' do
18
+ it 'contains nsset id' do
19
+ @server.check_nsset('NSSID:TEST:1')
20
+ expect(@request.css('nsset|check nsset|id', 'nsset' => Epp::Eis::XML_NS_NSSET).text).to eq('NSSID:TEST:1')
21
+ end
22
+ end
16
23
 
24
+ context 'response' do
17
25
  it 'has status code 1000' do
18
- @server.check_nsset('NSSID:TEST:1').code.should == 1000
26
+ expect(@server.check_nsset('NSSID:TEST:1').code).to eq(1000)
19
27
  end
20
28
 
21
29
  context 'when multiple nsset names are provided' do
22
30
  it 'has multiple nsset check items in response object' do
23
- @server.check_nsset('NSSID:TEST:1', 'NSSID:TEST:2').items.size.should == 2
31
+ expect(@server.check_nsset('NSSID:TEST:1', 'NSSID:TEST:2').items.size).to eq(2)
24
32
  end
25
33
  end
26
34
  end
27
35
  end
28
36
 
29
37
  describe 'create_nsset' do
30
- context 'when response is successful' do
31
- before(:each) do
32
- @server.stub(:send_request).and_return(xml_mock('responses/nsset/create_nsset_1000.xml'))
33
- @response = @server.create_nsset('NSSID:TEST:2', [['test.com', '123.123.123.123'], ['ns2.test.com', '111.111.111.111']], 'test1')
38
+ before(:each) do
39
+ @server.should_receive(:send_request) do |xml|
40
+ @request = Nokogiri::XML(xml)
41
+ xml_mock('responses/nsset/create_nsset_1000.xml')
34
42
  end
35
-
43
+ @response = @server.create_nsset('NSSID:TEST:2', [['test.com', '123.123.123.123'], ['ns2.test.com', '111.111.111.111']], 'test1')
44
+ end
45
+
46
+ context 'request' do
47
+ it 'contains nsset id' do
48
+ expect(@request.css('nsset|create nsset|id', 'nsset' => Epp::Eis::XML_NS_NSSET).text).to eq('NSSID:TEST:2')
49
+ end
50
+
51
+ it 'contains nameserver names' do
52
+ expect(@request.css('nsset|create nsset|ns nsset|name', 'nsset' => Epp::Eis::XML_NS_NSSET).collect{ |n| n.text }).to include('test.com', 'ns2.test.com')
53
+ end
54
+
55
+ it 'contains nameserver ip addresses' do
56
+ expect(@request.css('nsset|create nsset|ns nsset|addr', 'nsset' => Epp::Eis::XML_NS_NSSET).collect{ |n| n.text }).to include('123.123.123.123', '111.111.111.111')
57
+ end
58
+
59
+ it 'contains technical contact' do
60
+ expect(@request.css('nsset|create nsset|tech', 'nsset' => Epp::Eis::XML_NS_NSSET).text).to eq('test1')
61
+ end
62
+ end
63
+
64
+ context 'response' do
36
65
  it 'returns nsset id' do
37
- @response.nsset_id.should == 'NSSID:TEST:2'
66
+ expect(@response.nsset_id).to eq('NSSID:TEST:2')
38
67
  end
39
68
 
40
69
  it 'returns nsset create date' do
41
- @response.nsset_create_date.should == '2010-02-08T16:27:22+02:00'
70
+ expect(@response.nsset_create_date).to eq('2010-02-08T16:27:22+02:00')
42
71
  end
43
72
  end
44
73
  end
45
74
 
46
75
  describe 'info_nsset' do
47
- context 'when response is successful' do
48
- before(:each) do
49
- @server.stub(:send_request).and_return(xml_mock('responses/nsset/info_nsset_1000.xml'))
50
- @response = @server.info_nsset('NSSID:TEST:2')
76
+ before(:each) do
77
+ @server.should_receive(:send_request) do |xml|
78
+ @request = Nokogiri::XML(xml)
79
+ xml_mock('responses/nsset/info_nsset_1000.xml')
51
80
  end
52
-
81
+ @response = @server.info_nsset('NSSID:TEST:2')
82
+ end
83
+
84
+ context 'request' do
85
+ it 'contains nsset id' do
86
+ expect(@request.css('nsset|info nsset|id', 'nsset' => Epp::Eis::XML_NS_NSSET).text).to eq('NSSID:TEST:2')
87
+ end
88
+ end
89
+
90
+ context 'response' do
53
91
  it 'returns nsset id' do
54
- @response.nsset_id.should == 'NSSID:TEST:2'
92
+ expect(@response.nsset_id).to eq('NSSID:TEST:2')
55
93
  end
56
94
 
57
95
  it 'returns roid' do
58
- @response.nsset_roid.should == 'N0000000051-EPP'
96
+ expect(@response.nsset_roid).to eq('N0000000051-EPP')
59
97
  end
60
98
 
61
99
  it 'returns status' do
62
- @response.nsset_status.should == 'ok'
100
+ expect(@response.nsset_status).to eq('ok')
63
101
  end
64
102
 
65
103
  it 'returns nameservers' do
66
- @response.nameservers.should == [['test.com', '123.123.123.123'], ['ns2.test.com', '111.111.111.111']]
104
+ expect(@response.nameservers).to eq([['test.com', '123.123.123.123'], ['ns2.test.com', '111.111.111.111']])
67
105
  end
68
106
  end
69
107
  end
70
108
 
71
109
  describe 'update_nsset' do
72
- context 'when response is successful' do
73
- before(:each) do
74
- @server.stub(:send_request).and_return(xml_mock('responses/nsset/update_nsset_1000.xml'))
75
- @response = @server.update_nsset('NSSID:TEST:2', [['ns3.test.com', '112.112.112.112']], 'margustech1', 'ns2.test.com', 'tech1')
110
+ before(:each) do
111
+ @server.should_receive(:send_request) do |xml|
112
+ @request = Nokogiri::XML(xml)
113
+ xml_mock('responses/nsset/update_nsset_1000.xml')
76
114
  end
77
-
115
+ @response = @server.update_nsset('NSSID:TEST:2', [['ns3.test.com', '112.112.112.112']], 'margustech1', 'ns2.test.com', 'tech1')
116
+ end
117
+
118
+ context 'request' do
119
+ it 'contains nsset id' do
120
+ expect(@request.css('nsset|update nsset|id', 'nsset' => Epp::Eis::XML_NS_NSSET).text).to eq('NSSID:TEST:2')
121
+ end
122
+
123
+ it 'contains nameserver names to be added' do
124
+ expect(@request.css('nsset|update nsset|add nsset|ns nsset|name', 'nsset' => Epp::Eis::XML_NS_NSSET).text).to eq('ns3.test.com')
125
+ end
126
+
127
+ it 'contains nameserver ip addresses to be added' do
128
+ expect(@request.css('nsset|update nsset|add nsset|ns nsset|addr', 'nsset' => Epp::Eis::XML_NS_NSSET).text).to eq('112.112.112.112')
129
+ end
130
+
131
+ it 'contains tech contact to be added' do
132
+ expect(@request.css('nsset|update nsset|add nsset|tech', 'nsset' => Epp::Eis::XML_NS_NSSET).text).to eq('margustech1')
133
+ end
134
+
135
+ it 'contains nameserver to be removed' do
136
+ expect(@request.css('nsset|update nsset|rem nsset|name', 'nsset' => Epp::Eis::XML_NS_NSSET).text).to eq('ns2.test.com')
137
+ end
138
+
139
+ it 'contains tech contact to be removed' do
140
+ expect(@request.css('nsset|update nsset|rem nsset|tech', 'nsset' => Epp::Eis::XML_NS_NSSET).text).to eq('tech1')
141
+ end
142
+ end
143
+
144
+ context 'response' do
78
145
  it 'returns response code' do
79
- @response.code.should == 1000
146
+ expect(@response.code).to eq(1000)
80
147
  end
81
148
 
82
149
  it 'returns response message' do
83
- @response.message.should == 'Command completed successfully'
150
+ expect(@response.message).to eq('Command completed successfully')
84
151
  end
85
152
  end
86
153
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: epp-eis
3
3
  version: !ruby/object:Gem::Version
4
- hash: 21
4
+ hash: 19
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
- - 1
10
- version: 1.0.1
9
+ - 2
10
+ version: 1.0.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Priit Haamer
@@ -15,13 +15,25 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2013-04-09 00:00:00 +03:00
18
+ date: 2013-07-02 00:00:00 +03:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
22
+ version_requirements: &id001 !ruby/object:Gem::Requirement
23
+ none: false
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ hash: 3
28
+ segments:
29
+ - 0
30
+ version: "0"
31
+ requirement: *id001
32
+ type: :runtime
22
33
  name: epp-nokogiri
23
34
  prerelease: false
24
- requirement: &id001 !ruby/object:Gem::Requirement
35
+ - !ruby/object:Gem::Dependency
36
+ version_requirements: &id002 !ruby/object:Gem::Requirement
25
37
  none: false
26
38
  requirements:
27
39
  - - ">="
@@ -30,12 +42,26 @@ dependencies:
30
42
  segments:
31
43
  - 0
32
44
  version: "0"
33
- type: :runtime
34
- version_requirements: *id001
45
+ requirement: *id002
46
+ type: :development
47
+ name: rake
48
+ prerelease: false
35
49
  - !ruby/object:Gem::Dependency
50
+ version_requirements: &id003 !ruby/object:Gem::Requirement
51
+ none: false
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ hash: 3
56
+ segments:
57
+ - 0
58
+ version: "0"
59
+ requirement: *id003
60
+ type: :development
36
61
  name: rspec
37
62
  prerelease: false
38
- requirement: &id002 !ruby/object:Gem::Requirement
63
+ - !ruby/object:Gem::Dependency
64
+ version_requirements: &id004 !ruby/object:Gem::Requirement
39
65
  none: false
40
66
  requirements:
41
67
  - - ">="
@@ -44,12 +70,12 @@ dependencies:
44
70
  segments:
45
71
  - 0
46
72
  version: "0"
73
+ requirement: *id004
47
74
  type: :development
48
- version_requirements: *id002
49
- - !ruby/object:Gem::Dependency
50
75
  name: guard
51
76
  prerelease: false
52
- requirement: &id003 !ruby/object:Gem::Requirement
77
+ - !ruby/object:Gem::Dependency
78
+ version_requirements: &id005 !ruby/object:Gem::Requirement
53
79
  none: false
54
80
  requirements:
55
81
  - - ">="
@@ -58,12 +84,12 @@ dependencies:
58
84
  segments:
59
85
  - 0
60
86
  version: "0"
87
+ requirement: *id005
61
88
  type: :development
62
- version_requirements: *id003
63
- - !ruby/object:Gem::Dependency
64
89
  name: guard-rspec
65
90
  prerelease: false
66
- requirement: &id004 !ruby/object:Gem::Requirement
91
+ - !ruby/object:Gem::Dependency
92
+ version_requirements: &id006 !ruby/object:Gem::Requirement
67
93
  none: false
68
94
  requirements:
69
95
  - - ">="
@@ -72,8 +98,10 @@ dependencies:
72
98
  segments:
73
99
  - 0
74
100
  version: "0"
101
+ requirement: *id006
75
102
  type: :development
76
- version_requirements: *id004
103
+ name: rb-fsevent
104
+ prerelease: false
77
105
  description: Ruby client for Estonian Internet Foundation EPP service
78
106
  email:
79
107
  - priit@fraktal.ee