epp-client-afnic 0.11.1 → 0.12.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/epp-client/afnic.rb +48 -23
  2. metadata +17 -17
@@ -22,7 +22,7 @@ module EPPClient
22
22
  # [<tt>:test</tt>] sets the server to be the test server.
23
23
  def initialize(args)
24
24
  if args.delete(:test) == true
25
- args[:server] ||= 'epp.test.nic.fr'
25
+ args[:server] ||= 'epp.sandbox.nic.fr'
26
26
  else
27
27
  args[:server] ||= 'epp.nic.fr'
28
28
  end
@@ -83,7 +83,7 @@ module EPPClient
83
83
  ret[:idStatus] = {:value => r.text}
84
84
  ret[:idStatus][:when] = r.attr('when').value if r.attr('when')
85
85
  ret[:idStatus][:source] = r.attr('source').value if r.attr('source')
86
- end
86
+ end
87
87
  %w(siren VAT trademark DUNS local).each do |val|
88
88
  if (r = leI.xpath("frnic:#{val}", EPPClient::SCHEMAS_URL)).size > 0
89
89
  ret[val.to_sym] = r.text
@@ -206,7 +206,9 @@ module EPPClient
206
206
  if (obsoleted = contact.xpath('frnic:obsoleted', EPPClient::SCHEMAS_URL)).size > 0
207
207
  if obsoleted.text != '0'
208
208
  ret[:obsoleted] = {}
209
- ret[:obsoleted][:when] = DateTime.parse(v_when.value) if v_when = obsoleted.attr('when')
209
+ if v_when = obsoleted.attr('when')
210
+ ret[:obsoleted][:when] = DateTime.parse(v_when.value)
211
+ end
210
212
  end
211
213
  end
212
214
  if (reachable = contact.xpath('frnic:reachable', EPPClient::SCHEMAS_URL)).size > 0
@@ -475,26 +477,49 @@ module EPPClient
475
477
  super # placeholder so that I can add some doc
476
478
  end
477
479
 
478
- def poll_req_process(xml) #:nodoc:
479
- ret = super(xml)
480
- if (quaData = xml.xpath('epp:extension/frnic:resData/frnic:quaData', EPPClient::SCHEMAS_URL)).size > 0
481
- if (contact = xml.xpath('frnic:contact', EPPClient::SCHEMAS_URL)).size > 0
482
- cret = {:id => contact.xpath('frnic:id', EPPClient::SCHEMAS_URL).text}
483
- qP = contact.xpath('frnic:qualificationProcess', EPPClient::SCHEMAS_URL)
484
- cret[:qualificationProcess][:s] = qP.attr('s').value
485
- cret[:qualificationProcess][:lang] = qP.attr('lang').value if qP.attr('lang')
486
- if (leI = contact.xpath('frnic:legalEntityInfos', EPPClient::SCHEMAS_URL)).size > 0
487
- ret[:legalEntityInfos] = legalEntityInfos(leI)
488
- end
489
- reach = contact.xpath('frnic:reachability', EPPClient::SCHEMAS_URL)
490
- cret[:reachability] = {:reStatus => reach.xpath('frnic:reStatus', EPPClient::SCHEMAS_URL).text}
491
- if (voice = reach.xpath('frnic:voice', EPPClient::SCHEMAS_URL)).size > 0
492
- cret[:reachability][:voice] = voice.text
493
- end
494
- if (email = reach.xpath('frnic:email', EPPClient::SCHEMAS_URL)).size > 0
495
- cret[:reachability][:email] = email.text
496
- end
497
- ret[:quaData] = {:contact => cret}
480
+ EPPClient::Poll::PARSERS['frnic:ext/frnic:resData/frnic:quaData/frnic:contact'] = :contact_afnic_qualification
481
+
482
+ def contact_afnic_qualification(xml) #:nodoc:
483
+ contact = xml.xpath('epp:extension/frnic:ext/frnic:resData/frnic:quaData/frnic:contact', EPPClient::SCHEMAS_URL)
484
+ ret = {:id => contact.xpath('frnic:id', EPPClient::SCHEMAS_URL).text}
485
+ qP = contact.xpath('frnic:qualificationProcess', EPPClient::SCHEMAS_URL)
486
+ ret[:qualificationProcess] = {:s => qP.attr('s').value}
487
+ ret[:qualificationProcess][:lang] = qP.attr('lang').value if qP.attr('lang')
488
+ if (leI = contact.xpath('frnic:legalEntityInfos', EPPClient::SCHEMAS_URL)).size > 0
489
+ ret[:legalEntityInfos] = legalEntityInfos(leI)
490
+ end
491
+ reach = contact.xpath('frnic:reachability', EPPClient::SCHEMAS_URL)
492
+ ret[:reachability] = {:reStatus => reach.xpath('frnic:reStatus', EPPClient::SCHEMAS_URL).text}
493
+ if (voice = reach.xpath('frnic:voice', EPPClient::SCHEMAS_URL)).size > 0
494
+ ret[:reachability][:voice] = voice.text
495
+ end
496
+ if (email = reach.xpath('frnic:email', EPPClient::SCHEMAS_URL)).size > 0
497
+ ret[:reachability][:email] = email.text
498
+ end
499
+ ret
500
+ end
501
+
502
+ EPPClient::Poll::PARSERS['frnic:ext/frnic:resData/frnic:trdData/frnic:domain'] = :domain_afnic_trade_response
503
+
504
+ def domain_afnic_trade_response(xml) #:nodoc:
505
+ dom = xml.xpath('epp:extension/frnic:ext/frnic:resData/frnic:trdData/frnic:domain', EPPClient::SCHEMAS_URL)
506
+ ret = {
507
+ :name => dom.xpath('frnic:name', EPPClient::SCHEMAS_URL).text,
508
+ :trStatus => dom.xpath('frnic:trStatus', EPPClient::SCHEMAS_URL).text,
509
+ :reID => dom.xpath('frnic:reID', EPPClient::SCHEMAS_URL).text,
510
+ :reDate => DateTime.parse(dom.xpath('frnic:reDate', EPPClient::SCHEMAS_URL).text),
511
+ :acID => dom.xpath('frnic:acID', EPPClient::SCHEMAS_URL).text,
512
+ }
513
+
514
+ # FIXME: there are discrepencies between the 1.2 xmlschema, the documentation and the reality, I'm trying to stick to reality here.
515
+ %w(reHldID acHldID).each do |f|
516
+ if (field = dom.xpath("frnic:#{f}", EPPClient::SCHEMAS_URL)).size > 0
517
+ ret[f.to_sym] = field.text
518
+ end
519
+ end
520
+ %w(rhDate ahDate).each do |f|
521
+ if (field = dom.xpath("frnic:#{f}", EPPClient::SCHEMAS_URL)).size > 0
522
+ ret[f.to_sym] = DateTime.parse(field.text)
498
523
  end
499
524
  end
500
525
  ret
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: epp-client-afnic
3
3
  version: !ruby/object:Gem::Version
4
- hash: 49
4
+ hash: 47
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
- - 11
9
- - 1
10
- version: 0.11.1
8
+ - 12
9
+ - 0
10
+ version: 0.12.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Mathieu Arnold
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2013-02-07 00:00:00 Z
18
+ date: 2013-07-02 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: bundler
@@ -72,12 +72,12 @@ dependencies:
72
72
  requirements:
73
73
  - - "="
74
74
  - !ruby/object:Gem::Version
75
- hash: 49
75
+ hash: 47
76
76
  segments:
77
77
  - 0
78
- - 11
79
- - 1
80
- version: 0.11.1
78
+ - 12
79
+ - 0
80
+ version: 0.12.0
81
81
  type: :runtime
82
82
  version_requirements: *id004
83
83
  - !ruby/object:Gem::Dependency
@@ -88,12 +88,12 @@ dependencies:
88
88
  requirements:
89
89
  - - "="
90
90
  - !ruby/object:Gem::Version
91
- hash: 49
91
+ hash: 47
92
92
  segments:
93
93
  - 0
94
- - 11
95
- - 1
96
- version: 0.11.1
94
+ - 12
95
+ - 0
96
+ version: 0.12.0
97
97
  type: :runtime
98
98
  version_requirements: *id005
99
99
  - !ruby/object:Gem::Dependency
@@ -104,12 +104,12 @@ dependencies:
104
104
  requirements:
105
105
  - - "="
106
106
  - !ruby/object:Gem::Version
107
- hash: 49
107
+ hash: 47
108
108
  segments:
109
109
  - 0
110
- - 11
111
- - 1
112
- version: 0.11.1
110
+ - 12
111
+ - 0
112
+ version: 0.12.0
113
113
  type: :runtime
114
114
  version_requirements: *id006
115
115
  description: AFNIC EPP client library.