moo_moo 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (107) hide show
  1. data/.travis.yml +9 -3
  2. data/LICENSE +1 -1
  3. data/README.md +16 -5
  4. data/Rakefile +21 -0
  5. data/lib/moo_moo/base.rb +93 -0
  6. data/lib/moo_moo/command.rb +36 -0
  7. data/lib/moo_moo/config.rb +26 -1
  8. data/lib/moo_moo/cookie.rb +28 -0
  9. data/lib/moo_moo/dns_zone.rb +45 -0
  10. data/lib/moo_moo/exceptions.rb +1 -1
  11. data/lib/moo_moo/lookup.rb +97 -0
  12. data/lib/moo_moo/middleware/open_srs_errors.rb +12 -0
  13. data/lib/moo_moo/middleware/open_srs_xml_builder.rb +101 -0
  14. data/lib/moo_moo/middleware/parse_open_srs.rb +58 -0
  15. data/lib/moo_moo/nameserver.rb +29 -0
  16. data/lib/moo_moo/provisioning.rb +62 -0
  17. data/lib/moo_moo/response.rb +39 -0
  18. data/lib/moo_moo/transfer.rb +60 -0
  19. data/lib/moo_moo/version.rb +1 -1
  20. data/lib/moo_moo.rb +18 -3
  21. data/moo_moo.gemspec +7 -5
  22. data/spec/fixtures/success_response.xml +14 -0
  23. data/spec/integration_spec.rb +15 -0
  24. data/spec/moo_moo/base_spec.rb +77 -0
  25. data/spec/moo_moo/command_spec.rb +42 -0
  26. data/spec/moo_moo/config_spec.rb +38 -0
  27. data/spec/moo_moo/cookie_spec.rb +8 -0
  28. data/spec/moo_moo/dns_zone_spec.rb +11 -0
  29. data/spec/moo_moo/lookup_spec.rb +18 -0
  30. data/spec/moo_moo/middleware/open_srs_xml_builder_spec.rb +53 -0
  31. data/spec/moo_moo/nameserver_spec.rb +8 -0
  32. data/spec/moo_moo/provisioning_spec.rb +14 -0
  33. data/spec/moo_moo/transfer_spec.rb +12 -0
  34. data/spec/moo_moo_spec.rb +1 -1
  35. data/spec/spec_helper.rb +35 -23
  36. data/spec/vcr_cassettes/integration/lookup.yml +44 -0
  37. metadata +117 -153
  38. data/lib/cacert.pem +0 -3910
  39. data/lib/moo_moo/opensrs/args.rb +0 -109
  40. data/lib/moo_moo/opensrs/base.rb +0 -73
  41. data/lib/moo_moo/opensrs/command.rb +0 -190
  42. data/lib/moo_moo/opensrs/cookie_commands.rb +0 -52
  43. data/lib/moo_moo/opensrs/lookup_commands.rb +0 -195
  44. data/lib/moo_moo/opensrs/nameserver_commands.rb +0 -70
  45. data/lib/moo_moo/opensrs/provisioning_commands.rb +0 -167
  46. data/lib/moo_moo/opensrs/response.rb +0 -41
  47. data/lib/moo_moo/opensrs/transfer_commands.rb +0 -83
  48. data/lib/moo_moo/opensrs.rb +0 -13
  49. data/spec/moo_moo/opensrs/args_spec.rb +0 -176
  50. data/spec/moo_moo/opensrs/base_spec.rb +0 -22
  51. data/spec/moo_moo/opensrs/cookie_spec.rb +0 -76
  52. data/spec/moo_moo/opensrs/lookup_spec.rb +0 -208
  53. data/spec/moo_moo/opensrs/nameserver_spec.rb +0 -136
  54. data/spec/moo_moo/opensrs/provisioning_spec.rb +0 -198
  55. data/spec/moo_moo/opensrs/transfer_spec.rb +0 -124
  56. data/spec/vcr_cassettes/cookie/delete_cookie.yml +0 -219
  57. data/spec/vcr_cassettes/cookie/quit_session.yml +0 -97
  58. data/spec/vcr_cassettes/cookie/set_cookie.yml +0 -123
  59. data/spec/vcr_cassettes/cookie/set_cookie_fail.yml +0 -54
  60. data/spec/vcr_cassettes/cookie/update_cookie.yml +0 -239
  61. data/spec/vcr_cassettes/lookup/belongs_to_rsp.yml +0 -54
  62. data/spec/vcr_cassettes/lookup/belongs_to_rsp_negative.yml +0 -55
  63. data/spec/vcr_cassettes/lookup/get_balance.yml +0 -55
  64. data/spec/vcr_cassettes/lookup/get_deleted_domains.yml +0 -80
  65. data/spec/vcr_cassettes/lookup/get_domain.yml +0 -211
  66. data/spec/vcr_cassettes/lookup/get_domain_fail.yml +0 -269
  67. data/spec/vcr_cassettes/lookup/get_domains_by_expiredate.yml +0 -76
  68. data/spec/vcr_cassettes/lookup/get_domains_contacts.yml +0 -129
  69. data/spec/vcr_cassettes/lookup/get_domains_contacts_fail.yml +0 -58
  70. data/spec/vcr_cassettes/lookup/get_notes_for_domain.yml +0 -85
  71. data/spec/vcr_cassettes/lookup/get_notes_for_order.yml +0 -61
  72. data/spec/vcr_cassettes/lookup/get_notes_for_transfer.yml +0 -61
  73. data/spec/vcr_cassettes/lookup/get_order_info.yml +0 -139
  74. data/spec/vcr_cassettes/lookup/get_orders_by_domain.yml +0 -76
  75. data/spec/vcr_cassettes/lookup/get_price.yml +0 -54
  76. data/spec/vcr_cassettes/lookup/get_product_info.yml +0 -49
  77. data/spec/vcr_cassettes/lookup/lookup_domain_available.yml +0 -55
  78. data/spec/vcr_cassettes/lookup/lookup_domain_registered.yml +0 -55
  79. data/spec/vcr_cassettes/lookup/name_suggest.yml +0 -396
  80. data/spec/vcr_cassettes/nameserver/create.yml +0 -49
  81. data/spec/vcr_cassettes/nameserver/delete.yml +0 -49
  82. data/spec/vcr_cassettes/nameserver/get.yml +0 -71
  83. data/spec/vcr_cassettes/nameserver/modify.yml +0 -49
  84. data/spec/vcr_cassettes/provisioning/cancel_order.yml +0 -56
  85. data/spec/vcr_cassettes/provisioning/cancel_order_invalid.yml +0 -49
  86. data/spec/vcr_cassettes/provisioning/cancel_pending_orders.yml +0 -58
  87. data/spec/vcr_cassettes/provisioning/modify_all_domains.yml +0 -49
  88. data/spec/vcr_cassettes/provisioning/modify_domain.yml +0 -49
  89. data/spec/vcr_cassettes/provisioning/process_pending.yml +0 -57
  90. data/spec/vcr_cassettes/provisioning/register_domain.yml +0 -57
  91. data/spec/vcr_cassettes/provisioning/register_pending_domain.yml +0 -55
  92. data/spec/vcr_cassettes/provisioning/register_taken_domain.yml +0 -55
  93. data/spec/vcr_cassettes/provisioning/renew_domain.yml +0 -58
  94. data/spec/vcr_cassettes/provisioning/revoke_domain.yml +0 -55
  95. data/spec/vcr_cassettes/provisioning/trust_service.yml +0 -60
  96. data/spec/vcr_cassettes/provisioning/update_contacts.yml +0 -66
  97. data/spec/vcr_cassettes/transfer/cancel_transfer.yml +0 -49
  98. data/spec/vcr_cassettes/transfer/cancel_trasnfer_order.yml +0 -49
  99. data/spec/vcr_cassettes/transfer/check_transfer.yml +0 -56
  100. data/spec/vcr_cassettes/transfer/check_transfer_exists.yml +0 -57
  101. data/spec/vcr_cassettes/transfer/get_transfers_away.yml +0 -60
  102. data/spec/vcr_cassettes/transfer/get_transfers_in.yml +0 -80
  103. data/spec/vcr_cassettes/transfer/process_transfer.yml +0 -49
  104. data/spec/vcr_cassettes/transfer/process_transfer_unsuccessful.yml +0 -49
  105. data/spec/vcr_cassettes/transfer/rsp2rsp_push_transfer.yml +0 -49
  106. data/spec/vcr_cassettes/transfer/send_password.yml +0 -49
  107. data/spec/vcr_cassettes/transfer/transfer.yml +0 -58
@@ -1,167 +0,0 @@
1
- module MooMoo
2
- module OpenSRS
3
- module ProvisioningCommands
4
- # Cancels a Trust Service order
5
- #
6
- # ==== Required
7
- # * <tt>:order_id</tt> - ID of the order
8
- def cancel_order(order_id)
9
- run_command :cancel_order, :trust_service, {
10
- :order_id => order_id,
11
- :key => 'attributes'
12
- }
13
- end
14
-
15
- # Cancels pending or declined orders
16
- #
17
- # ==== Required
18
- # * <tt>:to_date</tt> - date before which to cancel orders
19
- def cancel_pending_orders(to_date)
20
- run_command :cancel_pending_orders, :order, {
21
- :to_date => to_date,
22
- :key => 'attributes'
23
- }
24
- end
25
-
26
- # Changes information associated with a domain
27
- #
28
- # ==== Required
29
- # * <tt>:type</tt> - type of data to modify
30
- # * <tt>:params</tt> - new parameter values to set
31
- #
32
- # ==== Optional
33
- # * <tt>:cookie</tt> - cookie for the domain
34
- def modify(params)
35
- cookie = params.delete :cookie
36
-
37
- run_command :modify, :domain, params, cookie
38
- end
39
-
40
- # Processes or cancels a pending order
41
- #
42
- # ==== Required
43
- # * <tt>:order_id</tt> - ID of the pending order to process
44
- def process_pending(order_id)
45
- run_command :process_pending, :domain, {
46
- :order_id => order_id,
47
- :key => 'attributes'
48
- }
49
- end
50
-
51
- # Renews a domain name
52
- #
53
- # ==== Required
54
- # * <tt>:domain</tt> - domain name to renew
55
- # * <tt>:term</tt> - number of years to renew for
56
- # * <tt>:current_expiration_year</tt> - current expiration year in YYYY format
57
- def renew_domain(attribs)
58
- Args.new(attribs) do |c|
59
- c.requires :domain, :term, :current_expiration_year
60
- end
61
-
62
- attribs[:handle] = 'process' unless attribs[:handle]
63
- attribs[:key] = 'attributes'
64
-
65
- run_command :renew, :domain, attribs
66
- end
67
-
68
- # Removes the domain at the registry
69
- #
70
- # ==== Required
71
- # * <tt>:domain</tt> - domain name to remove
72
- # * <tt>:reseller</tt> - username of the reseller
73
- def revoke(params)
74
- params[:key] = 'attributes'
75
-
76
- run_command :revoke, :domain, params
77
- end
78
-
79
- # Submits a domain contact information update
80
- #
81
- # ==== Required
82
- # * <tt>:domain</tt> - domain name to update the contacts of
83
- # * <tt>:contacts</tt> - contact set with updated values
84
- # * <tt>:types</tt> - list of contact types that are to be updated
85
- def update_contacts(params)
86
- params[:types] = index_array(params[:types])
87
-
88
- params[:contact_set] = params.delete :contacts
89
- params[:key] = 'attributes'
90
-
91
- run_command :update_contacts, :domain, params
92
- end
93
-
94
- # Submits a new registration request or transfer order
95
- #
96
- # ==== Required
97
- # * <tt>:domain</tt> - domain name to register
98
- # * <tt>:contacts</tt> - contact set for the domain
99
- # * <tt>:nameservers</tt> - array of nameservers
100
- #
101
- # ==== Optional
102
- # * <tt>:term</tt> - number of years to register the domain for
103
- # * <tt>:options</tt> - additional attributes to set
104
- def register_domain(attribs)
105
- Args.new(attribs) do |c|
106
- c.requires :domain, :contacts, :nameservers
107
- c.optionals :term, :options
108
- end
109
-
110
- attribs[:term] = 1 unless attribs[:term]
111
- nameservers = format_nameservers(attribs[:nameservers])
112
-
113
- attributes = {
114
- :contact_set => attribs[:contacts],
115
- :custom_nameservers => 1,
116
- :custom_tech_contact => 1,
117
- :domain => attribs[:domain],
118
- :nameserver_list => nameservers,
119
- :period => attribs[:term],
120
- :reg_username => @user,
121
- :reg_password => @password
122
- }
123
-
124
- attributes[:reg_type] = :new unless attribs[:options] && attribs[:options][:reg_type]
125
- attributes.merge!(attribs[:options]) if attribs[:options]
126
- attributes[:key] = 'attributes'
127
-
128
- res = run_command :sw_register, :domain, attributes
129
- end
130
-
131
- # Submits a new registration request or transfer order
132
- #
133
- # ==== Required
134
- # * <tt>:csr</tt> - certificate signing request
135
- # * <tt>:contacts</tt> - contact set for the trust service
136
- #
137
- # ==== Optional
138
- # * <tt>:attribs</tt> - additional attributes to set
139
- # * <tt>:term</tt> - number of years to register the trust service for
140
- def register_trust_service(params)
141
- params[:period] = params.delete :term
142
- params[:period] = 1 unless params[:period]
143
- params[:reg_type] = 'new' unless params[:reg_type]
144
- params[:handle] = 'process' unless params[:handle]
145
- params[:contact_set] = params.delete :contacts
146
- params[:key] = 'attributes'
147
-
148
- run_command :sw_register, :trust_service, params
149
- end
150
-
151
- private
152
-
153
- def format_nameservers(nameservers)
154
- [
155
- "0".to_sym => {
156
- :sortorder => 1,
157
- :name => nameservers.first
158
- },
159
- "1".to_sym => {
160
- :sortorder => 2,
161
- :name => nameservers.size == 2 ? nameservers[1] : nameservers.first
162
- },
163
- ]
164
- end
165
- end
166
- end
167
- end
@@ -1,41 +0,0 @@
1
- module MooMoo
2
- module OpenSRS
3
- class Response
4
- # Constructor
5
- #
6
- # ==== Required
7
- # * <tt>:hash</tt> - hash of the response
8
- #
9
- # ==== Optional
10
- # * <tt>:key</tt> - primary key to use when indexing the hash
11
- def initialize(hash, key = nil)
12
- @hash = hash
13
- @key = key
14
- end
15
-
16
- # Returns whether or not the command executed was successful
17
- #
18
- def success?
19
- @hash['is_success'].nil? ? true : @hash['is_success'].to_i == 1
20
- end
21
-
22
- # Returns the error message if one is present
23
- #
24
- def error_msg
25
- @hash['response_text']
26
- end
27
-
28
- # Returns the response code if one is present
29
- #
30
- def error_code
31
- @hash['response_code'].to_i
32
- end
33
-
34
- # Returns the result hash
35
- #
36
- def result
37
- @key.nil? ? @hash : @hash[@key]
38
- end
39
- end
40
- end
41
- end
@@ -1,83 +0,0 @@
1
- module MooMoo
2
- module OpenSRS
3
- module TransferCommands
4
- # Cancels a transfer that is pending owner approval
5
- #
6
- # ==== Required
7
- # * <tt>:domain</tt> - domain name that is being transferred
8
- # * <tt>:reseller</tt> - username of the reseller
9
- def cancel_transfer(params)
10
- run_command :cancel_transfer, :transfer, params
11
- end
12
-
13
- # Cancels a transfer that is pending owner approval by order ID
14
- #
15
- # ==== Required
16
- # * <tt>:order_id</tt> - ID of the order
17
- # * <tt>:reseller</tt> - username of the reseller
18
- def cancel_transfer_for_order(params)
19
- run_command :cancel_transfer, :transfer, params
20
- end
21
-
22
- # Checks to see if the given domain can be transferred
23
- #
24
- # ==== Required
25
- # * <tt>:domain</tt> - domain name to check
26
- def check_transfer(domain)
27
- run_command :check_transfer, :domain, {
28
- :domain => domain,
29
- :key => 'attributes'
30
- }
31
- end
32
-
33
- # Lists all domains that have been transferred away
34
- #
35
- def get_transfers_away
36
- run_command :get_transfers_away, :domain, {
37
- :key => 'attributes'
38
- }
39
- end
40
-
41
- # Lists all domains that have been transferred in
42
- def get_transfers_in
43
- run_command :get_transfers_in, :domain, {
44
- :key => 'attributes'
45
- }
46
- end
47
-
48
- # Creates a new order with the same data as a cancelled order
49
- #
50
- # ==== Required
51
- # * <tt>:order_id</tt> - ID of the cancelled order
52
- # * <tt>:reseller</tt> - username of the reseller
53
- def process_transfer(params)
54
- params[:key] = 'attributes'
55
-
56
- run_command :process_transfer, :transfer, params
57
- end
58
-
59
- # Resends an e-mail to the admin contact for the transfer that is in 'pending owner approval' state
60
- #
61
- # ==== Required
62
- # * <tt>:domain</tt> - domain name being transferred
63
- def send_password(domain)
64
- run_command :send_password, :transfer, {
65
- :domain_name => domain
66
- }
67
- end
68
-
69
- # Transfers a domain name from one reseller to another
70
- #
71
- # ==== Required
72
- # * <tt>:domain</tt> - domain name to transfer
73
- # * <tt>:username</tt> - username of the registrant
74
- # * <tt>:password</tt> - password of the registrant
75
- # * <tt>:reseller</tt> - name of the gaining reseller
76
- def push_transfer(params)
77
- params[:grsp] = params.delete :reseller
78
-
79
- run_command :rsp2rsp_push_transfer, nil, params
80
- end
81
- end
82
- end
83
- end
@@ -1,13 +0,0 @@
1
- module MooMoo
2
- module OpenSRS
3
- autoload :Args, 'moo_moo/opensrs/args'
4
- autoload :Base, 'moo_moo/opensrs/base'
5
- autoload :Command, 'moo_moo/opensrs/command'
6
- autoload :LookupCommands, 'moo_moo/opensrs/lookup_commands'
7
- autoload :ProvisioningCommands, 'moo_moo/opensrs/provisioning_commands'
8
- autoload :TransferCommands, 'moo_moo/opensrs/transfer_commands'
9
- autoload :NameserverCommands, 'moo_moo/opensrs/nameserver_commands'
10
- autoload :CookieCommands, 'moo_moo/opensrs/cookie_commands'
11
- autoload :Response, 'moo_moo/opensrs/response'
12
- end
13
- end
@@ -1,176 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe MooMoo::OpenSRS::Args do
4
- context "#required_parms" do
5
- it "raises an error when missing" do
6
- options = {:arg1 => true}
7
- args = lambda {
8
- MooMoo::OpenSRS::Args.new(options) do |c|
9
- c.requires :arg2
10
- end
11
- }
12
- expect { args.call }.to raise_error(MooMoo::MooMooArgumentError, /Missing required parameter: arg2/)
13
- end
14
-
15
- it "does not raise an error with valid params" do
16
- options = {:arg1 => true}
17
- args = MooMoo::OpenSRS::Args.new(options) { |c|
18
- c.requires :arg1
19
- }
20
-
21
- args.required_params.should have(1).value
22
- args.required_params.should include(:arg1)
23
- end
24
-
25
- it "sets optional_params" do
26
- options = {:arg1 => true, :arg2 => 2}
27
- args = MooMoo::OpenSRS::Args.new(options) { |c|
28
- c.requires :arg1, :arg2
29
- }
30
-
31
- args.optional_params.should have(2).values
32
- args.required_params.should have(2).values
33
-
34
- args.optional_params.should include(*args.required_params)
35
- end
36
-
37
- it "does not set boolean_params" do
38
- options = {:arg1 => true, :arg2 => 2}
39
- args = MooMoo::OpenSRS::Args.new(options) { |c|
40
- c.requires :arg1, :arg2
41
- }
42
-
43
- args.boolean_params.should be_empty
44
- end
45
- end
46
-
47
- context "#boolean_params" do
48
- it "raises an error when the param is not boolean" do
49
- options = {:arg1 => 'string'}
50
- args = lambda {
51
- MooMoo::OpenSRS::Args.new(options) do |c|
52
- c.booleans :arg1
53
- end
54
- }
55
- expect { args.call }.to raise_error(MooMoo::MooMooArgumentError, /Boolean parameter must be.*: arg1/)
56
- end
57
-
58
- it "raises an error with boolean params" do
59
- options = {:arg1 => true}
60
- args = MooMoo::OpenSRS::Args.new(options) { |c|
61
- c.booleans :arg1
62
- }
63
-
64
- args.boolean_params.should have(1).value
65
- args.boolean_params.should include(:arg1)
66
- end
67
-
68
- it "sets optional_params" do
69
- options = {:arg1 => true, :arg2 => false}
70
- args = MooMoo::OpenSRS::Args.new(options) { |c|
71
- c.booleans :arg1, :arg2
72
- }
73
-
74
- args.optional_params.should have(2).values
75
- args.boolean_params.should have(2).values
76
-
77
- args.optional_params.should include(:arg1, :arg2)
78
- end
79
-
80
- it "sets required_params" do
81
- options = {:arg1 => true, :arg2 => false}
82
- args = MooMoo::OpenSRS::Args.new(options) { |c|
83
- c.booleans :arg1, :arg2
84
- }
85
-
86
- args.required_params.should be_empty
87
- end
88
- end
89
-
90
- context "#optional_params" do
91
- it "raises an error with unknown params" do
92
- options = {:arg1 => true}
93
- args = lambda {
94
- MooMoo::OpenSRS::Args.new(options) do |c|
95
- c.optionals :arg2
96
- end
97
- }
98
-
99
- expect { args.call }.to raise_error(MooMoo::MooMooArgumentError, /Not a valid parameter: arg1/)
100
- end
101
-
102
- it "does not raise an error with known params" do
103
- options = {:arg1 => true, :arg2 => 2}
104
- args = MooMoo::OpenSRS::Args.new(options) { |c|
105
- c.optionals :arg1, :arg2
106
- }
107
-
108
- args.optional_params.should have(2).values
109
- args.optional_params.should include(:arg1, :arg2)
110
- end
111
-
112
- it "does not set required_params" do
113
- options = {:arg1 => true, :arg2 => 2}
114
- args = MooMoo::OpenSRS::Args.new(options) { |c|
115
- c.optionals :arg1, :arg2
116
- }
117
-
118
- args.required_params.should be_empty
119
- end
120
-
121
- it "does not set boolean_params" do
122
- options = {:arg1 => true, :arg2 => 2}
123
- args = MooMoo::OpenSRS::Args.new(options) { |c|
124
- c.optionals :arg1, :arg2
125
- }
126
-
127
- args.boolean_params.should be_empty
128
- end
129
- end
130
-
131
- context "#one_of" do
132
- it "allows one arg" do
133
- options = {:arg1 => true}
134
- args = lambda {
135
- MooMoo::OpenSRS::Args.new(options) do |c|
136
- c.one_of :arg1
137
- end
138
- }
139
-
140
- expect { args.call }.to raise_error(MooMoo::MooMooArgumentError, /One of requires two or more items/)
141
- end
142
-
143
- it "allows two or more args" do
144
- options = {:arg1 => true}
145
-
146
- args = MooMoo::OpenSRS::Args.new(options) do |c|
147
- c.one_of :arg1, :arg2
148
- end
149
-
150
- args.one_of_params.should have(2).values
151
- args.one_of_params.should include(:arg1, :arg2)
152
- end
153
-
154
- it "does not allow 0 params" do
155
- options = {}
156
- args = lambda {
157
- MooMoo::OpenSRS::Args.new(options) do |c|
158
- c.one_of :arg1, :arg2
159
- end
160
- }
161
-
162
- expect { args.call }.to raise_error(MooMoo::MooMooArgumentError, /The parameters may include only one of 'arg1, arg2'/)
163
- end
164
-
165
- it "does not allow both args" do
166
- options = {:arg1 => true, :arg2 => 2}
167
- args = lambda {
168
- MooMoo::OpenSRS::Args.new(options) do |c|
169
- c.one_of :arg1, :arg2
170
- end
171
- }
172
-
173
- expect { args.call }.to raise_error(MooMoo::MooMooArgumentError, /The parameters may include only one of 'arg1, arg2'/)
174
- end
175
- end
176
- end
@@ -1,22 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe MooMoo::OpenSRS::Base do
4
- describe "included modules" do
5
- subject { MooMoo::OpenSRS::Base }
6
- it { should include MooMoo::OpenSRS::CookieCommands }
7
- it { should include MooMoo::OpenSRS::LookupCommands }
8
- it { should include MooMoo::OpenSRS::NameserverCommands }
9
- it { should include MooMoo::OpenSRS::ProvisioningCommands }
10
- it { should include MooMoo::OpenSRS::TransferCommands }
11
- end
12
-
13
- describe "#try_opensrs" do
14
- it "raises an OpenSRSException" do
15
- expect do
16
- MooMoo::OpenSRS::Base.new.instance_eval do
17
- try_opensrs { raise "Exception message" }
18
- end
19
- end.to raise_error MooMoo::OpenSRSException
20
- end
21
- end
22
- end
@@ -1,76 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe MooMoo::OpenSRS::CookieCommands do
4
- before(:each) do
5
- @opensrs = MooMoo::OpenSRS::Base.new
6
- @registered_domain = "domainthatsnottaken1302209138.com"
7
- end
8
-
9
- describe "#set_cookie" do
10
- it "sets the cookie" do
11
- VCR.use_cassette("cookie/set_cookie") do
12
- res = @opensrs.set_cookie(
13
- :username => MooMoo.config.user,
14
- :password => MooMoo.config.pass,
15
- :domain => @registered_domain
16
- )
17
- res.success?.should be_true
18
- res.result['cookie'].should == "0000000000000000:000000:00000"
19
- end
20
- end
21
-
22
- it "fails to set the cookie" do
23
- VCR.use_cassette("cookie/set_cookie_fail") do
24
- res = @opensrs.set_cookie(
25
- :username => MooMoo.config.user,
26
- :password => 'password',
27
- :domain => 'example.com'
28
- )
29
- res.success?.should be_false
30
- res.error_code.should == 415
31
- end
32
- end
33
- end
34
-
35
- describe "#delete_cookie" do
36
- use_vcr_cassette "cookie/delete_cookie"
37
-
38
- it "destroys the cookie" do
39
- res = @opensrs.set_cookie(
40
- :username => MooMoo.config.user,
41
- :password => MooMoo.config.pass,
42
- :domain => @registered_domain
43
- )
44
- res = @opensrs.delete_cookie(res.result['cookie'])
45
- res.success?.should be_true
46
- end
47
- end
48
-
49
- describe "#update_cookie" do
50
- use_vcr_cassette "cookie/update_cookie"
51
-
52
- it "updates the cookie's domain" do
53
- res = @opensrs.set_cookie(
54
- :username => MooMoo.config.user,
55
- :password => MooMoo.config.pass,
56
- :domain => @registered_domain
57
- )
58
- res = @opensrs.update_cookie(
59
- :old_domain => @registered_domain,
60
- :new_domain => @registered_domain,
61
- :cookie => res.result['cookie']
62
- )
63
- res.success?.should be_true
64
- res.result['domain_count'].to_i.should == 1
65
- end
66
- end
67
-
68
- describe "#quit_session" do
69
- use_vcr_cassette "cookie/quit_session"
70
-
71
- it "quits the session" do
72
- res = @opensrs.quit_session
73
- res.success?.should be_true
74
- end
75
- end
76
- end