ovh_soapi 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/Manifest ADDED
@@ -0,0 +1,11 @@
1
+ Manifest
2
+ README.md
3
+ Rakefile
4
+ lib/ovh_soapi.rb
5
+ lib/ovh_soapi/domains.rb
6
+ lib/ovh_soapi/nic.rb
7
+ lib/ovh_soapi/order.rb
8
+ lib/ovh_soapi/reseller.rb
9
+ lib/ovh_soapi/session.rb
10
+ ovh_soapi.gemspec
11
+ pkg/ovh_soapi-0.0.1.alpha.gem
data/README.md ADDED
@@ -0,0 +1,4 @@
1
+ OVH Soapi Ruby Client
2
+ ====
3
+
4
+ This project is in a pre-aplha stage. Please test before use.
data/Rakefile ADDED
@@ -0,0 +1,14 @@
1
+ require "rubygems"
2
+ require "rake"
3
+ require "echoe"
4
+
5
+ Echoe.new("ovh_soapi", "0.0.2") do |p|
6
+ p.description = "Ruby client for OVH Soapi."
7
+ p.url = "http://www.freshco.it"
8
+ p.author = "Dumitru Ceban"
9
+ p.email = "awstin.at@gmail.com"
10
+ p.ignore_pattern = ["tmp/*", "script/*"]
11
+ p.development_dependencies = []
12
+ end
13
+
14
+ Dir["#{File.dirname(__FILE__)}/tasks/*.rake"].sort.each { |ext| load ext }
@@ -0,0 +1,67 @@
1
+ module OvhSoapi
2
+ class Domains
3
+ module Methods
4
+ attr_accessor :domain
5
+
6
+ # Set object domain.
7
+ def set_domain(domain)
8
+ self.domain = domain
9
+ end
10
+
11
+
12
+ # Add a dns zone entry.
13
+ def zone_entry_add(subdomain, fieldtype, target, overwrite)
14
+ RpcDriver.soapi.zoneEntryAdd(Session.session, self.domain, subdomain, fieldtype, target, overwrite)
15
+ end
16
+
17
+ # Delete a dns zone entry.
18
+ def zone_entry_del(subdomain, fieldtype, target)
19
+ RpcDriver.soapi.zoneEntryDel(Session.session, self.domain, subdomain, fieldtype, target)
20
+ end
21
+
22
+ # Retrieve dns zone entries list.
23
+ def zone_entry_list
24
+ RpcDriver.soapi.zoneEntryList(Session.session, self.domain)
25
+ end
26
+
27
+ # Modify a dns zone entry.
28
+ def zone_entry_modify(subdomain, fieldtype, target, newTarget)
29
+ RpcDriver.soapi.zoneEntryModify(Session.session, self.domain, subdomain, fieldtype, target, newTarget)
30
+ end
31
+
32
+
33
+ # Check domain availability.
34
+ def domain_check
35
+ RpcDriver.soapi.domainCheck(Session.session, self.domain)
36
+ end
37
+
38
+ # Retrieve the list of nameservers for a domain.
39
+ def domain_dns_list
40
+ RpcDriver.soapi.domainDnsList(Session.session, self.domain)
41
+ end
42
+
43
+ # Set DNS for a domain.
44
+ def domain_dns_update(dns_ip)
45
+ RpcDriver.soapi.domainDnsUpdate(Session.session, self.domain,
46
+ dns_ip[:dns1], dns_ip[:ip1], dns_ip[:dns2], dns_ip[:ip2],
47
+ dns_ip[:dns3], dns_ip[:ip3], dns_ip[:dns3], dns_ip[:ip3],
48
+ dns_ip[:dns5], dns_ip[:ip5]
49
+ )
50
+ end
51
+
52
+ # Add an domain ORT
53
+ def ort_domain_add(subdomain,target,type,overwrite)
54
+ RpcDriver.soapi.ortDomainAdd(Session.session, self.domain,subdomain,target,type,overwrite)
55
+ end
56
+
57
+ # Get all informations about a domain name
58
+ def domain_info
59
+ RpcDriver.soapi.domainInfo(Session.session, self.domain)
60
+ end
61
+
62
+ end
63
+ include Methods
64
+ extend Methods
65
+ end
66
+
67
+ end
@@ -0,0 +1,61 @@
1
+ module OvhSoapi
2
+ class Nic
3
+ module Methods
4
+
5
+ # Create a new contact handle.
6
+ def create(nic_data)
7
+ RpcDriver.soapi.nicCreate(
8
+ Session.session,
9
+ nic_data[:name], nic_data[:firstname], nic_data[:password], nic_data[:email],
10
+ nic_data[:phone], nic_data[:fax], nic_data[:address], nic_data[:city],
11
+ nic_data[:area], nic_data[:zip], nic_data[:country], nic_data[:language],
12
+ nic_data[:isOwner], nic_data[:legalform], nic_data[:organisation],
13
+ nic_data[:legalName], nic_data[:legalNumber], nic_data[:vat]
14
+ )
15
+ end
16
+
17
+ # Create a new Italian contact handle.
18
+ def create_it(nic_data)
19
+ RpcDriver.soapi.nicCreateIT(
20
+ Session.session,
21
+ nic_data[:name], nic_data[:firstname], nic_data[:password], nic_data[:email],
22
+ nic_data[:phone], nic_data[:fax], nic_data[:address], nic_data[:city],
23
+ nic_data[:area], nic_data[:zip], nic_data[:country], nic_data[:language],
24
+ nic_data[:isOwner], nic_data[:legalform], nic_data[:organisation],
25
+ nic_data[:legalName], nic_data[:legalNumber], nic_data[:vat],nic_data[:birthDay],
26
+ nic_data[:birthCity], nic_data[:nationalIdentificationNumber], nic_data[:companyNationalIdentificationNumber],
27
+ nic_data[:corporationType]
28
+ )
29
+ end
30
+
31
+ # Modify a contact handle infos.
32
+ def update(nic_data)
33
+ RpcDriver.soapi.nicUpdate(
34
+ Session.session,
35
+ nic_data[:nic], nic_data[:name], nic_data[:firstname], nic_data[:legalForm], nic_data[:organisation],
36
+ nic_data[:legalName], nic_data[:legalNumber], nic_data[:vat]
37
+ )
38
+ end
39
+
40
+ # Retrieve nic infos.
41
+ def info(nic_handle)
42
+ RpcDriver.soapi.nicInfo(Session.session,nic_handle)
43
+ end
44
+
45
+ # Modify your nic infos.
46
+ def modify_infos(nic_data)
47
+ RpcDriver.soapi.nicModifyInfos(
48
+ Session.session,
49
+ nic_data[:name], nic_data[:firstname], nic_data[:legalForm], nic_data[:organisation],
50
+ nic_data[:address], nic_data[:zip], nic_data[:city], nic_data[:country], nic_data[:phone],
51
+ nic_data[:fax], nic_data[:email], nic_data[:spareEmails], nic_data[:language], nic_data[:vat]
52
+ )
53
+ end
54
+
55
+
56
+ end
57
+ include Methods
58
+ extend Methods
59
+ end
60
+
61
+ end
@@ -0,0 +1,15 @@
1
+ module OvhSoapi
2
+ class Order
3
+ module Methods
4
+
5
+ # Order email MX Plan.
6
+ def email_mx_plan(domain, type, payWithPoints)
7
+ RpcDriver.soapi.orderEmailMxPlan(Session.session, domain, type, payWithPoints)
8
+ end
9
+
10
+ end
11
+ include Methods
12
+ extend Methods
13
+ end
14
+
15
+ end
@@ -0,0 +1,41 @@
1
+ module OvhSoapi
2
+ class Reseller
3
+ module Methods
4
+
5
+ # Create a domain using your loyalty/reseller account.
6
+ def domain_create(domain_data)
7
+ RpcDriver.soapi.resellerDomainCreate(Session.session,
8
+ domain_data[:domain], domain_data[:hosting], domain_data[:offer], domain_data[:profile],
9
+ domain_data[:owo], domain_data[:owner], domain_data[:admin], domain_data[:tech],
10
+ domain_data[:billing], domain_data[:dns1], domain_data[:dns2], domain_data[:dns3],
11
+ domain_data[:dns4], domain_data[:dns5], domain_data[:method],
12
+ domain_data[:legalName], domain_data[:legalNumber], domain_data[:afnicIdent],
13
+ domain_data[:birthDate], domain_data[:birthCity], domain_data[:birthDepartement],
14
+ domain_data[:birthCountry], OVH_SANDBOX
15
+ )
16
+ end
17
+
18
+ # Renew a domain using your loyalty/reseller account.
19
+ def domain_renew(domain)
20
+ RpcDriver.soapi.resellerDomainRenew(Session.session, domain, OVH_SANDBOX)
21
+ end
22
+
23
+ # Transfer a domain using your loyalty/reseller account.
24
+ def domain_transfer(domain_data)
25
+ RpcDriver.soapi.resellerDomainTransfer(Session.session,
26
+ domain_data[:domain], domain_data[:authinfo], domain_data[:hosting], domain_data[:offer], domain_data[:profile],
27
+ domain_data[:owo], domain_data[:owner], domain_data[:admin], domain_data[:tech],
28
+ domain_data[:billing], domain_data[:dns1], domain_data[:dns2], domain_data[:dns3],
29
+ domain_data[:dns4], domain_data[:dns5], domain_data[:method],
30
+ domain_data[:legalName], domain_data[:legalNumber], domain_data[:afnicIdent],
31
+ domain_data[:birthDate], domain_data[:birthCity], domain_data[:birthDepartement],
32
+ domain_data[:birthCountry], OVH_SANDBOX
33
+ )
34
+ end
35
+
36
+ end
37
+ include Methods
38
+ extend Methods
39
+ end
40
+
41
+ end
@@ -0,0 +1,30 @@
1
+ module OvhSoapi
2
+ class Session
3
+ module Methods
4
+ #attr_accessor :session
5
+
6
+ def session
7
+ @session
8
+ end
9
+
10
+ # Create a session.
11
+ def login(nic, password, language = "en", multisession = true)
12
+ @session = RpcDriver.soapi.login(nic, password, language, multisession)
13
+ end
14
+
15
+ # Kill a session.
16
+ def logout
17
+ RpcDriver.soapi.logout(self.session)
18
+ end
19
+
20
+ # Get session nic.
21
+ def nic
22
+ RpcDriver.soapi.nic(self.session)
23
+ end
24
+
25
+ end
26
+ include Methods
27
+ extend Methods
28
+ end
29
+
30
+ end
data/lib/ovh_soapi.rb ADDED
@@ -0,0 +1,36 @@
1
+ require 'soap/wsdlDriver'
2
+ require 'ovh_soapi/domains'
3
+ require 'ovh_soapi/nic'
4
+ require 'ovh_soapi/order'
5
+ require 'ovh_soapi/reseller'
6
+ require 'ovh_soapi/session'
7
+
8
+ # OVH Soapi sandbox flag
9
+ OVH_SANDBOX = false;
10
+
11
+ module OvhSoapi
12
+
13
+
14
+ class RpcDriver
15
+
16
+ # Create soapi object
17
+ def self.soapi
18
+ @soapi ||= SOAP::WSDLDriverFactory.new('https://www.ovh.com/soapi/soapi-re-1.11.wsdl').create_rpc_driver
19
+ end
20
+
21
+ end
22
+
23
+
24
+ # Get rid of SSL warning
25
+ # "warning: peer certificate won't be verified in this SSL session"
26
+ class Net::HTTP
27
+ alias_method :old_initialize, :initialize
28
+
29
+ def initialize(*args)
30
+ old_initialize(*args)
31
+ @ssl_context = OpenSSL::SSL::SSLContext.new
32
+ @ssl_context.verify_mode = OpenSSL::SSL::VERIFY_NONE
33
+ end
34
+
35
+ end
36
+ end
data/ovh_soapi.gemspec ADDED
@@ -0,0 +1,30 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = %q{ovh_soapi}
5
+ s.version = "0.0.2"
6
+
7
+ s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
+ s.authors = ["Dumitru Ceban"]
9
+ s.date = %q{2010-07-27}
10
+ s.description = %q{Ruby client for OVH Soapi.}
11
+ s.email = %q{awstin.at@gmail.com}
12
+ s.extra_rdoc_files = ["README.md", "lib/ovh_soapi.rb", "lib/ovh_soapi/domains.rb", "lib/ovh_soapi/nic.rb", "lib/ovh_soapi/order.rb", "lib/ovh_soapi/reseller.rb", "lib/ovh_soapi/session.rb"]
13
+ s.files = ["Manifest", "README.md", "Rakefile", "lib/ovh_soapi.rb", "lib/ovh_soapi/domains.rb", "lib/ovh_soapi/nic.rb", "lib/ovh_soapi/order.rb", "lib/ovh_soapi/reseller.rb", "lib/ovh_soapi/session.rb", "ovh_soapi.gemspec", "pkg/ovh_soapi-0.0.1.alpha.gem"]
14
+ s.homepage = %q{http://www.freshco.it}
15
+ s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Ovh_soapi", "--main", "README.md"]
16
+ s.require_paths = ["lib"]
17
+ s.rubyforge_project = %q{ovh_soapi}
18
+ s.rubygems_version = %q{1.3.7}
19
+ s.summary = %q{Ruby client for OVH Soapi.}
20
+
21
+ if s.respond_to? :specification_version then
22
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
23
+ s.specification_version = 3
24
+
25
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
26
+ else
27
+ end
28
+ else
29
+ end
30
+ end
Binary file
metadata ADDED
@@ -0,0 +1,89 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ovh_soapi
3
+ version: !ruby/object:Gem::Version
4
+ hash: 27
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 2
10
+ version: 0.0.2
11
+ platform: ruby
12
+ authors:
13
+ - Dumitru Ceban
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2010-07-27 00:00:00 +02:00
19
+ default_executable:
20
+ dependencies: []
21
+
22
+ description: Ruby client for OVH Soapi.
23
+ email: awstin.at@gmail.com
24
+ executables: []
25
+
26
+ extensions: []
27
+
28
+ extra_rdoc_files:
29
+ - README.md
30
+ - lib/ovh_soapi.rb
31
+ - lib/ovh_soapi/domains.rb
32
+ - lib/ovh_soapi/nic.rb
33
+ - lib/ovh_soapi/order.rb
34
+ - lib/ovh_soapi/reseller.rb
35
+ - lib/ovh_soapi/session.rb
36
+ files:
37
+ - Manifest
38
+ - README.md
39
+ - Rakefile
40
+ - lib/ovh_soapi.rb
41
+ - lib/ovh_soapi/domains.rb
42
+ - lib/ovh_soapi/nic.rb
43
+ - lib/ovh_soapi/order.rb
44
+ - lib/ovh_soapi/reseller.rb
45
+ - lib/ovh_soapi/session.rb
46
+ - ovh_soapi.gemspec
47
+ - pkg/ovh_soapi-0.0.1.alpha.gem
48
+ has_rdoc: true
49
+ homepage: http://www.freshco.it
50
+ licenses: []
51
+
52
+ post_install_message:
53
+ rdoc_options:
54
+ - --line-numbers
55
+ - --inline-source
56
+ - --title
57
+ - Ovh_soapi
58
+ - --main
59
+ - README.md
60
+ require_paths:
61
+ - lib
62
+ required_ruby_version: !ruby/object:Gem::Requirement
63
+ none: false
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ hash: 3
68
+ segments:
69
+ - 0
70
+ version: "0"
71
+ required_rubygems_version: !ruby/object:Gem::Requirement
72
+ none: false
73
+ requirements:
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
76
+ hash: 11
77
+ segments:
78
+ - 1
79
+ - 2
80
+ version: "1.2"
81
+ requirements: []
82
+
83
+ rubyforge_project: ovh_soapi
84
+ rubygems_version: 1.3.7
85
+ signing_key:
86
+ specification_version: 3
87
+ summary: Ruby client for OVH Soapi.
88
+ test_files: []
89
+