moo_moo 0.4.0 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -80,6 +80,24 @@ api (e.g. Lookup :domain_contacts). This custom methods are not namespaced.
80
80
  Check their documentation to see what parameters does it expect and what responses
81
81
  does it return.
82
82
 
83
+ TLD List
84
+ --------
85
+
86
+ MooMoo::Lookup provides a `tlds` method that is used to list top level domains
87
+ that OpenSRS support. At this time, OpenSRS has no API method that does that,
88
+ so we keep that in a custom configuration file (config/tlds.yml).
89
+
90
+ The top level domains data comes from http://www.opensrs.com/site/services/domains/tlds.
91
+ OpenSRS also provides a CSV file for country code top level domains at
92
+ http://opensrs.com/images/elements/cctld-pricing.csv.
93
+
94
+ In order to generate our own config/tlds.yml file, we use the scripts/parse_cctld_csv
95
+ script to parse OpenSRS csv file. In order to do that, place an updated cctld-pricing.csv
96
+ under config, and run scripts/parse_cctld_csv.
97
+
98
+ For non country code top level domains, the scripts/parse_cctld_csv `defaults`
99
+ list needs to be updated.
100
+
83
101
  Note on Patches/Pull Requests
84
102
  -----------------------------
85
103
 
@@ -0,0 +1 @@
1
+ Extension,Country,Extensions offered,Price/year,Transfers,Redemption Fee,Notes
data/config/tlds.yml ADDED
@@ -0,0 +1,242 @@
1
+ - com
2
+ - net
3
+ - org
4
+ - info
5
+ - biz
6
+ - mobi
7
+ - pro
8
+ - name
9
+ - asia
10
+ - tel
11
+ - co
12
+ - me
13
+ - tv
14
+ - ws
15
+ - xxx
16
+ - jobs
17
+ - aero
18
+ - coop
19
+ - ac
20
+ - ae
21
+ - af
22
+ - com.af
23
+ - net.af
24
+ - org.af
25
+ - ag
26
+ - com.ag
27
+ - net.ag
28
+ - nom.ag
29
+ - org.ag
30
+ - com.ai
31
+ - net.ai
32
+ - off.ai
33
+ - org.ai
34
+ - am
35
+ - com.ar
36
+ - as
37
+ - at
38
+ - co.at
39
+ - or.at
40
+ - com.au
41
+ - net.au
42
+ - asn.au
43
+ - id.au
44
+ - org.au
45
+ - com.br
46
+ - bz
47
+ - ca
48
+ - cc
49
+ - cd
50
+ - ch
51
+ - cl
52
+ - cm
53
+ - co.cm
54
+ - com.cm
55
+ - net.cm
56
+ - cn
57
+ - com.cn
58
+ - net.cn
59
+ - org.cn
60
+ - co
61
+ - com.co
62
+ - net.co
63
+ - nom.co
64
+ - cx
65
+ - cz
66
+ - de
67
+ - dk
68
+ - ec
69
+ - com.ec
70
+ - net.ec
71
+ - fin.ec
72
+ - info.ec
73
+ - med.ec
74
+ - pro.ec
75
+ - com.es
76
+ - nom.es
77
+ - org.es
78
+ - es
79
+ - eu
80
+ - fi
81
+ - fm
82
+ - fr
83
+ - gd
84
+ - gg
85
+ - co.gg
86
+ - net.gg
87
+ - org.gg
88
+ - gl
89
+ - co.go
90
+ - com.gl
91
+ - net.gl
92
+ - org.gl
93
+ - gs
94
+ - gy
95
+ - co.gy
96
+ - com.gy
97
+ - net.gy
98
+ - hk
99
+ - hm
100
+ - hn
101
+ - com.hn
102
+ - net.hn
103
+ - org.hn
104
+ - com.hr
105
+ - ht
106
+ - com.ht
107
+ - info.ht
108
+ - net.ht
109
+ - org.ht
110
+ - hu
111
+ - co.hu
112
+ - co.il
113
+ - im
114
+ - co.im
115
+ - com.im
116
+ - net.im
117
+ - org.im
118
+ - co.in
119
+ - firm.in
120
+ - gen.in
121
+ - ind.in
122
+ - net.in
123
+ - org.in
124
+ - in
125
+ - io
126
+ - is
127
+ - it
128
+ - je
129
+ - co.je
130
+ - jp
131
+ - kg
132
+ - biz.ki
133
+ - com.ki
134
+ - info.ki
135
+ - mobi.ki
136
+ - net.ki
137
+ - tel.ki
138
+ - kr
139
+ - co.kr
140
+ - la
141
+ - lc
142
+ - co.lc
143
+ - com.lc
144
+ - l.lc
145
+ - net.lc
146
+ - org.lc
147
+ - p.lc
148
+ - li
149
+ - lt
150
+ - lu
151
+ - lv
152
+ - com.lv
153
+ - ly
154
+ - com.ly
155
+ - ma
156
+ - co.ma
157
+ - md
158
+ - me
159
+ - mn
160
+ - ms
161
+ - mu
162
+ - com.mx
163
+ - mx
164
+ - my
165
+ - com.my
166
+ - net.my
167
+ - org.my
168
+ - nl
169
+ - no
170
+ - nu
171
+ - net.nz
172
+ - org.nz
173
+ - pe
174
+ - com.pe
175
+ - net.pe
176
+ - pl
177
+ - biz.pl
178
+ - com.pl
179
+ - edu.pl
180
+ - info.pl
181
+ - net.pl
182
+ - nom.pl
183
+ - org.pl
184
+ - shop.pl
185
+ - waw.pl
186
+ - pm
187
+ - com.pr
188
+ - pt
189
+ - com.pt
190
+ - qa
191
+ - re
192
+ - ro
193
+ - com.ro
194
+ - ru
195
+ - com.ru
196
+ - com.sb
197
+ - net.sb
198
+ - org.sb
199
+ - sc
200
+ - com.sc
201
+ - net.sc
202
+ - org.sc
203
+ - se
204
+ - sg
205
+ - sh
206
+ - si
207
+ - so
208
+ - com.so
209
+ - net.so
210
+ - org.so
211
+ - sr
212
+ - st
213
+ - tc
214
+ - tf
215
+ - tk
216
+ - tl
217
+ - tm
218
+ - to
219
+ - tv
220
+ - tw
221
+ - com.tw
222
+ - idv.tw
223
+ - org.tw
224
+ - com.ua
225
+ - co.uk
226
+ - ltd.uk
227
+ - me.uk
228
+ - net.uk
229
+ - org.uk
230
+ - plc.uk
231
+ - com.uy
232
+ - vc
233
+ - com.vc
234
+ - net.vc
235
+ - org.vc
236
+ - co.ve
237
+ - com.ve
238
+ - vg
239
+ - wf
240
+ - ws
241
+ - yt
242
+ - co.za
@@ -1,5 +1,9 @@
1
+ require 'yaml'
2
+
1
3
  module MooMoo
2
4
  class Lookup < BaseCommand
5
+ TLDS_FILE = File.expand_path("../../../../config/tlds.yml", __FILE__)
6
+
3
7
  ##
4
8
  # Determines whether the domain belongs to the RSP who issued the command.
5
9
  #
@@ -128,5 +132,12 @@ module MooMoo
128
132
  }
129
133
  end
130
134
  end
135
+
136
+ # Public: Lists top level domain OpenSRS supports. At this point, OpenSRS
137
+ # does not have an api call to do that, so we keep our own list of supported
138
+ # top level domains.
139
+ def tlds
140
+ @tlds ||= YAML.load_file(TLDS_FILE)
141
+ end
131
142
  end
132
143
  end
@@ -1,3 +1,3 @@
1
1
  module MooMoo
2
- VERSION = Version = "0.4.0"
2
+ VERSION = Version = "0.5.0"
3
3
  end
@@ -0,0 +1,32 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # Converts an OpenSRS Country Code Top Level Domains pricing csv file to a list of TLD
4
+ # and stores them in a yml file. For non country code tlds, as OpenSRS does not
5
+ # provide a csv file, we keep them in a custom list.
6
+ #
7
+ # Sources:
8
+ # - http://opensrs.com/images/elements/cctld-pricing.csv
9
+ # - http://www.opensrs.com/site/services/domains/tlds
10
+
11
+ require 'csv'
12
+
13
+ csv_file = File.expand_path("../../config/cctld-pricing.csv", __FILE__)
14
+ yml_file = File.expand_path("../../config/tlds.yml", __FILE__)
15
+
16
+ # Non Country Code Top Level Domains
17
+ defaults = %w(com net org info biz mobi pro name asia tel co me tv ws xxx jobs aero coop)
18
+
19
+ File.open(yml_file, 'w') do |file|
20
+ # Writes domains that are not part of the cctld-pricing.csv file
21
+ defaults.each do |tld|
22
+ file.write("- #{tld}\n")
23
+ end
24
+
25
+ CSV.foreach(csv_file, col_sep: ",", headers: true, return_headers: false) do |row|
26
+ if row[2]
27
+ row[2].split(";").each do |tld|
28
+ file.write("- #{tld.strip}\n")
29
+ end
30
+ end
31
+ end
32
+ end
@@ -65,4 +65,10 @@ describe MooMoo::Lookup do
65
65
  ]
66
66
  end
67
67
  end
68
+
69
+ describe "#tlds" do
70
+ it "lists top level domains opensrs supports" do
71
+ subject.tlds.should == YAML.load_file(MooMoo::Lookup::TLDS_FILE)
72
+ end
73
+ end
68
74
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: moo_moo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-08-29 00:00:00.000000000 Z
12
+ date: 2012-12-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: extlib
@@ -138,6 +138,8 @@ files:
138
138
  - LICENSE
139
139
  - README.md
140
140
  - Rakefile
141
+ - config/cctld-pricing.csv
142
+ - config/tlds.yml
141
143
  - lib/moo_moo.rb
142
144
  - lib/moo_moo/base_command.rb
143
145
  - lib/moo_moo/config.rb
@@ -153,6 +155,7 @@ files:
153
155
  - lib/moo_moo/services/transfer.rb
154
156
  - lib/moo_moo/version.rb
155
157
  - moo_moo.gemspec
158
+ - scripts/parse_cctld_csv
156
159
  - spec/fixtures/success_response.xml
157
160
  - spec/integration_spec.rb
158
161
  - spec/moo_moo/base_command_spec.rb
@@ -181,7 +184,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
181
184
  version: '0'
182
185
  segments:
183
186
  - 0
184
- hash: -848063552060590534
187
+ hash: 2479209720356914647
185
188
  required_rubygems_version: !ruby/object:Gem::Requirement
186
189
  none: false
187
190
  requirements:
@@ -190,10 +193,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
190
193
  version: '0'
191
194
  segments:
192
195
  - 0
193
- hash: -848063552060590534
196
+ hash: 2479209720356914647
194
197
  requirements: []
195
198
  rubyforge_project: opensrs
196
- rubygems_version: 1.8.23
199
+ rubygems_version: 1.8.24
197
200
  signing_key:
198
201
  specification_version: 3
199
202
  summary: Implements OpenSRS XML API