epp-eis 0.1.1 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.markdown +0 -4
- data/epp-eis.gemspec +1 -0
- data/lib/epp-eis/contact.rb +2 -2
- data/lib/epp-eis/credit.rb +40 -0
- data/lib/epp-eis/domain.rb +4 -4
- data/lib/epp-eis/version.rb +1 -1
- data/lib/epp-eis.rb +1 -0
- data/spec/lib/epp-eis/credit_spec.rb +25 -0
- data/spec/xml/requests/credit/credit_info.xml +9 -0
- data/spec/xml/responses/credit/credit_info.xml +1148 -0
- metadata +25 -4
data/README.markdown
CHANGED
data/epp-eis.gemspec
CHANGED
data/lib/epp-eis/contact.rb
CHANGED
@@ -192,7 +192,7 @@ module Epp
|
|
192
192
|
ContactCreateResponse.new(send_request(builder.to_xml))
|
193
193
|
end
|
194
194
|
|
195
|
-
|
195
|
+
# Delete contact handle. Contact object can not be deleted if it has relations to other objects like domains or
|
196
196
|
# nssets.
|
197
197
|
def delete_contact(contact)
|
198
198
|
builder = build_epp_request do |xml|
|
@@ -257,7 +257,7 @@ module Epp
|
|
257
257
|
xml.ident ident, 'type' => ident_type
|
258
258
|
}
|
259
259
|
}
|
260
|
-
|
260
|
+
append_legal_document(xml, legal_document, legal_doc_type)
|
261
261
|
xml.clTRID UUIDTools::UUID.timestamp_create.to_s
|
262
262
|
}
|
263
263
|
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
module Epp
|
2
|
+
module Eis
|
3
|
+
|
4
|
+
XML_NS_FRED = 'http://www.nic.cz/xml/epp/fred-1.4'
|
5
|
+
|
6
|
+
class CreditInfoResponse
|
7
|
+
def initialize(response)
|
8
|
+
@response = Nokogiri::XML(response)
|
9
|
+
end
|
10
|
+
|
11
|
+
def code
|
12
|
+
@response.css('epp response result').first['code'].to_i
|
13
|
+
end
|
14
|
+
|
15
|
+
def message
|
16
|
+
@response.css('epp response result msg').text
|
17
|
+
end
|
18
|
+
|
19
|
+
def zone_credits
|
20
|
+
@response.css('fred|resCreditInfo fred|zoneCredit', 'fred' => XML_NS_FRED).inject({}) do |memo, item|
|
21
|
+
memo[item.css('fred|zone', 'fred' => XML_NS_FRED).text] = item.css('fred|credit', 'fred' => XML_NS_FRED).text
|
22
|
+
memo
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
module CreditCommands
|
28
|
+
|
29
|
+
def credit_info
|
30
|
+
builder = build_epp_request do |xml|
|
31
|
+
xml.credit_info
|
32
|
+
end
|
33
|
+
|
34
|
+
CreditInfoResponse.new(send_request(builder.to_xml))
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
Epp::Server.send(:include, Epp::Eis::CreditCommands)
|
data/lib/epp-eis/domain.rb
CHANGED
@@ -220,7 +220,7 @@ module Epp
|
|
220
220
|
[admins].flatten.each { |admin| xml.admin admin }
|
221
221
|
}
|
222
222
|
}
|
223
|
-
|
223
|
+
append_legal_document(xml, legal_document, legal_doc_type)
|
224
224
|
xml.clTRID UUIDTools::UUID.timestamp_create.to_s
|
225
225
|
}
|
226
226
|
end
|
@@ -244,7 +244,7 @@ module Epp
|
|
244
244
|
xml.name domain
|
245
245
|
}
|
246
246
|
}
|
247
|
-
|
247
|
+
append_legal_document(xml, legal_document, legal_doc_type)
|
248
248
|
xml.clTRID UUIDTools::UUID.timestamp_create.to_s
|
249
249
|
}
|
250
250
|
end
|
@@ -315,7 +315,7 @@ module Epp
|
|
315
315
|
xml.authInfo auth_info
|
316
316
|
}
|
317
317
|
}
|
318
|
-
|
318
|
+
append_legal_document(xml, legal_document, legal_doc_type)
|
319
319
|
xml.clTRID UUIDTools::UUID.timestamp_create.to_s
|
320
320
|
}
|
321
321
|
end
|
@@ -361,7 +361,7 @@ module Epp
|
|
361
361
|
end
|
362
362
|
}
|
363
363
|
}
|
364
|
-
|
364
|
+
append_legal_document(xml, legal_document, legal_doc_type)
|
365
365
|
xml.clTRID UUIDTools::UUID.timestamp_create.to_s
|
366
366
|
}
|
367
367
|
end
|
data/lib/epp-eis/version.rb
CHANGED
data/lib/epp-eis.rb
CHANGED
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Epp::Eis::CreditCommands do
|
4
|
+
|
5
|
+
before(:each) do
|
6
|
+
@server = Epp::Server.new(:server => '127.0.0.1', :tag => 'username', :password => 'password')
|
7
|
+
end
|
8
|
+
|
9
|
+
describe 'credit_info' do
|
10
|
+
context 'when response is successful' do
|
11
|
+
before(:each) do
|
12
|
+
@server.stub(:send_request).and_return(xml_mock('responses/credit/credit_info.xml'))
|
13
|
+
@response = @server.credit_info
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'returns response code' do
|
17
|
+
@response.code.should == 1000
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'returns hash of credits by TLD' do
|
21
|
+
@response.zone_credits['ee'].should == '1234.56'
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
2
|
+
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:ietf:params:xml:ns:epp-1.0 epp-1.0.xsd">
|
3
|
+
<extension>
|
4
|
+
<fred:extcommand xmlns:fred="http://www.nic.cz/xml/epp/fred-1.4" xsi:schemaLocation="http://www.nic.cz/xml/epp/fred-1.4 fred-1.4.xsd">
|
5
|
+
<fred:creditInfo/>
|
6
|
+
<fred:clTRID>pjps002#12-12-05at07:00:57</fred:clTRID>
|
7
|
+
</fred:extcommand>
|
8
|
+
</extension>
|
9
|
+
</epp>
|