resellerclub 0.0.2
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.
- data/lib/mixin.rb +115 -0
- data/lib/models/contact.rb +25 -0
- data/lib/models/customer.rb +22 -0
- data/lib/models/domain.rb +46 -0
- data/lib/models/order.rb +15 -0
- data/lib/models/reseller.rb +21 -0
- data/lib/resellerclub.rb +6 -0
- data/spec/basic_spec.rb +435 -0
- metadata +97 -0
data/lib/mixin.rb
ADDED
@@ -0,0 +1,115 @@
|
|
1
|
+
require "rubygems"
|
2
|
+
require "typhoeus"
|
3
|
+
require "open-uri"
|
4
|
+
require "json"
|
5
|
+
|
6
|
+
module ResellerClub
|
7
|
+
|
8
|
+
@@auth_userid = "0"
|
9
|
+
@@auth_password = "password"
|
10
|
+
|
11
|
+
def self.authentication(userid = nil, password = nil)
|
12
|
+
@@auth_userid = userid
|
13
|
+
@@auth_password = password
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.auth_userid
|
17
|
+
@@auth_userid
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.auth_password
|
21
|
+
@@auth_password
|
22
|
+
end
|
23
|
+
|
24
|
+
def true_false_or_text(str)
|
25
|
+
if str == "true"
|
26
|
+
return {"response" => true}.to_json
|
27
|
+
elsif str == "false"
|
28
|
+
return {"response" => false}.to_json
|
29
|
+
elsif str.to_i.to_s == str
|
30
|
+
return {"code" => str}.to_json
|
31
|
+
else
|
32
|
+
begin
|
33
|
+
JSON.parse(str)
|
34
|
+
rescue
|
35
|
+
return {"response" => str}.to_json
|
36
|
+
end
|
37
|
+
return str
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def construct_url(params, method)
|
42
|
+
params.delete_if {|k,v| v == ""}
|
43
|
+
url = self::BASE_URL + method + "?"
|
44
|
+
params.each do |k,v|
|
45
|
+
if v.kind_of?(Array)
|
46
|
+
v.each { |elem| url = url + k.gsub("_","-") + "=" + elem + "&"}
|
47
|
+
else
|
48
|
+
url = url + k.gsub("_","-") + "=" + v + "&"
|
49
|
+
end
|
50
|
+
end
|
51
|
+
if url[-1] == "&"
|
52
|
+
url = url[0..-2]
|
53
|
+
end
|
54
|
+
URI::encode(url)
|
55
|
+
end
|
56
|
+
|
57
|
+
def generate_method_name_from_url(url)
|
58
|
+
url.split(".")[0].gsub("/", "_").gsub("-","_")
|
59
|
+
end
|
60
|
+
|
61
|
+
def build_method(data)
|
62
|
+
construct_url_bind = method(:construct_url)
|
63
|
+
true_false_or_text_bind = method(:true_false_or_text)
|
64
|
+
if data["method_name"].nil?
|
65
|
+
data["method_name"] = generate_method_name_from_url(data["url"])
|
66
|
+
end
|
67
|
+
define_method data["method_name"] do |params=nil|
|
68
|
+
mock = false
|
69
|
+
if params.kind_of? Hash
|
70
|
+
mock = params.delete("test_mock")
|
71
|
+
mock ||= params.delete(:test_mock)
|
72
|
+
end
|
73
|
+
if data["values"].nil?
|
74
|
+
data["values"] = {}
|
75
|
+
elsif data["values"].keys.count == 1 and (data["values"].values)[0] == ""
|
76
|
+
if params.kind_of? Hash
|
77
|
+
data["values"].merge!(params)
|
78
|
+
elsif params.kind_of? String
|
79
|
+
data["values"][(data["values"].keys)[0]] = params
|
80
|
+
end
|
81
|
+
else
|
82
|
+
data["values"].merge!(params)
|
83
|
+
end
|
84
|
+
if not data["values"].keys.include? "auth_userid" and not data["values"].keys.include? "auth_password"
|
85
|
+
data["values"]["auth_userid"] = ResellerClub::auth_userid
|
86
|
+
data["values"]["auth_password"] = ResellerClub::auth_password
|
87
|
+
end
|
88
|
+
if data["validate"].call(data["values"])
|
89
|
+
url = construct_url_bind.call(data["values"], data["url"])
|
90
|
+
if mock
|
91
|
+
return url
|
92
|
+
end
|
93
|
+
if data["silent"]
|
94
|
+
Typhoeus::Request.send data["http_method"], url
|
95
|
+
else
|
96
|
+
response = Typhoeus::Request.send data["http_method"], url
|
97
|
+
case response.code
|
98
|
+
when 200
|
99
|
+
return JSON.parse(true_false_or_text_bind.call(response.body))
|
100
|
+
when 500
|
101
|
+
error = JSON.parse(true_false_or_text_bind.call(response.body))
|
102
|
+
raise error["message"]
|
103
|
+
when 404
|
104
|
+
raise "Action not Found"
|
105
|
+
else
|
106
|
+
error = JSON.parse(true_false_or_text_bind.call(response.body))
|
107
|
+
raise error["message"]
|
108
|
+
end
|
109
|
+
end
|
110
|
+
else
|
111
|
+
raise "Validation failed."
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require_relative '../mixin.rb'
|
3
|
+
|
4
|
+
class Contact
|
5
|
+
class << self
|
6
|
+
BASE_URL = "https://test.httpapi.com/api/contacts/"
|
7
|
+
|
8
|
+
extend ResellerClub
|
9
|
+
|
10
|
+
[{"values" => {}, "http_method" => "post", "validate" => lambda {|v| true}, "url" => "add.json"},
|
11
|
+
{"values" => {}, "http_method" => "post", "validate" => lambda {|v| true}, "url" => "modify.json"},
|
12
|
+
{"values" => {"contact_id" => ""}, "http_method" => "get", "validate" => lambda {|v| true}, "url" => "details.json"},
|
13
|
+
{"values" => {}, "http_method" => "get", "validate" => lambda {|v| true}, "url" => "default.json"},
|
14
|
+
{"values" => {"no_of_records" => "50","page_no" => "1"}, "http_method" => "get", "validate" => lambda {|v| true}, "url" => "search.json"},
|
15
|
+
{"values" => {"contact_id" => ""}, "http_method" => "post", "validate" => lambda {|v| true}, "url" => "delete.json"},
|
16
|
+
{"values" => {}, "http_method" => "post", "validate" => lambda {|v| true}, "url" => "set-details.json"},
|
17
|
+
{"values" => {"customer_id" => ""}, "http_method" => "get", "validate" => lambda {|v| true}, "url" => "sponsors.json"},
|
18
|
+
{"values" => {}, "http_method" => "get", "validate" => lambda {|v| true}, "url" => "coop/add-sponsor.json"},
|
19
|
+
{"values" => nil, "http_method" => "get", "validate" => lambda {|v| true}, "url" => "dotca/registrantagreement.json"},
|
20
|
+
{"values" => {}, "http_method" => "get", "validate" => lambda {|v| true}, "url" => "validate-registrant.json"},
|
21
|
+
].each { |p| build_method p }
|
22
|
+
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require_relative '../mixin.rb'
|
2
|
+
|
3
|
+
class Customer
|
4
|
+
class << self
|
5
|
+
BASE_URL = "https://test.httpapi.com/api/customers/"
|
6
|
+
|
7
|
+
extend ResellerClub
|
8
|
+
|
9
|
+
[{"values" => {"lang_pref" => "en"}, "http_method" => "post","validate" => lambda {|v| true}, "url" => "signup.json"},
|
10
|
+
{"values" => {"lang_pref" => "en"}, "http_method" => "post", "validate" => lambda {|v| true}, "url" => "modify.json"},
|
11
|
+
{"values" => {"username" => ""}, "http_method" => "get", "validate" => lambda {|v| true}, "url" => "details.json"},
|
12
|
+
{"values" => {"customer_id" => ""}, "http_method" => "get", "validate" => lambda {|v| true}, "url" => "details-by-id.json"},
|
13
|
+
{"values" => {}, "http_method" => "get", "validate" => lambda {|v| true}, "url" => "change-password.json"},
|
14
|
+
{"values" => {"customer_id" => ""}, "http_method" => "get", "validate" => lambda {|v| true}, "url" => "temp-password.json"},
|
15
|
+
{"values" => {"no_of_records" => "50","page_no" => "1"}, "http_method" => "get", "validate" => lambda {|v| true}, "url" => "search.json"},
|
16
|
+
{"values" => {"customer_id" => ""}, "http_method" => "post", "validate" => lambda {|v| true}, "url" => "delete.json"},
|
17
|
+
{"values" => {}, "http_method" => "get", "validate" => lambda {|v| true}, "url" => "generate-token.json"},
|
18
|
+
{"values" => {"token" => ""}, "http_method" => "post", "validate" => lambda {|v| true}, "url" => "authenticate-token.json"},
|
19
|
+
].each { |p| build_method p }
|
20
|
+
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require_relative '../mixin.rb'
|
3
|
+
|
4
|
+
class Domain
|
5
|
+
class << self
|
6
|
+
BASE_URL = "https://test.httpapi.com/api/domains/"
|
7
|
+
|
8
|
+
extend ResellerClub
|
9
|
+
|
10
|
+
[{"values" => {}, "http_method" => "get", "validate" => lambda {|v| true}, "url" => "available.json"},
|
11
|
+
{"values" => {}, "http_method" => "get", "validate" => lambda {|v| true}, "url" => "idn-available.json"},
|
12
|
+
{"values" => {}, "http_method" => "get", "validate" => lambda {|v| true}, "url" => "suggest-names.json"},
|
13
|
+
{"values" => {}, "http_method" => "post", "validate" => lambda {|v| true}, "url" => "register.json"},
|
14
|
+
{"values" => {"domain-name" => ""},"http_method" => "get", "validate" => lambda {|v| true}, "url" => "validate-transfer.json"},
|
15
|
+
{"values" => {"domain-name" => ""}, "http_method" => "post", "validate" => lambda {|v| true}, "url" => "transfer.json"},
|
16
|
+
# {"values" => {}, "http_method" => "post", "validate" => lambda {|v| true}, "url" => "eu/transfer.json"},
|
17
|
+
# {"values" => {}, "http_method" => "post", "validate" => lambda {|v| true}, "url" => "trade.json"},
|
18
|
+
{"values" => {}, "http_method" => "post", "validate" => lambda {|v| true}, "url" => "renew.json"},
|
19
|
+
{"values" => {"no-of-records" => "10", "page-no" => "1"}, "http_method" => "get", "validate" => lambda {|v| true}, "url" => "search.json"},
|
20
|
+
{"values" => {"customer_id" => ""}, "http_method" => "get","validate" => lambda {|v| true}, "url" => "customer-default-ns.json"},
|
21
|
+
{"values" => {"domain_name" => ""}, "http_method" => "get", "validate" => lambda {|v| true}, "url" => "orderid.json"},
|
22
|
+
{"values" => {}, "http_method" => "get", "validate" => lambda {|v| true}, "url" => "details.json"},
|
23
|
+
{"values" => {}, "http_method" => "post", "validate" => lambda {|v| true}, "url" => "modify-ns.json"},
|
24
|
+
{"values" => {}, "http_method" => "post", "validate" => lambda {|v| true}, "url" => "add-cns.json"},
|
25
|
+
{"values" => {}, "http_method" => "post", "validate" => lambda {|v| true}, "url" => "modify-cns-name.json"},
|
26
|
+
{"values" => {}, "http_method" => "post", "validate" => lambda {|v| true}, "url" => "modify-cns-ip.json"},
|
27
|
+
{"values" => {}, "http_method" => "post", "validate" => lambda {|v| true}, "url" => "delete-cns-ip.json"},
|
28
|
+
{"values" => {}, "http_method" => "post", "validate" => lambda {|v| true}, "url" => "modify-contact.json"},
|
29
|
+
{"values" => {}, "http_method" => "post", "validate" => lambda {|v| true}, "url" => "modify-privacy-protection.json"},
|
30
|
+
{"values" => {}, "http_method" => "post", "validate" => lambda {|v| true}, "url" => "modify-auth-code.json"},
|
31
|
+
{"values" => {"order_id" => ""}, "http_method" => "post", "validate" => lambda {|v| true}, "url" => "enable-theft-protection.json"},
|
32
|
+
{"values" => {"order_id" => ""}, "http_method" => "post", "validate" => lambda {|v| true}, "url" => "disable-theft-protection.json"},
|
33
|
+
{"values" => {"order_id" => ""}, "http_method" => "get", "validate" => lambda {|v| true}, "url" => "locks.json"},
|
34
|
+
{"values" => {"order_id" => ""}, "http_method" => "get", "validate" => lambda {|v| true}, "url" => "tel/cth-details.json"},
|
35
|
+
{"values" => {}, "http_method" => "post", "validate" => lambda {|v| true}, "url" => "tel/modify-whois-pref.json"},
|
36
|
+
{"values" => {"order_id" => ""}, "http_method" => "post", "validate" => lambda {|v| true}, "url" => "resend-rfa.json"},
|
37
|
+
{"values" => {}, "http_method" => "post", "validate" => lambda {|v| true}, "url" => "uk/release.json"},
|
38
|
+
{"values" => {"order_id" => ""}, "http_method" => "post", "validate" => lambda {|v| true}, "url" => "cancel-transfer.json"},
|
39
|
+
{"values" => {"order_id" => ""}, "http_method" => "post", "validate" => lambda {|v| true}, "url" => "delete.json"},
|
40
|
+
{"values" => {}, "http_method" => "post", "validate" => lambda {|v| true}, "url" => "restore.json"},
|
41
|
+
{"values" => {"order_id" => ""}, "http_method" => "post", "validate" => lambda {|v| true}, "url" => "de/recheck-ns.json"},
|
42
|
+
{"values" => {}, "http_method" => "post", "validate" => lambda {|v| true}, "url" => "dotxxx/association-details.json"},
|
43
|
+
].each { |p| build_method p }
|
44
|
+
|
45
|
+
end
|
46
|
+
end
|
data/lib/models/order.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require_relative '../mixin.rb'
|
3
|
+
|
4
|
+
class Order
|
5
|
+
class << self
|
6
|
+
BASE_URL = "https://test.httpapi.com/api/orders/"
|
7
|
+
|
8
|
+
extend ResellerClub
|
9
|
+
|
10
|
+
[{"values" => {}, "http_method" => "post", "validate" => lambda {|v| true}, "url" => "suspend.json"},
|
11
|
+
{"values" => {"order_id" => ""}, "http_method" => "post", "validate" => lambda {|v| true}, "url" => "unsuspend.json"},
|
12
|
+
].each { |p| build_method p }
|
13
|
+
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require_relative '../mixin.rb'
|
2
|
+
|
3
|
+
class Reseller
|
4
|
+
class << self
|
5
|
+
BASE_URL = "https://test.httpapi.com/api/customers/"
|
6
|
+
|
7
|
+
extend ResellerClub
|
8
|
+
|
9
|
+
[{"values" => {"lang_pref" => "en"}, "http_method" => "post","validate" => lambda {|v| true}, "url" => "signup.json"},
|
10
|
+
{"values" => {"lang_pref" => "en"}, "http_method" => "post", "validate" => lambda {|v| true}, "url" => "modify-details.json"},
|
11
|
+
{"values" => {"reseller_id" => ""}, "http_method" => "get", "validate" => lambda {|v| true}, "url" => "details.json"},
|
12
|
+
{"values" => {"reseller_id" => ""}, "http_method" => "get", "validate" => lambda {|v| true}, "url" => "temp-password.json"},
|
13
|
+
{"values" => {"no_of_records" => "50","page_no" => "1"}, "http_method" => "get", "validate" => lambda {|v| true}, "url" => "search.json"},
|
14
|
+
{"values" => {"customer_id" => ""}, "http_method" => "post", "validate" => lambda {|v| true}, "url" => "delete.json"},
|
15
|
+
{"values" => {},"http_method" => "get", "validate" => lambda {|v| true}, "url" => "generate-token.json"},
|
16
|
+
{"values" => {}, "http_method" => "get", "validate" => lambda {|v| true}, "url" => "authenticate-token.json"},
|
17
|
+
{"values" => {}, "http_method" => "get", "validate" => lambda {|v| true}, "url" => "promo-details.json"},
|
18
|
+
].each { |p| build_method p }
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
data/lib/resellerclub.rb
ADDED
data/spec/basic_spec.rb
ADDED
@@ -0,0 +1,435 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require 'rspec'
|
3
|
+
require 'json_spec'
|
4
|
+
require 'rack/test'
|
5
|
+
require 'rspec/expectations'
|
6
|
+
require_relative '../lib/models/customer.rb'
|
7
|
+
require_relative '../lib/models/reseller.rb'
|
8
|
+
require_relative '../lib/models/contact.rb'
|
9
|
+
require_relative '../lib/models/domain.rb'
|
10
|
+
require_relative '../lib/models/order.rb'
|
11
|
+
require_relative '../lib/mixin.rb'
|
12
|
+
require "pry"
|
13
|
+
require "open-uri"
|
14
|
+
|
15
|
+
RSpec.configure do |conf|
|
16
|
+
conf.include Rack::Test::Methods
|
17
|
+
conf.include JsonSpec::Helpers
|
18
|
+
end
|
19
|
+
|
20
|
+
def hashify_url_params(params)
|
21
|
+
hash = {}
|
22
|
+
div_params = params.split('&').each do |str|
|
23
|
+
k,v = str.split("=")
|
24
|
+
hash[k] = v
|
25
|
+
end
|
26
|
+
hash
|
27
|
+
end
|
28
|
+
|
29
|
+
def eql_urls(url1, url2)
|
30
|
+
url1, params1 = url1.split("?")
|
31
|
+
url2, params2 = url2.split("?")
|
32
|
+
params = hashify_url_params(params1) == hashify_url_params(params2)
|
33
|
+
urls = url1 == url2
|
34
|
+
if params and urls
|
35
|
+
return true
|
36
|
+
end
|
37
|
+
return false
|
38
|
+
end
|
39
|
+
|
40
|
+
Spec::Matchers.define :be_eql_url do |original_url|
|
41
|
+
match do |generated_url|
|
42
|
+
eql_urls(generated_url, URI::encode(original_url))
|
43
|
+
end
|
44
|
+
failure_message_for_should do |generated_url|
|
45
|
+
diff = []
|
46
|
+
gen_url, gen_params = generated_url.split("?")
|
47
|
+
orig_url, orig_params = URI::encode(original_url).split("?")
|
48
|
+
if orig_params != gen_params
|
49
|
+
gen_params = hashify_url_params(gen_params)
|
50
|
+
orig_params = hashify_url_params(orig_params)
|
51
|
+
gen_params.each {|k, v| diff << [k, {"origin" => orig_params[k], "generated" => gen_params[k]}] if orig_params[k] != v }
|
52
|
+
orig_params.each {|k, v| diff << [k, {"origin" => orig_params[k], "generated" => gen_params[k]}] if gen_params[k] != v }
|
53
|
+
elsif gen_url != orig_url
|
54
|
+
|
55
|
+
end
|
56
|
+
"expected: #{generated_url} \n got: #{original_url} \n difference: #{diff}"
|
57
|
+
end
|
58
|
+
failure_message_for_should_not do |generated_url|
|
59
|
+
"expected: #{generated_url} \n to be different from: #{original_url}"
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
|
64
|
+
describe 'Reseller Club Models' do
|
65
|
+
include Rack::Test::Methods
|
66
|
+
|
67
|
+
context "Testing Customer Model" do
|
68
|
+
|
69
|
+
before(:all) do
|
70
|
+
# WARNING! Change `123456` for a real Reseller id and `myresellerpass` for the password of that reseller account across all the file
|
71
|
+
ResellerClub::authentication("123456", "myresellerpass")
|
72
|
+
end
|
73
|
+
|
74
|
+
it "should generate a correct url for signup" do
|
75
|
+
org_url = "https://test.httpapi.com/api/customers/signup.json?auth-userid=123456&auth-password=myresellerpass&username=david@myownresellercompany.com&passwd=marketleader&name=David&company=DavidCo&address-line-1=96 st&city=Miami&state=FL&country=US&zipcode=55333&phone-cc=186&phone=55151155&lang-pref=en"
|
76
|
+
Customer.signup("username" => "david@myownresellercompany.com", "passwd" => "marketleader", "name" => "David", "company" => "DavidCo", "address-line-1" => "96 st", "city" => "Miami", "state" => "FL", "country" => "US", "zipcode" => "55333", "phone-cc" => "186", "phone" => "55151155", "lang-pref" => "en", :test_mock => true).should be_eql_url(org_url)
|
77
|
+
end
|
78
|
+
|
79
|
+
it "should generate a correct url for update" do
|
80
|
+
org_url = "https://test.httpapi.com/api/customers/modify.json?auth-userid=123456&auth-password=myresellerpass&customer-id=5364&username=david@myownresellercompany.com&name=David&company=DavidCo&lang-pref=en&address-line-1=96 st&city=Miami&state=FL&country=US&zipcode=55333&phone-cc=186&phone=55151155"
|
81
|
+
Customer.modify("username" => "david@myownresellercompany.com", "name" => "David", "company" => "DavidCo", "address-line-1" => "96 st", "city" => "Miami", "state" => "FL", "country" => "US", "zipcode" => "55333", "phone-cc" => "186", "phone" => "55151155", "lang-pref" => "en", "customer-id" => "5364", :test_mock => true).should be_eql_url(org_url)
|
82
|
+
end
|
83
|
+
|
84
|
+
it "should generate a correct url for get_by_id" do
|
85
|
+
org_url = "https://test.httpapi.com/api/customers/details-by-id.json?auth-userid=123456&auth-password=myresellerpass&customer-id=5353"
|
86
|
+
Customer.details_by_id("customer_id" => "5353", :test_mock => true).should be_eql_url(org_url)
|
87
|
+
end
|
88
|
+
|
89
|
+
it "should generate a correct url for get_by_username" do
|
90
|
+
org_url = "https://test.httpapi.com/api/customers/details.json?auth-userid=123456&auth-password=myresellerpass&username=david@myownresellercompany.com"
|
91
|
+
Customer.details("username" => "david@myownresellercompany.com", :test_mock => true).should be_eql_url(org_url)
|
92
|
+
end
|
93
|
+
|
94
|
+
it "should generate a correct url for change_password" do
|
95
|
+
org_url = "https://test.httpapi.com/api/customers/change-password.json?auth-userid=123456&auth-password=myresellerpass&customer-id=8989&new-passwd=password1"
|
96
|
+
Customer.change_password("customer_id" => "8989", "new_passwd" => "password1", :test_mock => true).should be_eql_url(org_url)
|
97
|
+
end
|
98
|
+
|
99
|
+
it "should generate a correct url for generate_password" do
|
100
|
+
org_url = "https://test.httpapi.com/api/customers/temp-password.json?auth-userid=123456&auth-password=myresellerpass&customer-id=8989"
|
101
|
+
Customer.temp_password("customer_id" => "8989", :test_mock => true).should be_eql_url(org_url)
|
102
|
+
end
|
103
|
+
|
104
|
+
it "should generate a correct url for search" do
|
105
|
+
org_url = "https://test.httpapi.com/api/customers/search.json?auth-userid=123456&auth-password=myresellerpass&no-of-records=50&page-no=1&name=David"
|
106
|
+
Customer.search("name" => "David", :test_mock => true).should be_eql_url(org_url)
|
107
|
+
end
|
108
|
+
|
109
|
+
it "should generate a correct url for delete" do
|
110
|
+
org_url = "https://test.httpapi.com/api/customers/delete.json?auth-userid=123456&auth-password=myresellerpass&customer-id=5377"
|
111
|
+
Customer.delete("customer_id" => "5377", :test_mock => true).should be_eql_url(org_url)
|
112
|
+
end
|
113
|
+
|
114
|
+
it "should generate a correct url for generate_token" do
|
115
|
+
org_url = "https://test.httpapi.com/api/customers/generate-token.json?auth-userid=123456&auth-password=myresellerpass&username=david@myownresellercompany.com&passwd=customerpassword&ip=1.1.1.1"
|
116
|
+
Customer.generate_token("username"=>"david@myownresellercompany.com","passwd"=>"customerpassword", "ip"=>"1.1.1.1", :test_mock => true).should be_eql_url(org_url)
|
117
|
+
end
|
118
|
+
|
119
|
+
it "should generate a correct url for authenticate token" do
|
120
|
+
org_url = "https://test.httpapi.com/api/customers/authenticate-token.json?auth-userid=123456&auth-password=myresellerpass&token=generatedtoken"
|
121
|
+
Customer.authenticate_token("token" => "generatedtoken", :test_mock => true).should be_eql_url(org_url)
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
context "Testing Contact Model" do
|
126
|
+
|
127
|
+
before(:all) do
|
128
|
+
ResellerClub::authentication("123456", "myresellerpass")
|
129
|
+
end
|
130
|
+
|
131
|
+
it "should generate a correct url for add" do
|
132
|
+
org_url = "https://test.httpapi.com/api/contacts/add.json?auth-userid=123456&auth-password=myresellerpass&name=Joe&company=Registrants Inc&email=joe@registrants.com&address-line-1=main st no 41&city=Chicago&country=US&zipcode=11500&phone-cc=202&phone=636518&customer-id=8989245&type=Contact&state=Illinois"
|
133
|
+
Contact.add("name" => "Joe", "company" => "Registrants Inc", "email" => "joe@registrants.com", "address-line-1" => "main st no 41", "city" => "Chicago", "state" => "Illinois", "country" => "US", "zipcode" => "11500", "phone-cc" => "202", "phone" => "636518", "customer-id" => "8989245", "type" => "Contact", :test_mock => true).should be_eql_url(org_url)
|
134
|
+
end
|
135
|
+
|
136
|
+
it "should generate a correct url for modify" do
|
137
|
+
org_url = "https://test.httpapi.com/api/contacts/modify.json?auth-userid=123456&auth-password=myresellerpass&contact-id=25049249&name=Joe Jr&company=Registrants Inc&email=joe@registrants.com&address-line-1=main st no 41&city=Chicago&country=US&zipcode=11500&phone-cc=202&phone=536585"
|
138
|
+
Contact.modify("name" => "Joe Jr", "company" => "Registrants Inc", "email" => "joe@registrants.com", "address-line-1" => "main st no 41", "city" => "Chicago", "country" => "US", "zipcode" => "11500", "phone-cc" => "202", "phone" => "536585", "contact-id" => "25049249", :test_mock => true).should be_eql_url(org_url)
|
139
|
+
end
|
140
|
+
|
141
|
+
it "should generate a correct url for details" do
|
142
|
+
org_url = "https://test.httpapi.com/api/contacts/details.json?auth-userid=123456&auth-password=myresellerpass&contact-id=25050309"
|
143
|
+
Contact.details("contact_id" => "25050309", :test_mock => true).should be_eql_url(org_url)
|
144
|
+
end
|
145
|
+
|
146
|
+
it "should generate a correct url for search" do
|
147
|
+
org_url = "https://test.httpapi.com/api/contacts/search.json?auth-userid=123456&auth-password=myresellerpass&customer-id=8989245&no-of-records=50&page-no=1&name=Joe Jr"
|
148
|
+
Contact.search("name" => "Joe Jr", "customer-id" => "8989245", :test_mock => true).should be_eql_url(org_url)
|
149
|
+
end
|
150
|
+
|
151
|
+
it "should generate a correct url for default" do
|
152
|
+
org_url = "https://test.httpapi.com/api/contacts/default.json?auth-userid=123456&auth-password=myresellerpass&customer-id=8989245&type=Contact"
|
153
|
+
Contact.default("type" => "Contact", "customer-id" => "8989245", :test_mock => true).should be_eql_url(org_url)
|
154
|
+
end
|
155
|
+
|
156
|
+
it "should generate a correct url for delete" do
|
157
|
+
org_url = "https://test.httpapi.com/api/contacts/delete.json?auth-userid=123456&auth-password=myresellerpass&contact-id=25049249"
|
158
|
+
Contact.delete("contact_id" => "25049249", :test_mock => true).should be_eql_url(org_url)
|
159
|
+
end
|
160
|
+
|
161
|
+
it "should generate a correct url for set_details" do
|
162
|
+
org_url = "https://test.httpapi.com/api/contacts/set-details.json?auth-userid=123456&auth-password=myresellerpass&contact-id=25050309&attr-name1=sponsor1&attr-value1=200&product-key=dotcoop"
|
163
|
+
Contact.set_details("contact_id" => "25050309", "product-key" => "dotcoop", "attr-name1" => "sponsor1", "attr-value1" => "200", :test_mock => true).should be_eql_url(org_url)
|
164
|
+
end
|
165
|
+
|
166
|
+
it "should generate a correct url for sponsors" do
|
167
|
+
org_url = "https://test.httpapi.com/api/contacts/sponsors.json?auth-userid=123456&auth-password=myresellerpass&customer-id=8989245"
|
168
|
+
Contact.sponsors("customer_id" => "8989245", :test_mock => true).should be_eql_url(org_url)
|
169
|
+
end
|
170
|
+
|
171
|
+
it "should generate a correct url for coop_add_sponsor" do
|
172
|
+
org_url = "https://test.httpapi.com/api/contacts/coop/add-sponsor.json?auth-userid=123456&auth-password=myresellerpass&name=Dave&company=Registrants Inc&email=dave@registrants.com&address-line-1=main st no 41&city=Chicago&country=US&zipcode=11500&phone-cc=253&phone=531531&customer-id=8989245"
|
173
|
+
Contact.coop_add_sponsor("name" => "Dave", "company" => "Registrants Inc", "email" => "dave@registrants.com", "address-line-1" => "main st no 41", "city" => "Chicago", "country" => "US", "zipcode" => "11500", "phone-cc" => "253", "phone" => "531531", "customer-id" => "8989245", :test_mock => true).should be_eql_url(org_url)
|
174
|
+
end
|
175
|
+
|
176
|
+
it "should generate a correct url for dotca_registrantagreement" do
|
177
|
+
org_url = "https://test.httpapi.com/api/contacts/dotca/registrantagreement.json?auth-userid=123456&auth-password=myresellerpass"
|
178
|
+
Contact.dotca_registrantagreement(:test_mock => true).should be_eql_url(org_url)
|
179
|
+
end
|
180
|
+
|
181
|
+
it "should generate a correct url for validate_registrant" do
|
182
|
+
org_url = "https://test.httpapi.com/api/contacts/validate-registrant.json?auth-userid=123456&auth-password=myresellerpass&contact-id=50309&contact-id=1&eligibility-criteria=CED_ASIAN_COUNTRY&eligibility-criteria=CED_DETAILS"
|
183
|
+
Contact.validate_registrant("contact_id" => ["50309", "1"], "eligibility-criteria" => ["CED_ASIAN_COUNTRY", "CED_DETAILS"], :test_mock => true).should be_eql_url(org_url)
|
184
|
+
end
|
185
|
+
end
|
186
|
+
|
187
|
+
context "Testing Domain Model" do
|
188
|
+
before(:all) do
|
189
|
+
ResellerClub::authentication("123456", "myresellerpass")
|
190
|
+
end
|
191
|
+
|
192
|
+
it "should generate a correct url for available" do
|
193
|
+
org_url = "https://test.httpapi.com/api/domains/available.json?auth-userid=123456&auth-password=myresellerpass&domain-name=registrants&tlds=com&tlds=net"
|
194
|
+
Domain.available("domain-name" => ["registrants"], "tlds" => ["com", "net"], :test_mock => true).should be_eql_url(org_url)
|
195
|
+
end
|
196
|
+
|
197
|
+
it "should generate a correct url for idn-available" do
|
198
|
+
org_url = "https://test.httpapi.com/api/domains/idn-available.json?auth-userid=123456&auth-password=myresellerpass&domain-name=españa&tld=es&idnLanguageCode=es"
|
199
|
+
Domain.idn_available("domain-name" => "españa", "tld" => "es", "idnLanguageCode" => "es", :test_mock => true).should be_eql_url(org_url)
|
200
|
+
end
|
201
|
+
|
202
|
+
it "should generate a correct url for suggest_names" do
|
203
|
+
org_url = "https://test.httpapi.com/api/domains/suggest-names.json?auth-userid=123456&auth-password=myresellerpass&keyword=ipad&tlds=com&tlds=net&no-of-results=5&hyphen-allowed=true&add-related=true"
|
204
|
+
Domain.suggest_names("keyword" => "ipad", "tlds" => ["com", "net"], "hyphen-allowed" => "true", "add-related" => "true", "no-of-results" => "5", :test_mock => true).should be_eql_url(org_url)
|
205
|
+
end
|
206
|
+
|
207
|
+
it "should generate a correct url for register" do
|
208
|
+
org_url = "https://test.httpapi.com/api/domains/register.json?auth-userid=123456&auth-password=myresellerpass&domain-name=domain.asia&years=1&ns=ns1.domain.com&ns=ns2.domain.com&customer-id=8989245®-contact-id=25052632&admin-contact-id=25052632&tech-contact-id=25052632&billing-contact-id=25052632&invoice-option=NoInvoice&protect-privacy=true"
|
209
|
+
Domain.register("domain-name" => "domain.asia", "years" => "1", "ns" => ["ns1.domain.com", "ns2.domain.com"], "customer_id" => "8989245", "reg-contact-id" => "25052632", "admin-contact-id" => "25052632", "tech-contact-id" => "25052632", "billing-contact-id" => "25052632", "invoice-option" => "NoInvoice", "protect-privacy" => "true", :test_mock => true).should be_eql_url(org_url)
|
210
|
+
end
|
211
|
+
|
212
|
+
it "should generate a correct url for register a .COM IDN" do
|
213
|
+
org_url = "https://test.httpapi.com/api/domains/register.json?auth-userid=123456&auth-password=myresellerpass&domain-name=ѯҋ112.com&years=1&ns=ns1.domain.com&ns=ns2.domain.com&customer-id=8989245®-contact-id=25052632&admin-contact-id=25052632&tech-contact-id=25052632&billing-contact-id=25052632&invoice-option=NoInvoice&protect-privacy=true&attr-name1=idnLanguageCode&attr-value1=aze"
|
214
|
+
Domain.register("domain-name" => "ѯҋ112.com", "years" => "1", "ns" => ["ns1.domain.com", "ns2.domain.com"], "customer_id" => "8989245", "reg-contact-id" => "25052632", "admin-contact-id" => "25052632", "tech-contact-id" => "25052632", "billing-contact-id" => "25052632", "invoice-option" => "NoInvoice", "protect-privacy" => "true", "attr-name1" => "idnLanguageCode", "attr-value1" => "aze", :test_mock => true).should be_eql_url(org_url)
|
215
|
+
end
|
216
|
+
|
217
|
+
it "should generate a correct url for register a AU Domain" do
|
218
|
+
org_url = "https://test.httpapi.com/api/domains/register.json?auth-userid=123456&auth-password=myresellerpass&domain-name=domain.net.au&years=1&ns=ns1.domain.com&ns=ns2.domain.com&customer-id=8989245®-contact-id=25052632&admin-contact-id=25052632&tech-contact-id=25052632&billing-contact-id=25052632&invoice-option=NoInvoice&protect-privacy=true&attr-name1=id-type&attr-value1=ACN&attr-name2=id&attr-value2=079 009 340&attr-name3=policyReason&attr-value3=1&attr-name4=isAUWarranty&attr-value4=true"
|
219
|
+
Domain.register("domain-name" => "domain.net.au", "years" => "1", "ns" => ["ns1.domain.com", "ns2.domain.com"], "customer_id" => "8989245", "reg-contact-id" => "25052632", "admin-contact-id" => "25052632", "tech-contact-id" => "25052632", "billing-contact-id" => "25052632", "invoice-option" => "NoInvoice", "protect-privacy" => "true", "attr-name1" => "id-type", "attr-value1" => "ACN", "attr-name2" => "id", "attr-value2" => "079 009 340", "attr-name3" => "policyReason", "attr-value3" => "1", "attr-name4" => "isAUWarranty", "attr-value4" => "true", :test_mock => true).should be_eql_url(org_url)
|
220
|
+
end
|
221
|
+
|
222
|
+
|
223
|
+
it "should generate a correct url for validate_transfer" do
|
224
|
+
org_url = "https://test.httpapi.com/api/domains/validate-transfer.json?auth-userid=123456&auth-password=myresellerpass&domain-name=google.com"
|
225
|
+
Domain.validate_transfer("domain_name" => "google.com", :test_mock => true).should be_eql_url(org_url)
|
226
|
+
end
|
227
|
+
|
228
|
+
it "should generate a correct url for transfer" do
|
229
|
+
org_url = "https://test.httpapi.com/api/domains/transfer.json?auth-userid=123456&auth-password=myresellerpass&domain-name=newdomain.asia&auth-code=auth-code&ns=ns1.domain.com&ns=ns2.domain.com&customer-id=3265463®-contact-id=5243658&admin-contact-id=63532223&tech-contact-id=67543261&billing-contact-id=42165314&invoice-option=KeepInvoice&protect-privacy=false&attr-name1=cedcontactid&attr-value1=0"
|
230
|
+
Domain.transfer("domain-name" => "newdomain.asia", "auth-code" => "auth-code", "ns" => ["ns1.domain.com", "ns2.domain.com"], "customer-id" => "3265463", "reg-contact-id" => "5243658", "admin-contact-id" => "63532223", "tech-contact-id" => "67543261", "billing-contact-id" => "42165314", "invoice-option" => "KeepInvoice", "protect-privacy" => "false", "attr-name1" => "cedcontactid", "attr-value1" => "0", :test_mock => true).should be_eql_url(org_url)
|
231
|
+
end
|
232
|
+
|
233
|
+
# it "should generate a correct url for transfer_eu" do
|
234
|
+
# org_url = ""
|
235
|
+
# Domain.transfer_eu("domain-name" => "myeudomain.eu", "customer-id" => "6463465", "invoice-option" => "NoInvoice", "ns" => ["ns1.domain.org", "ns2.domain.org"], "cns1" => "ns1.domain.eu", "ip1" => "0.0.0.0,1.1.1.1", "cns2" => "ns2.domain.eu", "ip2" => "0.0.0.0,1.1.1.1").should be_eql_url(org_url)
|
236
|
+
# end
|
237
|
+
|
238
|
+
# it "should generate a correct url for trade" do
|
239
|
+
# org_url = ""
|
240
|
+
# Domain.trade("domain-name" => "domain.eu", "customer-id" => "53142", "invoice-option" => "NoInvoice", "ns" => ["ns1.domain.org", "ns2.domain.org"], "cns1" => "ns1.domain.eu", "ip1" => "0.0.0.0,1.1.1.1", "cns2" => "ns2.domain.eu", "ip2" => "0.0.0.0,1.1.1.1", "reg-contact-id" => "0").should be_eql_url(org_url)
|
241
|
+
# end
|
242
|
+
|
243
|
+
it "should generate a correct url for renew" do
|
244
|
+
org_url = "https://test.httpapi.com/api/domains/renew.json?auth-userid=123456&auth-password=myresellerpass&order-id=46983636&years=1&exp-date=1353825293&invoice-option=NoInvoice"
|
245
|
+
Domain.renew("order-id" => "46983636", "years" => "1", "exp-date" => "1353825293", "invoice-option" => "NoInvoice", :test_mock => true).should be_eql_url(org_url)
|
246
|
+
end
|
247
|
+
|
248
|
+
it "should generate a correct url for search" do
|
249
|
+
org_url = "https://test.httpapi.com/api/domains/search.json?auth-userid=123456&auth-password=myresellerpass&no-of-records=10&page-no=1&domain-name=registrants.com"
|
250
|
+
Domain.search("domain-name" => "registrants.com", :test_mock => true).should be_eql_url(org_url)
|
251
|
+
end
|
252
|
+
|
253
|
+
it "should generate a correct url for customer_default_ns" do
|
254
|
+
org_url = "https://test.httpapi.com/api/domains/customer-default-ns.json?auth-userid=123456&auth-password=myresellerpass&customer-id=111"
|
255
|
+
Domain.customer_default_ns("customer_id" => "111", :test_mock => true).should be_eql_url(org_url)
|
256
|
+
end
|
257
|
+
|
258
|
+
it "should generate a correct url for orderid" do
|
259
|
+
org_url = "https://test.httpapi.com/api/domains/orderid.json?auth-userid=123456&auth-password=myresellerpass&domain-name=domain.com"
|
260
|
+
Domain.orderid("domain-name" => "domain.com", :test_mock => true).should be_eql_url(org_url)
|
261
|
+
end
|
262
|
+
|
263
|
+
it "should generate a correct url for details" do
|
264
|
+
org_url = "https://test.httpapi.com/api/domains/details.json?auth-userid=123456&auth-password=myresellerpass&order-id=300&options=OrderDetails"
|
265
|
+
Domain.details("order-id" => "300", "options" => "OrderDetails", :test_mock => true).should be_eql_url(org_url)
|
266
|
+
end
|
267
|
+
|
268
|
+
it "should generate a correct url for modify_ns" do
|
269
|
+
org_url = "https://test.httpapi.com/api/domains/modify-ns.json?auth-userid=123456&auth-password=myresellerpass&order-id=111&ns=ns1.domain.asia&ns=ns2.domain.asia"
|
270
|
+
Domain.modify_ns("order-id" => "111", "ns" => ["ns1.domain.asia", "ns2.domain.asia"], :test_mock => true).should be_eql_url(org_url)
|
271
|
+
end
|
272
|
+
|
273
|
+
it "should generate a correct url for add_cns" do
|
274
|
+
org_url = "https://test.httpapi.com/api/domains/add-cns.json?auth-userid=123456&auth-password=myresellerpass&order-id=111&cns=ns1.domain.com&ip=0.0.0.0&ip=1.1.1.1"
|
275
|
+
Domain.add_cns("order-id" => "111", "cns" => "ns1.domain.com", "ip" => ["0.0.0.0", "1.1.1.1"], :test_mock => true).should be_eql_url(org_url)
|
276
|
+
end
|
277
|
+
|
278
|
+
it "should generate a correct url for modify_cns_name" do
|
279
|
+
org_url = "https://test.httpapi.com/api/domains/modify-cns-name.json?auth-userid=123456&auth-password=myresellerpass&order-id=555&old-cns=ns1.domain.com&new-cns=ns2.domain.com"
|
280
|
+
Domain.modify_cns_name("order-id" => "555", "old-cns" => "ns1.domain.com", "new-cns" => "ns2.domain.com", :test_mock => true).should be_eql_url(org_url)
|
281
|
+
end
|
282
|
+
|
283
|
+
it "should generate a correct url for modify_cns_ip" do
|
284
|
+
org_url = "https://test.httpapi.com/api/domains/modify-cns-ip.json?auth-userid=123456&auth-password=myresellerpass&order-id=777&cns=ns1.domain.com&old-ip=0.0.0.0&new-ip=1.1.1.1"
|
285
|
+
Domain.modify_cns_ip("order-id" => "777", "cns" => "ns1.domain.com", "old-ip" => "0.0.0.0", "new-ip" => "1.1.1.1", :test_mock => true).should be_eql_url(org_url)
|
286
|
+
end
|
287
|
+
|
288
|
+
it "should generate a correct url for enable_theft_protection" do
|
289
|
+
org_url = "https://test.httpapi.com/api/domains/enable-theft-protection.json?auth-userid=123456&auth-password=myresellerpass&order-id=51"
|
290
|
+
Domain.enable_theft_protection("order-id" => "51", :test_mock => true).should be_eql_url(org_url)
|
291
|
+
end
|
292
|
+
|
293
|
+
it "should generate a correct url for delete_cns_ip" do
|
294
|
+
org_url = "https://test.httpapi.com/api/domains/delete-cns-ip.json?auth-userid=123456&auth-password=myresellerpass&order-id=531&cns=ns1.domain.asia&ip=1.2.3.4"
|
295
|
+
Domain.delete_cns_ip("order-id" => "531", "cns" => "ns1.domain.asia", "ip" => "1.2.3.4", :test_mock => true).should be_eql_url(org_url)
|
296
|
+
end
|
297
|
+
|
298
|
+
it "should generate a correct url for modify_contact" do
|
299
|
+
org_url = "https://test.httpapi.com/api/domains/modify-contact.json?auth-userid=123456&auth-password=myresellerpass&order-id=753®-contact-id=1645316&admin-contact-id=53146&tech-contact-id=8361166&billing-contact-id=6146"
|
300
|
+
Domain.modify_contact("order-id" => "753", "reg-contact-id" => "1645316", "admin-contact-id" => "53146", "tech-contact-id" => "8361166", "billing-contact-id" => "6146", :test_mock => true).should be_eql_url(org_url)
|
301
|
+
end
|
302
|
+
|
303
|
+
it "should generate a correct url for modify_privacy_protection" do
|
304
|
+
org_url = "https://test.httpapi.com/api/domains/modify-privacy-protection.json?auth-userid=123456&auth-password=myresellerpass&order-id=42323&protect-privacy=true&reason=somereason"
|
305
|
+
Domain.modify_privacy_protection("order-id" => "42323", "protect-privacy" => "true", "reason" => "somereason", :test_mock => true).should be_eql_url(org_url)
|
306
|
+
end
|
307
|
+
|
308
|
+
it "should generate a correct url for modify_auth_code" do
|
309
|
+
org_url = "https://test.httpapi.com/api/domains/modify-auth-code.json?auth-userid=123456&auth-password=myresellerpass&order-id=564&auth-code=authcode"
|
310
|
+
Domain.modify_auth_code("order-id" => "564", "auth-code" => "authcode", :test_mock => true).should be_eql_url(org_url)
|
311
|
+
end
|
312
|
+
|
313
|
+
it "should generate a correct url for disable_theft_protection" do
|
314
|
+
org_url = "https://test.httpapi.com/api/domains/disable-theft-protection.json?auth-userid=123456&auth-password=myresellerpass&order-id=53"
|
315
|
+
Domain.disable_theft_protection("order-id" => "53", :test_mock => true).should be_eql_url(org_url)
|
316
|
+
end
|
317
|
+
|
318
|
+
it "should generate a correct url for locks" do
|
319
|
+
org_url = "https://test.httpapi.com/api/domains/locks.json?auth-userid=123456&auth-password=myresellerpass&order-id=65"
|
320
|
+
Domain.locks("order-id" => "65", :test_mock => true).should be_eql_url(org_url)
|
321
|
+
end
|
322
|
+
|
323
|
+
it "should generate a correct url for tel_cth_details" do
|
324
|
+
org_url = "https://test.httpapi.com/api/domains/tel/cth-details.json?auth-userid=123456&auth-password=myresellerpass&order-id=65"
|
325
|
+
Domain.tel_cth_details("order-id" => "65", :test_mock => true).should be_eql_url(org_url)
|
326
|
+
end
|
327
|
+
|
328
|
+
it "should generate a correct url for tel_modify_whois_pref" do
|
329
|
+
org_url = "https://test.httpapi.com/api/domains/tel/modify-whois-pref.json?auth-userid=123456&auth-password=myresellerpass&order-id=573&whois-type=Legal&publish=y"
|
330
|
+
Domain.tel_modify_whois_pref("order-id" => "573", "whois-type" => "Legal", "publish" => "y", :test_mock => true).should be_eql_url(org_url)
|
331
|
+
end
|
332
|
+
|
333
|
+
it "should generate a correct url for resend_rfa" do
|
334
|
+
org_url = "https://test.httpapi.com/api/domains/resend-rfa.json?auth-userid=123456&auth-password=myresellerpass&order-id=65"
|
335
|
+
Domain.resend_rfa("order-id" => "65", :test_mock => true).should be_eql_url(org_url)
|
336
|
+
end
|
337
|
+
|
338
|
+
it "should generate a correct url for uk_release" do
|
339
|
+
org_url = "https://test.httpapi.com/api/domains/uk/release.json?auth-userid=123456&auth-password=myresellerpass&order-id=5357&new-tag=newregistrartag"
|
340
|
+
Domain.uk_release("order-id" => "5357", "new-tag" => "newregistrartag", :test_mock => true).should be_eql_url(org_url)
|
341
|
+
end
|
342
|
+
|
343
|
+
it "should generate a correct url for cancel_transfer" do
|
344
|
+
org_url = "https://test.httpapi.com/api/domains/cancel-transfer.json?auth-userid=123456&auth-password=myresellerpass&order-id=536"
|
345
|
+
Domain.cancel_transfer("order-id" => "536", :test_mock => true).should be_eql_url(org_url)
|
346
|
+
end
|
347
|
+
|
348
|
+
it "should generate a correct url for delete" do
|
349
|
+
org_url = "https://test.httpapi.com/api/domains/delete.json?auth-userid=123456&auth-password=myresellerpass&order-id=536"
|
350
|
+
Domain.delete("order-id" => "536", :test_mock => true).should be_eql_url(org_url)
|
351
|
+
end
|
352
|
+
|
353
|
+
it "should generate a correct url for restore" do
|
354
|
+
org_url = "https://test.httpapi.com/api/domains/restore.json?auth-userid=123456&auth-password=myresellerpass&order-id=560&invoice-option=KeepInvoice"
|
355
|
+
Domain.restore("order-id" => "560", "invoice-option" => "KeepInvoice", :test_mock => true).should be_eql_url(org_url)
|
356
|
+
end
|
357
|
+
|
358
|
+
it "should generate a correct url for de_recheck_ns" do
|
359
|
+
org_url = "https://test.httpapi.com/api/domains/de/recheck-ns.json?auth-userid=123456&auth-password=myresellerpass&order-id=568"
|
360
|
+
Domain.de_recheck_ns("order-id" => "568", :test_mock => true).should be_eql_url(org_url)
|
361
|
+
end
|
362
|
+
|
363
|
+
it "should generate a correct url for dotxxx_association_details" do
|
364
|
+
org_url = "https://test.httpapi.com/api/domains/dotxxx/association-details.json?auth-userid=123456&auth-password=myresellerpass&order-id=123&association-id=123"
|
365
|
+
Domain.dotxxx_association_details("order-id" => "123", "association-id" => "123", :test_mock => true).should be_eql_url(org_url)
|
366
|
+
end
|
367
|
+
|
368
|
+
end
|
369
|
+
|
370
|
+
context "Testing Order Model" do
|
371
|
+
|
372
|
+
before(:all) do
|
373
|
+
ResellerClub::authentication("123456", "myresellerpass")
|
374
|
+
end
|
375
|
+
|
376
|
+
it "should generate a correct url for suspend" do
|
377
|
+
org_url = "https://test.httpapi.com/api/orders/suspend.json?auth-userid=123456&auth-password=myresellerpass&order-id=31&reason=reason-for-suspension"
|
378
|
+
Order.suspend("order-id" => "31", "reason" => "reason-for-suspension", :test_mock => true).should be_eql_url(org_url)
|
379
|
+
end
|
380
|
+
|
381
|
+
it "should generate a correct url for unsuspend" do
|
382
|
+
org_url = "https://test.httpapi.com/api/orders/unsuspend.json?auth-userid=123456&auth-password=myresellerpass&order-id=31"
|
383
|
+
Order.unsuspend("order-id" => "31", :test_mock => true).should be_eql_url(org_url)
|
384
|
+
end
|
385
|
+
|
386
|
+
end
|
387
|
+
|
388
|
+
# context "Testing Reseller Model" do
|
389
|
+
|
390
|
+
# before(:all) do
|
391
|
+
# ResellerClub::authentication("123456", "myresellerpass")
|
392
|
+
# end
|
393
|
+
|
394
|
+
# it "should generate a correct url for add" do
|
395
|
+
# org_url = ""
|
396
|
+
# Reseller.signup("username" => "thomas@reseller.com","passwd" => "shoemaker","name" => "Thomas", "address_line_1" => "5ft avenue #253", "company" => "Reseller Inc.", "city" => "NYC", "state" => "NY", "country" => "CU", "zipcode" => "12345655", "phone_cc" => "011", "phone" => "531531","accounting_currency_symbol" => "USD", "selling_currency_symbol" => "USD", "sales_contact_id" => "531", :test_mock => true).should be_eql_url(org_url)
|
397
|
+
# end
|
398
|
+
|
399
|
+
# it "should generate a correct url for update" do
|
400
|
+
# org_url = ""
|
401
|
+
# Reseller.modify("username" => "sergei@google.com","passwd" => "brin", "name" => "Serguei Brin","address_line_1" => "Silicon Valley #53", "company" => "Google Inc.", "city" => "Silicon Valley", "state" => "California", "country" => "US", "zipcode" => "123456", "phone_cc" => "531", "phone" => "531531","reseller_id"=> "433154", "accounting_currency_symbol" => "USD", "selling_currency_symbol" => "USD", "website_url" => "http://www.google.com").should be_eql_url(org_url)
|
402
|
+
# end
|
403
|
+
|
404
|
+
# it "should generate a correct url for get_details" do
|
405
|
+
# org_url = ""
|
406
|
+
# Reseller.get_details("433154").should be_eql_url(org_url)
|
407
|
+
# end
|
408
|
+
|
409
|
+
# it "should generate a correct url for generate_password" do
|
410
|
+
# org_url = ""
|
411
|
+
# Reseller.generate_password("433154").should be_eql_url(org_url)
|
412
|
+
# end
|
413
|
+
|
414
|
+
# it "should generate a correct url for search" do
|
415
|
+
# org_url = ""
|
416
|
+
# Reseller.search("name" => "Tyler").should be_eql_url(org_url)
|
417
|
+
# end
|
418
|
+
|
419
|
+
# it "should generate a correct url for generate_token" do
|
420
|
+
# org_url = ""
|
421
|
+
# Reseller.generate_token("auth_userid" => "433154", "auth_password" => "lV6UAIxi", "ip" => "69.63.139.34").should be_eql_url(org_url)
|
422
|
+
# end
|
423
|
+
|
424
|
+
# it "should generate a correct url for authenticate_token" do
|
425
|
+
# org_url = ""
|
426
|
+
# Reseller.authenticate_token("auth_userid" => "433154", "auth_password" => "lV6UAIxi", "token" => "token").should be_eql_url(org_url)
|
427
|
+
# end
|
428
|
+
|
429
|
+
# it "should generate a correct url for promo_prices" do
|
430
|
+
# org_url = ""
|
431
|
+
# Reseller.promo_prices("auth_userid" => "433154", "auth_password" => "lV6UAIxi").should be_eql_url(org_url)
|
432
|
+
# end
|
433
|
+
# end
|
434
|
+
|
435
|
+
end
|
metadata
ADDED
@@ -0,0 +1,97 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: resellerclub
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Damian Rodriguez
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-11-21 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: typhoeus
|
16
|
+
requirement: &76186690 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 0.3.3
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *76186690
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: json
|
27
|
+
requirement: &76186430 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
type: :runtime
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *76186430
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: rspec
|
38
|
+
requirement: &76186190 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: 2.11.0
|
44
|
+
type: :runtime
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: *76186190
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: rspec-expectations
|
49
|
+
requirement: &76185920 !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 2.11.3
|
55
|
+
type: :runtime
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: *76185920
|
58
|
+
description: A gem that implements the sections Customer, Reseller, Contact and Domain
|
59
|
+
from ResellerClub
|
60
|
+
email: damian@speedyrails.com
|
61
|
+
executables: []
|
62
|
+
extensions: []
|
63
|
+
extra_rdoc_files: []
|
64
|
+
files:
|
65
|
+
- lib/resellerclub.rb
|
66
|
+
- lib/mixin.rb
|
67
|
+
- spec/basic_spec.rb
|
68
|
+
- lib/models/contact.rb
|
69
|
+
- lib/models/customer.rb
|
70
|
+
- lib/models/reseller.rb
|
71
|
+
- lib/models/domain.rb
|
72
|
+
- lib/models/order.rb
|
73
|
+
homepage:
|
74
|
+
licenses: []
|
75
|
+
post_install_message:
|
76
|
+
rdoc_options: []
|
77
|
+
require_paths:
|
78
|
+
- lib
|
79
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
80
|
+
none: false
|
81
|
+
requirements:
|
82
|
+
- - ! '>='
|
83
|
+
- !ruby/object:Gem::Version
|
84
|
+
version: '0'
|
85
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
86
|
+
none: false
|
87
|
+
requirements:
|
88
|
+
- - ! '>='
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: '0'
|
91
|
+
requirements: []
|
92
|
+
rubyforge_project:
|
93
|
+
rubygems_version: 1.8.11
|
94
|
+
signing_key:
|
95
|
+
specification_version: 3
|
96
|
+
summary: A gem that implements partially ResellerClub API
|
97
|
+
test_files: []
|