moo_moo 0.9.0 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/LICENSE +1 -1
- data/README.md +34 -28
- data/Rakefile +2 -23
- data/lib/moo_moo/base_command.rb +1 -3
- data/lib/moo_moo/config.rb +0 -2
- data/lib/moo_moo/version.rb +1 -1
- data/spec/moo_moo/base_command_spec.rb +2 -2
- data/spec/moo_moo/config_spec.rb +0 -6
- data/spec/moo_moo_spec.rb +0 -2
- data/spec/spec_helper.rb +1 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ba35f694e0e56c0b84757d0eb69dec11f2e78c73
|
4
|
+
data.tar.gz: 95ee6eaca16cb0f1f26365799dd99335feb6a12f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3c3976a7695d671706ade7e86079b3bc4276bc6bb2035a2bed159616250d5ef859b797feb81fdbbac4887372ae560edc63569f49541d89bfe7a1c0aa947e47c6
|
7
|
+
data.tar.gz: 13a1907ce8cb220bfe9ca2a853073f3bd23391a79ba9c5e6c40d20a29e9c882de2aa75fc4f075edeb556620542da43bd72b9fc0393ec6849f7dab8c0cfb6cd68
|
data/LICENSE
CHANGED
data/README.md
CHANGED
@@ -3,8 +3,7 @@ MooMoo [![MooMoo Build Status][Build Icon]][Build Status]
|
|
3
3
|
|
4
4
|
MooMoo is a Ruby library for working with the [Tucows OpenSRS XML API][].
|
5
5
|
|
6
|
-
MooMoo has been tested
|
7
|
-
Rubinius 2.0.0pre, and JRuby 1.6.2.
|
6
|
+
MooMoo has been tested with MRI versions 1.9.3, 2.0.0, 2.1.1 and JRuby 1.9 mode.
|
8
7
|
|
9
8
|
Documentation is available in [RDoc][] format.
|
10
9
|
|
@@ -25,25 +24,26 @@ Usage
|
|
25
24
|
|
26
25
|
First, create an opensrs object for the namespace you want to use:
|
27
26
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
"<
|
32
|
-
|
33
|
-
|
34
|
-
|
27
|
+
```ruby
|
28
|
+
lookup = MooMoo::Lookup.new(
|
29
|
+
host: "horizon.opensrs.net",
|
30
|
+
key: "<YOUR_KEY>",
|
31
|
+
username: "<YOUR_RESELLER_USER>"
|
32
|
+
)
|
33
|
+
```
|
35
34
|
Or configure MooMoo and you can initialize it without any arguments:
|
36
35
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
36
|
+
```ruby
|
37
|
+
MooMoo.configure do |config|
|
38
|
+
config.host = "horizon.opensrs.net"
|
39
|
+
config.key = "<YOUR_KEY>"
|
40
|
+
config.username = "<YOUR_RESELLER_USER>"
|
41
|
+
end
|
43
42
|
|
44
|
-
|
43
|
+
...
|
45
44
|
|
46
|
-
|
45
|
+
lookup = MooMoo::Lookup.new
|
46
|
+
```
|
47
47
|
|
48
48
|
As an alternative, you can create a .moomoo.yml file in your project root with a default
|
49
49
|
configuration for the library to use.
|
@@ -51,18 +51,22 @@ configuration for the library to use.
|
|
51
51
|
Now you can call a variety of commands to deal with domains, nameservers, etc.
|
52
52
|
Here's how to check the availability of a domain name:
|
53
53
|
|
54
|
-
|
55
|
-
|
54
|
+
```ruby
|
55
|
+
lookup.api_lookup(:attributes => { :domain => 'example.com' })
|
56
|
+
p lookup.successful?
|
56
57
|
|
57
|
-
|
58
|
+
true
|
59
|
+
```
|
58
60
|
|
59
61
|
After calling the service method, you can use the following methods to access
|
60
62
|
the response:
|
61
63
|
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
64
|
+
```
|
65
|
+
response - the http response
|
66
|
+
message - the "response_text"
|
67
|
+
attributes - the "attributes" hash with relevant data
|
68
|
+
successful? - wheater the request was successful or not
|
69
|
+
```
|
66
70
|
|
67
71
|
Currently, there is support for the following services:
|
68
72
|
|
@@ -105,9 +109,11 @@ If you need to debug requests and responses, you can set a logger object, and
|
|
105
109
|
MooMoo will `debug` the request/response XMLs. Make sure the log level is set to
|
106
110
|
`debug`.
|
107
111
|
|
108
|
-
|
109
|
-
|
110
|
-
|
112
|
+
```ruby
|
113
|
+
MooMoo.configure do |config|
|
114
|
+
config.logger = my_logger
|
115
|
+
end
|
116
|
+
```
|
111
117
|
|
112
118
|
Note on Patches/Pull Requests
|
113
119
|
-----------------------------
|
@@ -124,4 +130,4 @@ Note on Patches/Pull Requests
|
|
124
130
|
Copyright
|
125
131
|
---------
|
126
132
|
|
127
|
-
Copyright (c)
|
133
|
+
Copyright (c) 2014 Site5.com. See LICENSE for details.
|
data/Rakefile
CHANGED
@@ -7,15 +7,6 @@ rescue LoadError
|
|
7
7
|
exit
|
8
8
|
end
|
9
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
10
|
begin
|
20
11
|
require 'rdoc/task'
|
21
12
|
Rake::RDocTask.new do |rdoc|
|
@@ -34,7 +25,7 @@ end
|
|
34
25
|
|
35
26
|
desc "Sanitize sensitive info from cassettes"
|
36
27
|
task :sanitize_cassettes do
|
37
|
-
if ENV['OPENSRS_TEST_KEY'] && ENV['OPENSRS_TEST_URL'] && ENV['OPENSRS_TEST_USER']
|
28
|
+
if ENV['OPENSRS_TEST_KEY'] && ENV['OPENSRS_TEST_URL'] && ENV['OPENSRS_TEST_USER']
|
38
29
|
path = File.join(File.dirname(__FILE__), 'spec', 'vcr_cassettes')
|
39
30
|
files = Dir.glob("#{path}/**/*.yml")
|
40
31
|
if files.any?
|
@@ -44,7 +35,6 @@ task :sanitize_cassettes do
|
|
44
35
|
old.gsub!(ENV['OPENSRS_TEST_KEY'], '123key')
|
45
36
|
old.gsub!(ENV['OPENSRS_TEST_URL'], 'server.com')
|
46
37
|
old.gsub!(ENV['OPENSRS_TEST_USER'], 'opensrs_user')
|
47
|
-
old.gsub!(ENV['OPENSRS_TEST_PASS'], 'password')
|
48
38
|
old.gsub!(/x-signature.*?\n.*?\w{32}/, "x-signature:\n - 00000000000000000000000000000000")
|
49
39
|
old.gsub!(/\w{16}:\w{6}:\w{2,8}/, '0000000000000000:000000:00000')
|
50
40
|
File.open(file, 'w') do |f|
|
@@ -55,22 +45,11 @@ task :sanitize_cassettes do
|
|
55
45
|
puts "Nothing to sanitize"
|
56
46
|
end
|
57
47
|
else
|
58
|
-
puts "I can't sanitize without setting up OPENSRS_TEST_KEY, OPENSRS_TEST_URL, OPENSRS_TEST_USER
|
48
|
+
puts "I can't sanitize without setting up OPENSRS_TEST_KEY, OPENSRS_TEST_URL, OPENSRS_TEST_USER"
|
59
49
|
end
|
60
50
|
end
|
61
51
|
|
62
52
|
RSpec::Core::RakeTask.new :spec
|
63
53
|
Bundler::GemHelper.install_tasks
|
64
54
|
|
65
|
-
desc "Run all specs with rcov"
|
66
|
-
RSpec::Core::RakeTask.new(:rcov) do |t|
|
67
|
-
t.rcov = true
|
68
|
-
t.rcov_opts = %w{--exclude osx\/objc,gems\/,spec\/,features\/ --comments}
|
69
|
-
end
|
70
|
-
|
71
55
|
task :default => [:spec]
|
72
|
-
|
73
|
-
desc "Open an irb session preloaded with this library"
|
74
|
-
task :console do
|
75
|
-
sh "irb -rubygems -r ./lib/moo_moo.rb"
|
76
|
-
end
|
data/lib/moo_moo/base_command.rb
CHANGED
@@ -13,7 +13,7 @@ module MooMoo
|
|
13
13
|
# ... custom response processing ...
|
14
14
|
# end
|
15
15
|
class BaseCommand
|
16
|
-
attr_reader :host, :key, :username, :
|
16
|
+
attr_reader :host, :key, :username, :port, :response
|
17
17
|
|
18
18
|
# Register an api service for the current class.
|
19
19
|
#
|
@@ -37,7 +37,6 @@ module MooMoo
|
|
37
37
|
# * <tt>:host</tt> - host of the OpenSRS server
|
38
38
|
# * <tt>:key</tt> - private key
|
39
39
|
# * <tt>:username</tt> - username of the reseller
|
40
|
-
# * <tt>:password</tt> - password of the rseller
|
41
40
|
#
|
42
41
|
# === Optional
|
43
42
|
# * <tt>:port</tt> - port to connect on
|
@@ -45,7 +44,6 @@ module MooMoo
|
|
45
44
|
@host = params[:host] || MooMoo.config.host || raise(OpenSRSException, "Host is required")
|
46
45
|
@key = params[:key] || MooMoo.config.key || raise(OpenSRSException, "Key is required")
|
47
46
|
@username = params[:username] || MooMoo.config.username || raise(OpenSRSException, "Username is required")
|
48
|
-
@password = params[:password] || MooMoo.config.password || raise(OpenSRSException, "Password is required")
|
49
47
|
@port = params[:port] || MooMoo.config.port || 55443
|
50
48
|
end
|
51
49
|
|
data/lib/moo_moo/config.rb
CHANGED
@@ -5,7 +5,6 @@ module MooMoo
|
|
5
5
|
attr_accessor :host
|
6
6
|
attr_accessor :key
|
7
7
|
attr_accessor :username
|
8
|
-
attr_accessor :password
|
9
8
|
attr_accessor :port
|
10
9
|
attr_accessor :logger
|
11
10
|
|
@@ -13,7 +12,6 @@ module MooMoo
|
|
13
12
|
@host = default_option("host") || 'horizon.opensrs.net'
|
14
13
|
@key = default_option("key")
|
15
14
|
@username = default_option("username")
|
16
|
-
@password = default_option("password")
|
17
15
|
@port = default_option("port")
|
18
16
|
end
|
19
17
|
|
data/lib/moo_moo/version.rb
CHANGED
@@ -7,7 +7,7 @@ end
|
|
7
7
|
describe MooMoo::BaseCommand do
|
8
8
|
|
9
9
|
subject { SampleService.new(:host => "thehost.com", :key => "thekey",
|
10
|
-
:username => "theuser", :
|
10
|
+
:username => "theuser", :port => "12345") }
|
11
11
|
|
12
12
|
let(:response) { double("Response", :body => {"attributes" => { :the => :attrs }})}
|
13
13
|
|
@@ -76,4 +76,4 @@ describe MooMoo::BaseCommand do
|
|
76
76
|
subject.message.should == "Command Successful"
|
77
77
|
end
|
78
78
|
end
|
79
|
-
end
|
79
|
+
end
|
data/spec/moo_moo/config_spec.rb
CHANGED
@@ -8,7 +8,6 @@ describe MooMoo::Config do
|
|
8
8
|
it { @config.should have_attr_accessor :host }
|
9
9
|
it { @config.should have_attr_accessor :key }
|
10
10
|
it { @config.should have_attr_accessor :username }
|
11
|
-
it { @config.should have_attr_accessor :password }
|
12
11
|
it { @config.should have_attr_accessor :port }
|
13
12
|
|
14
13
|
describe "default configuration" do
|
@@ -19,7 +18,6 @@ describe MooMoo::Config do
|
|
19
18
|
host: thehost
|
20
19
|
key: thekey
|
21
20
|
username: theuser
|
22
|
-
password: thepass
|
23
21
|
port: theport
|
24
22
|
"
|
25
23
|
)
|
@@ -39,10 +37,6 @@ describe MooMoo::Config do
|
|
39
37
|
@config.username.should == "theuser"
|
40
38
|
end
|
41
39
|
|
42
|
-
it "should set default pass from default options file" do
|
43
|
-
@config.password.should == "thepass"
|
44
|
-
end
|
45
|
-
|
46
40
|
it "should set default port from default options file" do
|
47
41
|
@config.port.should == "theport"
|
48
42
|
end
|
data/spec/moo_moo_spec.rb
CHANGED
@@ -15,7 +15,6 @@ describe MooMoo do
|
|
15
15
|
config.host = 'host.com'
|
16
16
|
config.key = 'secret'
|
17
17
|
config.username = 'username'
|
18
|
-
config.password = 'secret2'
|
19
18
|
end
|
20
19
|
|
21
20
|
opensrs = MooMoo::BaseCommand.new
|
@@ -23,7 +22,6 @@ describe MooMoo do
|
|
23
22
|
opensrs.host.should == 'host.com'
|
24
23
|
opensrs.key.should == 'secret'
|
25
24
|
opensrs.username.should == 'username'
|
26
|
-
opensrs.password.should == 'secret2'
|
27
25
|
end
|
28
26
|
end
|
29
27
|
|
data/spec/spec_helper.rb
CHANGED
@@ -58,12 +58,10 @@ RSpec.configure do |c|
|
|
58
58
|
config.host = ENV['OPENSRS_TEST_URL'] if ENV['OPENSRS_TEST_URL']
|
59
59
|
config.key = ENV['OPENSRS_TEST_KEY'] || raise(ArgumentError, "OPENSRS_TEST_KEY is required")
|
60
60
|
config.username = ENV['OPENSRS_TEST_USER'] || raise(ArgumentError, "OPENSRS_TEST_USER is required")
|
61
|
-
config.password = ENV['OPENSRS_TEST_PASS'] || raise(ArgumentError, "OPENSRS_TEST_PASS is required")
|
62
61
|
else
|
63
62
|
config.host = "testhost.com"
|
64
63
|
config.key = "testkey"
|
65
64
|
config.username = "testuser"
|
66
|
-
config.password = "testpass"
|
67
65
|
end
|
68
66
|
end
|
69
67
|
end
|
@@ -98,4 +96,4 @@ RSpec::Matchers.define(:have_registered_service) do |*args|
|
|
98
96
|
description do
|
99
97
|
"have registered service :#{method_name} delegating to action :#{action_name} and object :#{object_name}"
|
100
98
|
end
|
101
|
-
end
|
99
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: moo_moo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.10.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tim Parkin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-05-
|
11
|
+
date: 2014-05-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: extlib
|