moo_moo 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (88) hide show
  1. data/.gitignore +7 -0
  2. data/.rspec +2 -0
  3. data/.rvmrc +59 -0
  4. data/.travis.yml +9 -0
  5. data/Gemfile +4 -0
  6. data/LICENSE +21 -0
  7. data/README.md +63 -0
  8. data/Rakefile +55 -0
  9. data/lib/cacert.pem +3910 -0
  10. data/lib/moo_moo/config.rb +13 -0
  11. data/lib/moo_moo/opensrs/args.rb +109 -0
  12. data/lib/moo_moo/opensrs/base.rb +75 -0
  13. data/lib/moo_moo/opensrs/command.rb +190 -0
  14. data/lib/moo_moo/opensrs/cookie_commands.rb +52 -0
  15. data/lib/moo_moo/opensrs/lookup_commands.rb +195 -0
  16. data/lib/moo_moo/opensrs/nameserver_commands.rb +70 -0
  17. data/lib/moo_moo/opensrs/opensrsexception.rb +6 -0
  18. data/lib/moo_moo/opensrs/provisioning_commands.rb +167 -0
  19. data/lib/moo_moo/opensrs/response.rb +41 -0
  20. data/lib/moo_moo/opensrs/transfer_commands.rb +83 -0
  21. data/lib/moo_moo/opensrs/utils.rb +13 -0
  22. data/lib/moo_moo/opensrs.rb +8 -0
  23. data/lib/moo_moo/version.rb +3 -0
  24. data/lib/moo_moo.rb +16 -0
  25. data/moo_moo.gemspec +33 -0
  26. data/spec/moo_moo_spec.rb +17 -0
  27. data/spec/opensrs/args_spec.rb +179 -0
  28. data/spec/opensrs/cookie_spec.rb +78 -0
  29. data/spec/opensrs/lookup_spec.rb +212 -0
  30. data/spec/opensrs/nameserver_spec.rb +124 -0
  31. data/spec/opensrs/opensrs_spec.rb +35 -0
  32. data/spec/opensrs/provisioning_spec.rb +271 -0
  33. data/spec/opensrs/transfer_spec.rb +197 -0
  34. data/spec/opensrs/utils_spec.rb +12 -0
  35. data/spec/spec_helper.rb +57 -0
  36. data/spec/vcr_cassettes/cookie/delete_cookie.yml +219 -0
  37. data/spec/vcr_cassettes/cookie/quit_session.yml +97 -0
  38. data/spec/vcr_cassettes/cookie/set_cookie.yml +123 -0
  39. data/spec/vcr_cassettes/cookie/set_cookie_fail.yml +54 -0
  40. data/spec/vcr_cassettes/cookie/update_cookie.yml +239 -0
  41. data/spec/vcr_cassettes/lookup/belongs_to_rsp.yml +54 -0
  42. data/spec/vcr_cassettes/lookup/belongs_to_rsp_negative.yml +55 -0
  43. data/spec/vcr_cassettes/lookup/get_balance.yml +55 -0
  44. data/spec/vcr_cassettes/lookup/get_deleted_domains.yml +80 -0
  45. data/spec/vcr_cassettes/lookup/get_domain.yml +211 -0
  46. data/spec/vcr_cassettes/lookup/get_domain_fail.yml +269 -0
  47. data/spec/vcr_cassettes/lookup/get_domains_by_expiredate.yml +76 -0
  48. data/spec/vcr_cassettes/lookup/get_domains_contacts.yml +129 -0
  49. data/spec/vcr_cassettes/lookup/get_domains_contacts_fail.yml +58 -0
  50. data/spec/vcr_cassettes/lookup/get_notes_for_domain.yml +85 -0
  51. data/spec/vcr_cassettes/lookup/get_notes_for_order.yml +61 -0
  52. data/spec/vcr_cassettes/lookup/get_notes_for_transfer.yml +61 -0
  53. data/spec/vcr_cassettes/lookup/get_order_info.yml +139 -0
  54. data/spec/vcr_cassettes/lookup/get_orders_by_domain.yml +76 -0
  55. data/spec/vcr_cassettes/lookup/get_price.yml +54 -0
  56. data/spec/vcr_cassettes/lookup/get_product_info.yml +49 -0
  57. data/spec/vcr_cassettes/lookup/lookup_domain_available.yml +55 -0
  58. data/spec/vcr_cassettes/lookup/lookup_domain_registered.yml +55 -0
  59. data/spec/vcr_cassettes/lookup/name_suggest.yml +396 -0
  60. data/spec/vcr_cassettes/nameserver/create.yml +49 -0
  61. data/spec/vcr_cassettes/nameserver/delete.yml +49 -0
  62. data/spec/vcr_cassettes/nameserver/get.yml +71 -0
  63. data/spec/vcr_cassettes/nameserver/modify.yml +49 -0
  64. data/spec/vcr_cassettes/provisioning/cancel_order.yml +56 -0
  65. data/spec/vcr_cassettes/provisioning/cancel_order_invalid.yml +49 -0
  66. data/spec/vcr_cassettes/provisioning/cancel_pending_orders.yml +58 -0
  67. data/spec/vcr_cassettes/provisioning/modify_all_domains.yml +49 -0
  68. data/spec/vcr_cassettes/provisioning/modify_domain.yml +49 -0
  69. data/spec/vcr_cassettes/provisioning/process_pending.yml +57 -0
  70. data/spec/vcr_cassettes/provisioning/register_domain.yml +57 -0
  71. data/spec/vcr_cassettes/provisioning/register_pending_domain.yml +55 -0
  72. data/spec/vcr_cassettes/provisioning/register_taken_domain.yml +55 -0
  73. data/spec/vcr_cassettes/provisioning/renew_domain.yml +58 -0
  74. data/spec/vcr_cassettes/provisioning/revoke_domain.yml +55 -0
  75. data/spec/vcr_cassettes/provisioning/trust_service.yml +60 -0
  76. data/spec/vcr_cassettes/provisioning/update_contacts.yml +66 -0
  77. data/spec/vcr_cassettes/transfer/cancel_transfer.yml +49 -0
  78. data/spec/vcr_cassettes/transfer/cancel_trasnfer_order.yml +49 -0
  79. data/spec/vcr_cassettes/transfer/check_transfer.yml +56 -0
  80. data/spec/vcr_cassettes/transfer/check_transfer_exists.yml +57 -0
  81. data/spec/vcr_cassettes/transfer/get_transfers_away.yml +60 -0
  82. data/spec/vcr_cassettes/transfer/get_transfers_in.yml +80 -0
  83. data/spec/vcr_cassettes/transfer/process_transfer.yml +49 -0
  84. data/spec/vcr_cassettes/transfer/process_transfer_unsuccessful.yml +49 -0
  85. data/spec/vcr_cassettes/transfer/rsp2rsp_push_transfer.yml +49 -0
  86. data/spec/vcr_cassettes/transfer/send_password.yml +49 -0
  87. data/spec/vcr_cassettes/transfer/transfer.yml +58 -0
  88. metadata +280 -0
data/.gitignore ADDED
@@ -0,0 +1,7 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
5
+ *.swp
6
+ *.swo
7
+ coverage
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/.rvmrc ADDED
@@ -0,0 +1,59 @@
1
+ #!/usr/bin/env bash
2
+
3
+ function moo() {
4
+ echo " ______________________"
5
+ echo "< Feed me before I die >"
6
+ echo " ---------------------- "
7
+ echo " \ ^__^"
8
+ echo " \ (oo)\_______"
9
+ echo " (__)\ )\\/\\"
10
+ echo " ||----w |"
11
+ echo " || ||"
12
+ }
13
+ # This is an RVM Project .rvmrc file, used to automatically load the ruby
14
+ # development environment upon cd'ing into the directory
15
+
16
+ # First we specify our desired <ruby>[@<gemset>], the @gemset name is optional.
17
+ environment_id="ruby-1.9.2-p180@moomoo"
18
+
19
+ #
20
+ # First we attempt to load the desired environment directly from the environment
21
+ # file. This is very fast and efficicent compared to running through the entire
22
+ # CLI and selector. If you want feedback on which environment was used then
23
+ # insert the word 'use' after --create as this triggers verbose mode.
24
+ #
25
+ if [[ -d "${rvm_path:-$HOME/.rvm}/environments" \
26
+ && -s "${rvm_path:-$HOME/.rvm}/environments/$environment_id" ]] ; then
27
+ \. "${rvm_path:-$HOME/.rvm}/environments/$environment_id"
28
+ moo
29
+ else
30
+ # If the environment file has not yet been created, use the RVM CLI to select.
31
+ rvm --create use "$environment_id"
32
+ moo
33
+ fi
34
+
35
+ #
36
+ # If you use an RVM gemset file to install a list of gems (*.gems), you can have
37
+ # it be automatically loaded. Uncomment the following and adjust the filename if
38
+ # necessary.
39
+ #
40
+ # filename=".gems"
41
+ # if [[ -s "$filename" ]] ; then
42
+ # rvm gemset import "$filename" | grep -v already | grep -v listed | grep -v complete | sed '/^$/d'
43
+ # fi
44
+
45
+ #
46
+ # If you use bundler and would like to run bundle each time you enter the
47
+ # directory, you can uncomment the following code.
48
+ #
49
+ # # Ensure that Bundler is installed. Install it if it is not.
50
+ # if ! command -v bundle >/dev/null; then
51
+ # printf "The rubygem 'bundler' is not installed. Installing it now.\n"
52
+ # gem install bundler
53
+ # fi
54
+ #
55
+ # # Bundle while reducing excess noise.
56
+ # printf "Bundling your gems. This may take a few minutes on a fresh clone.\n"
57
+ # bundle | grep -v '^Using ' | grep -v ' is complete' | sed '/^$/d'
58
+ #
59
+
data/.travis.yml ADDED
@@ -0,0 +1,9 @@
1
+ script: "rake"
2
+ notifications:
3
+ disabled: true
4
+ rvm:
5
+ - 1.8.7
6
+ - 1.9.2
7
+ - ree
8
+ - rbx
9
+ - jruby
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in opensrs.gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ Copyright (c) 2011 Site5 LLC
2
+
3
+ Permission is hereby granted, free of charge, to any person ob-
4
+ taining a copy of this software and associated documentation
5
+ files (the "Software"), to deal in the Software without restric-
6
+ tion, including without limitation the rights to use, copy, modi-
7
+ fy, merge, publish, distribute, sublicense, and/or sell copies of
8
+ the Software, and to permit persons to whom the Software is fur-
9
+ nished to do so, subject to the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
16
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONIN-
17
+ FRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
19
+ ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,63 @@
1
+ MooMoo
2
+ ======
3
+
4
+ Ruby library for using the Tucows OpenSRS XML API
5
+
6
+ Description
7
+ ==========
8
+
9
+ Implements most of the functionality of the OpenSRS XML API. For full
10
+ documentation of the OpenSRS XML API see
11
+ http://opensrs.com/docs/opensrsxmlapi/index.htm
12
+
13
+ Usage
14
+ =====
15
+
16
+ First, create an opensrs object from which all commands are called:
17
+
18
+ opensrs = MooMoo::OpenSRS::Base.new("horizon.opensrs.net", "<YOUR_KEY>", "<YOUR_RESELLER_USER>", "<YOUR_PASSWORD>")
19
+
20
+ Or configure MooMoo and you can initialize it without any arguments:
21
+
22
+ MooMoo.configure do |config|
23
+ config.host = "horizon.opensrs.net"
24
+ config.key = "<YOUR_KEY>"
25
+ config.user = "<YOUR_RESELLER_USER>"
26
+ config.pass = "<YOUR_PASSWORD>"
27
+ end
28
+
29
+ ...
30
+
31
+ opensrs = MooMoo::OpenSRS::Base.new
32
+
33
+ Now you can call a variety of commands to deal with domains, nameservers, etc.
34
+ Here's how to check the availability of a domain name:
35
+
36
+ res = opensrs.lookup_domain('example.com')
37
+ p res.success?
38
+ p res.result['status']
39
+
40
+ true
41
+ taken
42
+
43
+ Each method returns an OpenSRSResponse object which you can
44
+ use to determine if the call was successful and retrieve the response code
45
+ and/or error message. The result variable is a hash that contains all of the
46
+ relevant data returned by the call.
47
+
48
+ Note on Patches/Pull Requests
49
+ =======
50
+
51
+ * Fork the project.
52
+ * Make your feature addition or bug fix.
53
+ * Add tests for it. This is important so I don't break it in a
54
+ future version unintentionally.
55
+ * Commit, do not mess with rakefile, version, or history. (if you want to have
56
+ your own version, that is fine but bump version in a commit by itself I can
57
+ ignore when I pull)
58
+ * Send me a pull request. Bonus points for topic branches.
59
+
60
+ Copyright
61
+ =========
62
+
63
+ Copyright (c) 2011 Site5 LLC. See LICENSE for details.
data/Rakefile ADDED
@@ -0,0 +1,55 @@
1
+ require 'bundler'
2
+
3
+ begin
4
+ require 'rspec/core/rake_task'
5
+ rescue LoadError
6
+ puts "Please install rspec (bundle install)"
7
+ exit
8
+ end
9
+
10
+ begin
11
+ require 'metric_fu'
12
+ MetricFu::Configuration.run do |config|
13
+ config.rcov[:rcov_opts] << "-Ispec"
14
+ end
15
+ rescue LoadError
16
+ puts "Can't load metric_fu"
17
+ end
18
+
19
+ desc "Sanitize sensitive info from cassettes"
20
+ task :sanitize_cassettes do
21
+ if ENV['OPENSRS_TEST_KEY'] && ENV['OPENSRS_TEST_URL'] && ENV['OPENSRS_TEST_USER'] && ENV['OPENSRS_TEST_PASS']
22
+ path = File.join(File.dirname(__FILE__), 'spec', 'vcr_cassettes')
23
+ files = Dir.glob("#{path}/**/*.yml")
24
+ if files.any?
25
+ files.each do |file|
26
+ old = File.read(file)
27
+ puts "Sanitizing #{file}"
28
+ old.gsub!(ENV['OPENSRS_TEST_KEY'], '123key')
29
+ old.gsub!(ENV['OPENSRS_TEST_URL'], 'server.com')
30
+ old.gsub!(ENV['OPENSRS_TEST_USER'], 'opensrs_user')
31
+ old.gsub!(ENV['OPENSRS_TEST_PASS'], 'password')
32
+ old.gsub!(/x-signature.*?\n.*?\w{32}/, "x-signature:\n - 00000000000000000000000000000000")
33
+ old.gsub!(/\w{16}:\w{6}:\w{2,8}/, '0000000000000000:000000:00000')
34
+ File.open(file, 'w') do |f|
35
+ f.write old
36
+ end
37
+ end
38
+ else
39
+ puts "Nothing to sanitize"
40
+ end
41
+ else
42
+ puts "I can't sanitize without setting up OPENSRS_TEST_KEY, OPENSRS_TEST_URL, OPENSRS_TEST_USER, and OPENSRS_TEST_PASS"
43
+ end
44
+ end
45
+
46
+ RSpec::Core::RakeTask.new :spec
47
+ Bundler::GemHelper.install_tasks
48
+
49
+ desc "Run all specs with rcov"
50
+ RSpec::Core::RakeTask.new(:rcov) do |t|
51
+ t.rcov = true
52
+ t.rcov_opts = %w{--exclude osx\/objc,gems\/,spec\/,features\/ --comments}
53
+ end
54
+
55
+ task :default => [:spec]