moo_moo 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (31) hide show
  1. data/README.md +5 -7
  2. data/lib/moo_moo/base.rb +12 -30
  3. data/lib/moo_moo/command.rb +2 -6
  4. data/lib/moo_moo/config.rb +7 -7
  5. data/lib/moo_moo/middleware/open_srs_errors.rb +0 -2
  6. data/lib/moo_moo/middleware/open_srs_xml_builder.rb +9 -17
  7. data/lib/moo_moo/middleware/parse_open_srs.rb +3 -3
  8. data/lib/moo_moo/response.rb +15 -20
  9. data/lib/moo_moo/{cookie.rb → services/cookie.rb} +0 -0
  10. data/lib/moo_moo/{dns_zone.rb → services/dns_zone.rb} +0 -0
  11. data/lib/moo_moo/{lookup.rb → services/lookup.rb} +0 -0
  12. data/lib/moo_moo/{nameserver.rb → services/nameserver.rb} +0 -0
  13. data/lib/moo_moo/{provisioning.rb → services/provisioning.rb} +0 -0
  14. data/lib/moo_moo/{transfer.rb → services/transfer.rb} +0 -0
  15. data/lib/moo_moo/version.rb +1 -1
  16. data/lib/moo_moo.rb +15 -15
  17. data/spec/integration_spec.rb +1 -2
  18. data/spec/moo_moo/base_spec.rb +9 -18
  19. data/spec/moo_moo/command_spec.rb +1 -2
  20. data/spec/moo_moo/config_spec.rb +6 -6
  21. data/spec/moo_moo/middleware/open_srs_xml_builder_spec.rb +14 -6
  22. data/spec/moo_moo/response_spec.rb +43 -0
  23. data/spec/moo_moo/{cookie_spec.rb → services/cookie_spec.rb} +0 -0
  24. data/spec/moo_moo/{dns_zone_spec.rb → services/dns_zone_spec.rb} +0 -0
  25. data/spec/moo_moo/{lookup_spec.rb → services/lookup_spec.rb} +0 -0
  26. data/spec/moo_moo/{nameserver_spec.rb → services/nameserver_spec.rb} +0 -0
  27. data/spec/moo_moo/{provisioning_spec.rb → services/provisioning_spec.rb} +0 -0
  28. data/spec/moo_moo/{transfer_spec.rb → services/transfer_spec.rb} +0 -0
  29. data/spec/moo_moo_spec.rb +8 -8
  30. data/spec/spec_helper.rb +9 -9
  31. metadata +24 -22
data/README.md CHANGED
@@ -35,10 +35,10 @@ First, create an opensrs object for the namespace you want to use:
35
35
  Or configure MooMoo and you can initialize it without any arguments:
36
36
 
37
37
  MooMoo.configure do |config|
38
- config.host = "horizon.opensrs.net"
39
- config.key = "<YOUR_KEY>"
40
- config.user = "<YOUR_RESELLER_USER>"
41
- config.pass = "<YOUR_PASSWORD>"
38
+ config.host = "horizon.opensrs.net"
39
+ config.key = "<YOUR_KEY>"
40
+ config.username = "<YOUR_RESELLER_USER>"
41
+ config.password = "<YOUR_PASSWORD>"
42
42
  end
43
43
 
44
44
  ...
@@ -51,12 +51,10 @@ 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
- res = lookup.lookup_domain('example.com')
54
+ res = lookup.lookup_domain(:attributes => { :domain => 'example.com' })
55
55
  p res.success?
56
- p res.result['status']
57
56
 
58
57
  true
59
- taken
60
58
 
61
59
  Each method returns an `OpenSRSResponse` object which you can use to determine
62
60
  if the call was successful and retrieve the response code and/or error
data/lib/moo_moo/base.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  module MooMoo
2
2
  class Base
3
- attr_reader :host, :key, :user, :pass, :port
3
+ attr_reader :host, :key, :username, :password, :port
4
4
 
5
5
  # Register an api service for the current class.
6
6
  #
@@ -21,10 +21,8 @@ module MooMoo
21
21
  define_method(method_name) do |*args|
22
22
  params = args.first || {}
23
23
 
24
- params[:key] = 'attributes'
25
- cookie = params.delete :cookie
26
24
  instance_exec(params, &block) if block
27
- run_command action_name, object, params, cookie
25
+ run_command action_name, object, params
28
26
  end
29
27
  end
30
28
 
@@ -33,17 +31,17 @@ module MooMoo
33
31
  # === Required
34
32
  # * <tt>:host</tt> - host of the OpenSRS server
35
33
  # * <tt>:key</tt> - private key
36
- # * <tt>:user</tt> - username of the reseller
37
- # * <tt>:pass</tt> - password of the rseller
34
+ # * <tt>:username</tt> - username of the reseller
35
+ # * <tt>:password</tt> - password of the rseller
38
36
  #
39
37
  # === Optional
40
38
  # * <tt>:port</tt> - port to connect on
41
- def initialize(host = nil, key = nil, user = nil, pass = nil, port = 55443)
42
- @host = host || MooMoo.config.host || raise(ArgumentError, "Host is required")
43
- @key = key || MooMoo.config.key || raise(ArgumentError, "Key is required")
44
- @user = user || MooMoo.config.user || raise(ArgumentError, "User is required")
45
- @pass = pass || MooMoo.config.pass || raise(ArgumentError, "Password is required")
46
- @port = port || MooMoo.config.port || raise(ArgumentError, "Port is required")
39
+ def initialize(params = {})
40
+ @host = params[:host] || MooMoo.config.host || raise(OpenSRSException, "Host is required")
41
+ @key = params[:key] || MooMoo.config.key || raise(OpenSRSException, "Key is required")
42
+ @username = params[:username] || MooMoo.config.username || raise(OpenSRSException, "Username is required")
43
+ @password = params[:password] || MooMoo.config.password || raise(OpenSRSException, "Password is required")
44
+ @port = params[:port] || MooMoo.config.port || 55443
47
45
  end
48
46
 
49
47
  # Runs a command
@@ -54,14 +52,8 @@ module MooMoo
54
52
  #
55
53
  # === Optional
56
54
  # * <tt>:params</tt> - parameters for the command
57
- # * <tt>:cookie</tt> - cookie, if the command requires it
58
- def run_command(action, object, params = {}, cookie = nil)
59
- cmd = Command.new(action, object, params, cookie)
60
-
61
- try_opensrs do
62
- result = cmd.run(@host, @key, @user, @port)
63
- Response.new(result, params[:key])
64
- end
55
+ def run_command(action, object, params = {})
56
+ Response.new Command.new(action, object, params).run(@host, @key, @username, @port)
65
57
  end
66
58
 
67
59
  private
@@ -79,15 +71,5 @@ module MooMoo
79
71
 
80
72
  arr_indexed
81
73
  end
82
-
83
- def try_opensrs
84
- begin
85
- yield
86
- rescue Exception => e
87
- exception = OpenSRSException.new(e.message)
88
- exception.set_backtrace(e.backtrace)
89
- raise exception
90
- end
91
- end
92
74
  end
93
75
  end
@@ -6,14 +6,10 @@ module MooMoo
6
6
  # * <tt>:action</tt> - action of the command
7
7
  # * <tt>:object</tt> - object the command operates on
8
8
  # * <tt>:params</tt> - additional parameters for the command
9
- #
10
- # ==== Optional
11
- # * <tt>:cookie</tt> - a cookie for the domain if the command requires it
12
- def initialize(action, object, params = {}, cookie = nil)
9
+ def initialize(action, object, params = {})
13
10
  @action = action
14
11
  @object = object
15
12
  @params = params
16
- @cookie = cookie
17
13
  end
18
14
 
19
15
  # Runs the command against OpenSRS server
@@ -25,7 +21,7 @@ module MooMoo
25
21
  # * <tt>:port</tt> - port to connect to
26
22
  def run(host, key, user, port)
27
23
  @returned_parameters = Faraday.new(:url => "https://#{host}:#{port}", :ssl => {:verify => true}) do |c|
28
- c.request :open_srs_xml_builder, @action, @object, @cookie, @params, key, user
24
+ c.request :open_srs_xml_builder, @action, @object, @params, key, user
29
25
  c.response :parse_open_srs
30
26
  c.response :open_srs_errors
31
27
  c.adapter :net_http
@@ -4,16 +4,16 @@ module MooMoo
4
4
  class Config
5
5
  attr_accessor :host
6
6
  attr_accessor :key
7
- attr_accessor :user
8
- attr_accessor :pass
7
+ attr_accessor :username
8
+ attr_accessor :password
9
9
  attr_accessor :port
10
10
 
11
11
  def initialize
12
- @host = default_option("host") || 'horizon.opensrs.net'
13
- @key = default_option("key")
14
- @user = default_option("user")
15
- @pass = default_option("pass")
16
- @port = default_option("port")
12
+ @host = default_option("host") || 'horizon.opensrs.net'
13
+ @key = default_option("key")
14
+ @username = default_option("username")
15
+ @password = default_option("password")
16
+ @port = default_option("port")
17
17
  end
18
18
 
19
19
  private
@@ -1,12 +1,10 @@
1
1
  module MooMoo
2
2
  class OpenSRSErrors < Faraday::Response::Middleware
3
-
4
3
  def on_complete(env)
5
4
  # Checks for invalid http status
6
5
  unless (200..299).include?(env[:status])
7
6
  raise OpenSRSException, "Bad HTTP Status: #{env[:status]}"
8
7
  end
9
8
  end
10
-
11
9
  end
12
10
  end
@@ -2,14 +2,13 @@ module MooMoo
2
2
  class OpenSRSXMLBuilder < Faraday::Middleware
3
3
  dependency 'rexml/document'
4
4
  dependency 'digest/md5'
5
-
5
+
6
6
  def initialize(app, *args)
7
7
  @action = args[0]
8
8
  @object = args[1]
9
- @cookie = args[2]
10
- @params = args[3]
11
- @key = args[4]
12
- @user = args[5]
9
+ @params = args[2] || {}
10
+ @key = args[3]
11
+ @user = args[4]
13
12
  super(app)
14
13
  end
15
14
 
@@ -24,7 +23,7 @@ module MooMoo
24
23
  @app.call(env)
25
24
  end
26
25
 
27
- private
26
+ private
28
27
 
29
28
  # Builds an XML string of the command which can be sent to OpenSRS
30
29
  def build_command
@@ -52,19 +51,14 @@ module MooMoo
52
51
  doc.root.elements["body/data_block/dt_assoc/item[@key='action']"].text = @action
53
52
  doc.root.elements["body/data_block/dt_assoc/item[@key='object']"].text = @object
54
53
 
55
- unless @cookie.nil?
56
- cookie_elem = doc.root.elements["body/data_block/dt_assoc"].add_element('item', {'key' => 'cookie'})
57
- cookie_elem.text = @cookie
58
- end
59
-
60
- unless @params.nil?
61
- elem = doc.root.elements["body/data_block/dt_assoc"].add_element('item', {'key' => 'attributes'})
62
- build_child(elem, @params)
54
+ @params.each do |key, value|
55
+ elem = doc.root.elements["body/data_block/dt_assoc"].add_element('item', {'key' => key})
56
+ build_child(elem, value)
63
57
  end
64
58
 
65
59
  doc
66
60
  end
67
-
61
+
68
62
  # Adds XML child elements to the specified XML element for a given collection
69
63
  #
70
64
  # ==== Required
@@ -87,7 +81,6 @@ module MooMoo
87
81
  elem.text = coll
88
82
  end
89
83
  end
90
-
91
84
 
92
85
  def signature(content)
93
86
  Digest::MD5.hexdigest(
@@ -96,6 +89,5 @@ module MooMoo
96
89
  ) + @key
97
90
  )
98
91
  end
99
-
100
92
  end
101
93
  end
@@ -4,13 +4,13 @@ module MooMoo
4
4
  def on_complete(env)
5
5
  env[:body] = parse_response(env[:body])
6
6
  end
7
-
7
+
8
8
  def response_values(env)
9
9
  {:status => env[:status], :headers => env[:response_headers], :body => env[:body]}
10
10
  end
11
-
11
+
12
12
  private
13
-
13
+
14
14
  # Parses an XML response from the OpenSRS registry and generates a
15
15
  # hash containing all of the data. Elements with child elements
16
16
  # are converted into hashes themselves, with the :element_text entry
@@ -1,39 +1,34 @@
1
1
  module MooMoo
2
+ # Based on opensrs_xmlapi.pdf page 25.
2
3
  class Response
4
+ attr_reader :hash
5
+
3
6
  # Constructor
4
7
  #
5
8
  # ==== Required
6
- # * <tt>:hash</tt> - hash of the response
7
- #
8
- # ==== Optional
9
- # * <tt>:key</tt> - primary key to use when indexing the hash
10
- def initialize(hash, key = nil)
9
+ # * <tt>:hash</tt> - response hash
10
+ def initialize(hash)
11
11
  @hash = hash
12
- @key = key
13
12
  end
14
13
 
15
14
  # Returns whether or not the command executed was successful
16
- #
17
15
  def success?
18
- @hash['is_success'].nil? ? true : @hash['is_success'].to_i == 1
19
- end
20
-
21
- # Returns the error message if one is present
22
- #
23
- def error_msg
24
- @hash['response_text']
16
+ @hash['is_success'].to_i == 1
25
17
  end
26
18
 
27
19
  # Returns the response code if one is present
28
- #
29
- def error_code
20
+ def code
30
21
  @hash['response_code'].to_i
31
22
  end
32
23
 
33
- # Returns the result hash
34
- #
35
- def result
36
- @key.nil? ? @hash : @hash[@key]
24
+ # Returns the response message if one is present
25
+ def text
26
+ @hash['response_text']
27
+ end
28
+
29
+ # Returns the response attributes.
30
+ def attributes
31
+ @hash['attributes']
37
32
  end
38
33
  end
39
34
  end
File without changes
File without changes
File without changes
File without changes
@@ -1,3 +1,3 @@
1
1
  module MooMoo
2
- VERSION = Version = "0.2.0"
2
+ VERSION = Version = "0.3.0"
3
3
  end
data/lib/moo_moo.rb CHANGED
@@ -1,22 +1,15 @@
1
1
  require 'moo_moo/exceptions'
2
2
  require 'faraday'
3
+ require 'moo_moo/version'
4
+ require 'moo_moo/config'
5
+ require 'moo_moo/command'
6
+ require 'moo_moo/response'
7
+ require 'moo_moo/base'
8
+ require 'moo_moo/middleware/open_srs_errors'
9
+ require 'moo_moo/middleware/parse_open_srs'
10
+ require 'moo_moo/middleware/open_srs_xml_builder'
3
11
 
4
12
  module MooMoo
5
- autoload :Version, 'moo_moo/version'
6
- autoload :Config, 'moo_moo/config'
7
- autoload :Command, 'moo_moo/command'
8
- autoload :Response, 'moo_moo/response'
9
- autoload :Base, 'moo_moo/base'
10
- autoload :Lookup, 'moo_moo/lookup'
11
- autoload :Nameserver, 'moo_moo/nameserver'
12
- autoload :Provisioning, 'moo_moo/provisioning'
13
- autoload :Transfer, 'moo_moo/transfer'
14
- autoload :DnsZone, 'moo_moo/dns_zone'
15
- autoload :Cookie, 'moo_moo/cookie'
16
- autoload :OpenSRSErrors, 'moo_moo/middleware/open_srs_errors'
17
- autoload :ParseOpenSRS, 'moo_moo/middleware/parse_open_srs'
18
- autoload :OpenSRSXMLBuilder, 'moo_moo/middleware/open_srs_xml_builder'
19
-
20
13
  class << self
21
14
  attr_accessor :config
22
15
  end
@@ -29,5 +22,12 @@ module MooMoo
29
22
  self.config = Config.new
30
23
  end
31
24
 
25
+ require 'moo_moo/services/lookup'
26
+ require 'moo_moo/services/nameserver'
27
+ require 'moo_moo/services/provisioning'
28
+ require 'moo_moo/services/transfer'
29
+ require 'moo_moo/services/dns_zone'
30
+ require 'moo_moo/services/cookie'
31
+
32
32
  Faraday.register_middleware :request, :open_srs_xml_builder => MooMoo::OpenSRSXMLBuilder
33
33
  Faraday.register_middleware :response, :open_srs_errors => MooMoo::OpenSRSErrors, :parse_open_srs => MooMoo::ParseOpenSRS
@@ -7,8 +7,7 @@ describe "Real World integration" do
7
7
 
8
8
  VCR.use_cassette("integration/lookup") do
9
9
  response = lookup.lookup_domain(:domain => "opensrs.net")
10
- pp response
11
- response.result["status"].should == "taken"
10
+ response.attributes["status"].should == "taken"
12
11
  end
13
12
  end
14
13
 
@@ -11,7 +11,8 @@ end
11
11
  describe MooMoo::Base do
12
12
 
13
13
  before :each do
14
- @service = SampleService.new("thehost", "thekey", "theuser", "thepass", "theport")
14
+ @service = SampleService.new(:host => "thehost", :key => "thekey",
15
+ :username => "theuser", :password => "thepass", :port => "theport")
15
16
  end
16
17
 
17
18
  describe "class methods" do
@@ -21,7 +22,7 @@ describe MooMoo::Base do
21
22
  params = {:the => :params, :cookie => "thecookie"}
22
23
 
23
24
  @service.should_receive(:run_command).
24
- with(:service1, :object1, params, "thecookie").
25
+ with(:service1, :object1, params).
25
26
  and_return("theresult")
26
27
 
27
28
  @service.service1(params).should == "theresult"
@@ -31,7 +32,7 @@ describe MooMoo::Base do
31
32
  params = {:the => :params, :cookie => "thecookie"}
32
33
 
33
34
  @service.should_receive(:run_command).
34
- with(:action2, :object2, params, "thecookie").
35
+ with(:action2, :object2, params).
35
36
  and_return("theresult")
36
37
 
37
38
  @service.service2(params).should == "theresult"
@@ -39,10 +40,10 @@ describe MooMoo::Base do
39
40
 
40
41
  it "service3" do
41
42
  params = {:the => :params, :cookie => "thecookie"}
42
- expected_params = {:the => :params, :key => "attributes", :example => "theexample"}
43
+ expected_params = {:the => :params, :cookie => "thecookie", :example => "theexample"}
43
44
 
44
45
  @service.should_receive(:run_command).
45
- with(:service3, :object3, expected_params, "thecookie").
46
+ with(:service3, :object3, expected_params).
46
47
  and_return("theresult")
47
48
 
48
49
  @service.service3(params).should == "theresult"
@@ -57,21 +58,11 @@ describe MooMoo::Base do
57
58
  command = stub()
58
59
  command.should_receive(:run).with("thehost", "thekey", "theuser", "theport").and_return(result)
59
60
  MooMoo::Command.should_receive(:new).
60
- with("theaction", "theobject", {}, "thecookie").
61
+ with("theaction", "theobject", {"the" => "params"}).
61
62
  and_return(command)
62
63
 
63
- response = @service.run_command("theaction", "theobject", {}, "thecookie")
64
- response.result.should == result
65
- end
66
- end
67
-
68
- describe "#try_opensrs" do
69
- it "raises an OpenSRSException" do
70
- expect do
71
- MooMoo::Base.new.instance_eval do
72
- try_opensrs { raise "Exception message" }
73
- end
74
- end.to raise_error MooMoo::OpenSRSException
64
+ response = @service.run_command("theaction", "theobject", {"the" => "params"})
65
+ response.hash.should == result
75
66
  end
76
67
  end
77
68
  end
@@ -10,9 +10,8 @@ describe MooMoo::Command do
10
10
  :array => [{:param => "arrayvalue1"}, {:param => "arrayvalue2"}],
11
11
  :array_list => ["arrayvalue1", "arrayvalue2"]
12
12
  } }
13
- let(:cookie) { "thecookie" }
14
13
 
15
- let(:command) { MooMoo::Command.new(action, object, params, cookie) }
14
+ let(:command) { MooMoo::Command.new(action, object, params) }
16
15
 
17
16
  describe "#run" do
18
17
  describe "success response" do
@@ -7,8 +7,8 @@ describe MooMoo::Config do
7
7
 
8
8
  it { @config.should have_attr_accessor :host }
9
9
  it { @config.should have_attr_accessor :key }
10
- it { @config.should have_attr_accessor :user }
11
- it { @config.should have_attr_accessor :pass }
10
+ it { @config.should have_attr_accessor :username }
11
+ it { @config.should have_attr_accessor :password }
12
12
  it { @config.should have_attr_accessor :port }
13
13
 
14
14
  describe "default configuration" do
@@ -18,8 +18,8 @@ describe MooMoo::Config do
18
18
  "
19
19
  host: thehost
20
20
  key: thekey
21
- user: theuser
22
- pass: thepass
21
+ username: theuser
22
+ password: thepass
23
23
  port: theport
24
24
  "
25
25
  )
@@ -36,11 +36,11 @@ describe MooMoo::Config do
36
36
  end
37
37
 
38
38
  it "should set default user from default options file" do
39
- @config.user.should == "theuser"
39
+ @config.username.should == "theuser"
40
40
  end
41
41
 
42
42
  it "should set default pass from default options file" do
43
- @config.pass.should == "thepass"
43
+ @config.password.should == "thepass"
44
44
  end
45
45
 
46
46
  it "should set default port from default options file" do
@@ -5,13 +5,17 @@ describe MooMoo::OpenSRSXMLBuilder do
5
5
  describe "#build_command" do
6
6
  before :each do
7
7
  params = {
8
- :string => "stringparam",
9
- :hash => {:the => "hashparam"},
10
- :array => [{:param => "arrayvalue1"}, {:param => "arrayvalue2"}],
11
- :array_list => ["arrayvalue1", "arrayvalue2"]
8
+ :cookie => "thecookie",
9
+ :domain => "mydomain.com",
10
+ :attributes => {
11
+ :string => "stringparam",
12
+ :hash => {:the => "hashparam"},
13
+ :array => [{:param => "arrayvalue1"}, {:param => "arrayvalue2"}],
14
+ :array_list => ["arrayvalue1", "arrayvalue2"]
15
+ }
12
16
  }
13
-
14
- middleware = described_class.new(lambda{|env| env}, "theaction", "theobject", "thecookie", params, "key")
17
+
18
+ middleware = described_class.new(lambda{|env| env}, "theaction", "theobject", params, "key")
15
19
  env = {:body => nil, :request_headers => Faraday::Utils::Headers.new}
16
20
  result = middleware.call(env)
17
21
  @body = REXML::Document.new(result[:body])
@@ -30,6 +34,10 @@ describe MooMoo::OpenSRSXMLBuilder do
30
34
  end
31
35
 
32
36
  describe "attributes" do
37
+ it "should set the domain param" do
38
+ @body.root.elements["body/data_block/dt_assoc/item[@key='domain']"].text.should == "mydomain.com"
39
+ end
40
+
33
41
  it "should set string params" do
34
42
  @body.root.elements["body/data_block/dt_assoc/item[@key='attributes']/dt_assoc/item[@key='string']"].text.should == "stringparam"
35
43
  end
@@ -0,0 +1,43 @@
1
+ require 'spec_helper'
2
+ require 'date'
3
+
4
+ describe MooMoo::Response do
5
+ subject { MooMoo::Response.new(
6
+ "is_success" => "1", "response_code" => "100",
7
+ "response_text" => "The message", "attributes" => "The attributes") }
8
+
9
+ describe "#hash" do
10
+ it "retrieves the response hash" do
11
+ subject.hash.should == { "is_success" => "1", "response_code" => "100",
12
+ "response_text" => "The message", "attributes" => "The attributes" }
13
+ end
14
+ end
15
+
16
+ describe "#success?" do
17
+ it "is true when 1" do
18
+ subject.success?.should be_true
19
+ end
20
+
21
+ it "is false when not 1" do
22
+ MooMoo::Response.new("is_success" => "0").success?.should be_false
23
+ end
24
+ end
25
+
26
+ describe "#code" do
27
+ it "retrieves response code" do
28
+ subject.code.should == 100
29
+ end
30
+ end
31
+
32
+ describe "#text" do
33
+ it "retrieves response text" do
34
+ subject.text.should == "The message"
35
+ end
36
+ end
37
+
38
+ describe "#attributes" do
39
+ it "retrieves response attributes" do
40
+ subject.attributes.should == "The attributes"
41
+ end
42
+ end
43
+ end
data/spec/moo_moo_spec.rb CHANGED
@@ -12,18 +12,18 @@ describe MooMoo do
12
12
 
13
13
  it "loads default settings from config if none are provided" do
14
14
  MooMoo.configure do |config|
15
- config.host = 'host.com'
16
- config.key = 'secret'
17
- config.user = 'username'
18
- config.pass = 'secret2'
15
+ config.host = 'host.com'
16
+ config.key = 'secret'
17
+ config.username = 'username'
18
+ config.password = 'secret2'
19
19
  end
20
20
 
21
21
  opensrs = MooMoo::Base.new
22
22
 
23
- opensrs.host.should == 'host.com'
24
- opensrs.key.should == 'secret'
25
- opensrs.user.should == 'username'
26
- opensrs.pass.should == 'secret2'
23
+ opensrs.host.should == 'host.com'
24
+ opensrs.key.should == 'secret'
25
+ opensrs.username.should == 'username'
26
+ opensrs.password.should == 'secret2'
27
27
  end
28
28
  end
29
29
 
data/spec/spec_helper.rb CHANGED
@@ -55,15 +55,15 @@ RSpec.configure do |c|
55
55
  c.before(:each) do
56
56
  MooMoo.configure do |config|
57
57
  if live_test?
58
- config.host = ENV['OPENSRS_TEST_URL'] if ENV['OPENSRS_TEST_URL']
59
- config.key = ENV['OPENSRS_TEST_KEY'] || raise(ArgumentError, "OPENSRS_TEST_KEY is required")
60
- config.user = ENV['OPENSRS_TEST_USER'] || raise(ArgumentError, "OPENSRS_TEST_USER is required")
61
- config.pass = ENV['OPENSRS_TEST_PASS'] || raise(ArgumentError, "OPENSRS_TEST_PASS is required")
58
+ config.host = ENV['OPENSRS_TEST_URL'] if ENV['OPENSRS_TEST_URL']
59
+ config.key = ENV['OPENSRS_TEST_KEY'] || raise(ArgumentError, "OPENSRS_TEST_KEY is required")
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
62
  else
63
- config.host = "testhost.com"
64
- config.key = "testkey"
65
- config.user = "testuser"
66
- config.pass = "testpass"
63
+ config.host = "testhost.com"
64
+ config.key = "testkey"
65
+ config.username = "testuser"
66
+ config.password = "testpass"
67
67
  end
68
68
  end
69
69
  end
@@ -87,7 +87,7 @@ RSpec::Matchers.define(:have_registered_service) do |*args|
87
87
  match do |object|
88
88
  parameters = {:the => :params, :cookie => "thecookie"}
89
89
  object.should_receive(:run_command).
90
- with(action_name, object_name, parameters, "thecookie").
90
+ with(action_name, object_name, parameters).
91
91
  and_return("theresult")
92
92
 
93
93
 
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.2.0
4
+ version: 0.3.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-07-16 00:00:00.000000000 Z
12
+ date: 2012-07-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: extlib
@@ -142,17 +142,17 @@ files:
142
142
  - lib/moo_moo/base.rb
143
143
  - lib/moo_moo/command.rb
144
144
  - lib/moo_moo/config.rb
145
- - lib/moo_moo/cookie.rb
146
- - lib/moo_moo/dns_zone.rb
147
145
  - lib/moo_moo/exceptions.rb
148
- - lib/moo_moo/lookup.rb
149
146
  - lib/moo_moo/middleware/open_srs_errors.rb
150
147
  - lib/moo_moo/middleware/open_srs_xml_builder.rb
151
148
  - lib/moo_moo/middleware/parse_open_srs.rb
152
- - lib/moo_moo/nameserver.rb
153
- - lib/moo_moo/provisioning.rb
154
149
  - lib/moo_moo/response.rb
155
- - lib/moo_moo/transfer.rb
150
+ - lib/moo_moo/services/cookie.rb
151
+ - lib/moo_moo/services/dns_zone.rb
152
+ - lib/moo_moo/services/lookup.rb
153
+ - lib/moo_moo/services/nameserver.rb
154
+ - lib/moo_moo/services/provisioning.rb
155
+ - lib/moo_moo/services/transfer.rb
156
156
  - lib/moo_moo/version.rb
157
157
  - moo_moo.gemspec
158
158
  - spec/fixtures/success_response.xml
@@ -160,13 +160,14 @@ files:
160
160
  - spec/moo_moo/base_spec.rb
161
161
  - spec/moo_moo/command_spec.rb
162
162
  - spec/moo_moo/config_spec.rb
163
- - spec/moo_moo/cookie_spec.rb
164
- - spec/moo_moo/dns_zone_spec.rb
165
- - spec/moo_moo/lookup_spec.rb
166
163
  - spec/moo_moo/middleware/open_srs_xml_builder_spec.rb
167
- - spec/moo_moo/nameserver_spec.rb
168
- - spec/moo_moo/provisioning_spec.rb
169
- - spec/moo_moo/transfer_spec.rb
164
+ - spec/moo_moo/response_spec.rb
165
+ - spec/moo_moo/services/cookie_spec.rb
166
+ - spec/moo_moo/services/dns_zone_spec.rb
167
+ - spec/moo_moo/services/lookup_spec.rb
168
+ - spec/moo_moo/services/nameserver_spec.rb
169
+ - spec/moo_moo/services/provisioning_spec.rb
170
+ - spec/moo_moo/services/transfer_spec.rb
170
171
  - spec/moo_moo_spec.rb
171
172
  - spec/spec_helper.rb
172
173
  - spec/vcr_cassettes/integration/lookup.yml
@@ -184,7 +185,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
184
185
  version: '0'
185
186
  segments:
186
187
  - 0
187
- hash: -1802461938535338655
188
+ hash: -294129659865012821
188
189
  required_rubygems_version: !ruby/object:Gem::Requirement
189
190
  none: false
190
191
  requirements:
@@ -193,7 +194,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
193
194
  version: '0'
194
195
  segments:
195
196
  - 0
196
- hash: -1802461938535338655
197
+ hash: -294129659865012821
197
198
  requirements: []
198
199
  rubyforge_project: opensrs
199
200
  rubygems_version: 1.8.23
@@ -206,13 +207,14 @@ test_files:
206
207
  - spec/moo_moo/base_spec.rb
207
208
  - spec/moo_moo/command_spec.rb
208
209
  - spec/moo_moo/config_spec.rb
209
- - spec/moo_moo/cookie_spec.rb
210
- - spec/moo_moo/dns_zone_spec.rb
211
- - spec/moo_moo/lookup_spec.rb
212
210
  - spec/moo_moo/middleware/open_srs_xml_builder_spec.rb
213
- - spec/moo_moo/nameserver_spec.rb
214
- - spec/moo_moo/provisioning_spec.rb
215
- - spec/moo_moo/transfer_spec.rb
211
+ - spec/moo_moo/response_spec.rb
212
+ - spec/moo_moo/services/cookie_spec.rb
213
+ - spec/moo_moo/services/dns_zone_spec.rb
214
+ - spec/moo_moo/services/lookup_spec.rb
215
+ - spec/moo_moo/services/nameserver_spec.rb
216
+ - spec/moo_moo/services/provisioning_spec.rb
217
+ - spec/moo_moo/services/transfer_spec.rb
216
218
  - spec/moo_moo_spec.rb
217
219
  - spec/spec_helper.rb
218
220
  - spec/vcr_cassettes/integration/lookup.yml