lumberg 1.1.1 → 2.0.0.pre3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (175) hide show
  1. checksums.yaml +7 -0
  2. data/.travis.yml +1 -6
  3. data/README.md +130 -23
  4. data/lib/lumberg.rb +2 -0
  5. data/lib/lumberg/cpanel.rb +29 -0
  6. data/lib/lumberg/cpanel/addon_domain.rb +50 -0
  7. data/lib/lumberg/cpanel/backups.rb +16 -0
  8. data/lib/lumberg/cpanel/base.rb +56 -0
  9. data/lib/lumberg/cpanel/box_trapper.rb +18 -0
  10. data/lib/lumberg/cpanel/branding.rb +89 -0
  11. data/lib/lumberg/cpanel/contact.rb +38 -0
  12. data/lib/lumberg/cpanel/cron.rb +89 -0
  13. data/lib/lumberg/cpanel/dns_lookup.rb +23 -0
  14. data/lib/lumberg/cpanel/domain_keys.rb +37 -0
  15. data/lib/lumberg/cpanel/domain_lookup.rb +71 -0
  16. data/lib/lumberg/cpanel/email.rb +491 -0
  17. data/lib/lumberg/cpanel/file_manager.rb +146 -0
  18. data/lib/lumberg/cpanel/gpg.rb +36 -0
  19. data/lib/lumberg/cpanel/locale.rb +15 -0
  20. data/lib/lumberg/cpanel/mime.rb +34 -0
  21. data/lib/lumberg/cpanel/mysql.rb +66 -0
  22. data/lib/lumberg/cpanel/net.rb +28 -0
  23. data/lib/lumberg/cpanel/park.rb +58 -0
  24. data/lib/lumberg/cpanel/password.rb +52 -0
  25. data/lib/lumberg/cpanel/random_data.rb +25 -0
  26. data/lib/lumberg/cpanel/redirect.rb +44 -0
  27. data/lib/lumberg/cpanel/ssl.rb +198 -0
  28. data/lib/lumberg/cpanel/sub_domain.rb +61 -0
  29. data/lib/lumberg/cpanel/support.rb +29 -0
  30. data/lib/lumberg/cpanel/zone_edit.rb +134 -0
  31. data/lib/lumberg/format_whm.rb +24 -1
  32. data/lib/lumberg/version.rb +1 -1
  33. data/lib/lumberg/whm.rb +2 -1
  34. data/lib/lumberg/whm/account.rb +4 -4
  35. data/lib/lumberg/whm/cert.rb +69 -0
  36. data/lib/lumberg/whm/dns.rb +28 -4
  37. data/lib/lumberg/whm/reseller.rb +4 -4
  38. data/lib/lumberg/whm/server.rb +64 -15
  39. data/lumberg.gemspec +4 -3
  40. data/spec/config_spec.rb +2 -2
  41. data/spec/cpanel/addon_domain_spec.rb +84 -0
  42. data/spec/cpanel/backups_spec.rb +22 -0
  43. data/spec/cpanel/base_spec.rb +128 -0
  44. data/spec/cpanel/box_trapper_spec.rb +22 -0
  45. data/spec/cpanel/branding_spec.rb +46 -0
  46. data/spec/cpanel/contact_spec.rb +50 -0
  47. data/spec/cpanel/cron_spec.rb +161 -0
  48. data/spec/cpanel/dns_lookup_spec.rb +22 -0
  49. data/spec/cpanel/domain_keys_spec.rb +46 -0
  50. data/spec/cpanel/domain_lookup_spec.rb +77 -0
  51. data/spec/cpanel/email_spec.rb +615 -0
  52. data/spec/cpanel/file_manager_spec.rb +73 -0
  53. data/spec/cpanel/gpg_spec.rb +48 -0
  54. data/spec/cpanel/locale_spec.rb +23 -0
  55. data/spec/cpanel/mime_spec.rb +0 -0
  56. data/spec/cpanel/mysql_spec.rb +0 -0
  57. data/spec/cpanel/net_spec.rb +30 -0
  58. data/spec/cpanel/park_spec.rb +94 -0
  59. data/spec/cpanel/password_spec.rb +35 -0
  60. data/spec/cpanel/random_data_spec.rb +24 -0
  61. data/spec/cpanel/redirect_spec.rb +0 -0
  62. data/spec/cpanel/ssl_spec.rb +138 -0
  63. data/spec/cpanel/sub_domain_spec.rb +72 -0
  64. data/spec/cpanel/support_spec.rb +38 -0
  65. data/spec/cpanel/zone_edit_spec.rb +0 -0
  66. data/spec/sample_certs/cpanel.crt +28 -0
  67. data/spec/sample_certs/cpanel.key +28 -0
  68. data/spec/sample_certs/main.crt +27 -0
  69. data/spec/sample_certs/sample.crt +26 -0
  70. data/spec/sample_certs/sample.key +27 -0
  71. data/spec/spec_helper.rb +7 -1
  72. data/spec/support/cpanel_matchers.rb +17 -0
  73. data/spec/vcr_cassettes/cpanel/addon_domain/add.yml +77 -0
  74. data/spec/vcr_cassettes/cpanel/addon_domain/list.yml +77 -0
  75. data/spec/vcr_cassettes/cpanel/addon_domain/remove.yml +77 -0
  76. data/spec/vcr_cassettes/cpanel/backups/list.yml +40 -0
  77. data/spec/vcr_cassettes/cpanel/box_trapper/list.yml +40 -0
  78. data/spec/vcr_cassettes/cpanel/branding/list_icons.yml +40 -0
  79. data/spec/vcr_cassettes/cpanel/branding/list_image_types.yml +40 -0
  80. data/spec/vcr_cassettes/cpanel/branding/list_object_types.yml +40 -0
  81. data/spec/vcr_cassettes/cpanel/branding/list_pkgs.yml +40 -0
  82. data/spec/vcr_cassettes/cpanel/branding/list_sprites.yml +40 -0
  83. data/spec/vcr_cassettes/cpanel/contact/show.yml +40 -0
  84. data/spec/vcr_cassettes/cpanel/contact/update.yml +40 -0
  85. data/spec/vcr_cassettes/cpanel/cron/add.yml +77 -0
  86. data/spec/vcr_cassettes/cpanel/cron/edit.yml +114 -0
  87. data/spec/vcr_cassettes/cpanel/cron/email.yml +77 -0
  88. data/spec/vcr_cassettes/cpanel/cron/list.yml +77 -0
  89. data/spec/vcr_cassettes/cpanel/cron/remove.yml +151 -0
  90. data/spec/vcr_cassettes/cpanel/cron/set_email.yml +77 -0
  91. data/spec/vcr_cassettes/cpanel/dns_lookup/name_to_ip.yml +40 -0
  92. data/spec/vcr_cassettes/cpanel/domain_keys/add.yml +40 -0
  93. data/spec/vcr_cassettes/cpanel/domain_keys/available.yml +40 -0
  94. data/spec/vcr_cassettes/cpanel/domain_keys/installed.yml +40 -0
  95. data/spec/vcr_cassettes/cpanel/domain_keys/remove.yml +40 -0
  96. data/spec/vcr_cassettes/cpanel/domain_lookup/count.yml +40 -0
  97. data/spec/vcr_cassettes/cpanel/domain_lookup/docroot.yml +40 -0
  98. data/spec/vcr_cassettes/cpanel/domain_lookup/docroots.yml +40 -0
  99. data/spec/vcr_cassettes/cpanel/domain_lookup/document_root.yml +40 -0
  100. data/spec/vcr_cassettes/cpanel/domain_lookup/document_roots.yml +40 -0
  101. data/spec/vcr_cassettes/cpanel/domain_lookup/list.yml +40 -0
  102. data/spec/vcr_cassettes/cpanel/email/acceptable_encodings.yml +40 -0
  103. data/spec/vcr_cassettes/cpanel/email/accounts.yml +188 -0
  104. data/spec/vcr_cassettes/cpanel/email/add_account.yml +77 -0
  105. data/spec/vcr_cassettes/cpanel/email/add_filter.yml +77 -0
  106. data/spec/vcr_cassettes/cpanel/email/add_forwarder.yml +77 -0
  107. data/spec/vcr_cassettes/cpanel/email/add_mailing_list.yml +73 -0
  108. data/spec/vcr_cassettes/cpanel/email/add_mx.yml +40 -0
  109. data/spec/vcr_cassettes/cpanel/email/change_mx.yml +40 -0
  110. data/spec/vcr_cassettes/cpanel/email/check_local_delivery_local.yml +77 -0
  111. data/spec/vcr_cassettes/cpanel/email/check_local_delivery_remote.yml +77 -0
  112. data/spec/vcr_cassettes/cpanel/email/default_address.yml +40 -0
  113. data/spec/vcr_cassettes/cpanel/email/delete_mx.yml +40 -0
  114. data/spec/vcr_cassettes/cpanel/email/disk_usage.yml +77 -0
  115. data/spec/vcr_cassettes/cpanel/email/domains.yml +40 -0
  116. data/spec/vcr_cassettes/cpanel/email/domains_with_aliases.yml +77 -0
  117. data/spec/vcr_cassettes/cpanel/email/edit_quota.yml +112 -0
  118. data/spec/vcr_cassettes/cpanel/email/filters.yml +114 -0
  119. data/spec/vcr_cassettes/cpanel/email/forwarders.yml +77 -0
  120. data/spec/vcr_cassettes/cpanel/email/mail_dir.yml +77 -0
  121. data/spec/vcr_cassettes/cpanel/email/mail_dirs.yml +77 -0
  122. data/spec/vcr_cassettes/cpanel/email/mailing_lists.yml +73 -0
  123. data/spec/vcr_cassettes/cpanel/email/main_discard.yml +40 -0
  124. data/spec/vcr_cassettes/cpanel/email/mx.yml +40 -0
  125. data/spec/vcr_cassettes/cpanel/email/remove.yml +77 -0
  126. data/spec/vcr_cassettes/cpanel/email/set_mail_delivery_local.yml +77 -0
  127. data/spec/vcr_cassettes/cpanel/email/set_mail_delivery_remote.yml +77 -0
  128. data/spec/vcr_cassettes/cpanel/email/set_mx_type.yml +40 -0
  129. data/spec/vcr_cassettes/cpanel/file_manager/disk_usage.yml +38 -0
  130. data/spec/vcr_cassettes/cpanel/file_manager/list.yml +38 -0
  131. data/spec/vcr_cassettes/cpanel/file_manager/operate.yml +77 -0
  132. data/spec/vcr_cassettes/cpanel/file_manager/show.yml +40 -0
  133. data/spec/vcr_cassettes/cpanel/file_manager/stat.yml +38 -0
  134. data/spec/vcr_cassettes/cpanel/gpg/count.yml +40 -0
  135. data/spec/vcr_cassettes/cpanel/gpg/count_private.yml +40 -0
  136. data/spec/vcr_cassettes/cpanel/gpg/list.yml +40 -0
  137. data/spec/vcr_cassettes/cpanel/gpg/list_private.yml +40 -0
  138. data/spec/vcr_cassettes/cpanel/locale/show.yml +40 -0
  139. data/spec/vcr_cassettes/cpanel/net/query_hostname.yml +40 -0
  140. data/spec/vcr_cassettes/cpanel/net/traceroute.yml +40 -0
  141. data/spec/vcr_cassettes/cpanel/park/add.yml +77 -0
  142. data/spec/vcr_cassettes/cpanel/park/list.yml +77 -0
  143. data/spec/vcr_cassettes/cpanel/park/list_addon_domains.yml +77 -0
  144. data/spec/vcr_cassettes/cpanel/park/remove.yml +77 -0
  145. data/spec/vcr_cassettes/cpanel/password/digest_authentication.yml +77 -0
  146. data/spec/vcr_cassettes/cpanel/password/modify.yml +77 -0
  147. data/spec/vcr_cassettes/cpanel/random_data/show.yml +40 -0
  148. data/spec/vcr_cassettes/cpanel/ssl/fetchcabundle.yml +40 -0
  149. data/spec/vcr_cassettes/cpanel/ssl/gencrt.yml +40 -0
  150. data/spec/vcr_cassettes/cpanel/ssl/gencsr.yml +40 -0
  151. data/spec/vcr_cassettes/cpanel/ssl/genkey.yml +40 -0
  152. data/spec/vcr_cassettes/cpanel/ssl/installssl.yml +40 -0
  153. data/spec/vcr_cassettes/cpanel/ssl/listcrts.yml +40 -0
  154. data/spec/vcr_cassettes/cpanel/ssl/listcsrs.yml +40 -0
  155. data/spec/vcr_cassettes/cpanel/ssl/listkeys.yml +40 -0
  156. data/spec/vcr_cassettes/cpanel/ssl/listsslitems.yml +40 -0
  157. data/spec/vcr_cassettes/cpanel/ssl/showcrt.yml +38 -0
  158. data/spec/vcr_cassettes/cpanel/ssl/showcsr.yml +38 -0
  159. data/spec/vcr_cassettes/cpanel/ssl/showkey.yml +38 -0
  160. data/spec/vcr_cassettes/cpanel/ssl/uploadcrt.yml +40 -0
  161. data/spec/vcr_cassettes/cpanel/sub_domain/add.yml +77 -0
  162. data/spec/vcr_cassettes/cpanel/sub_domain/list.yml +77 -0
  163. data/spec/vcr_cassettes/cpanel/sub_domain/remove.yml +77 -0
  164. data/spec/vcr_cassettes/cpanel/support/contactable.yml +40 -0
  165. data/spec/vcr_cassettes/whm/cert/fetchsslinfo.yml +38 -0
  166. data/spec/vcr_cassettes/whm/cert/generatessl.yml +38 -0
  167. data/spec/vcr_cassettes/whm/cert/installssl.yml +38 -0
  168. data/spec/vcr_cassettes/whm/cert/listcrts.yml +38 -0
  169. data/spec/vcr_cassettes/whm/server/gettweaksetting.yml +44 -0
  170. data/spec/vcr_cassettes/whm/server/settweaksetting.yml +44 -0
  171. data/spec/vcr_cassettes/whm/server/themes.yml +38 -0
  172. data/spec/whm/cert_spec.rb +62 -0
  173. data/spec/whm/server_spec.rb +79 -3
  174. metadata +376 -34
  175. data/.rvmrc +0 -49
@@ -0,0 +1,44 @@
1
+ module Lumberg
2
+ module Cpanel
3
+ # Public: Allows users to create and manage redirects
4
+ class Redirect < Base
5
+ def self.api_module; "Mime"; end
6
+
7
+ # Public: List redirects parsed from your various .htaccess files in
8
+ # human-readable form
9
+ #
10
+ # options - Hash options for API call params (default: {})
11
+ # :regex - String value to filter results by applying perl regurlar
12
+ # expressions to the "sourceurl" output key, and accepts a
13
+ # simple string also (default: '')
14
+ #
15
+ # Returns Hash API response
16
+ def list(options = {})
17
+ perform_request({ :api_function => 'listredirects' }.merge(options))
18
+ end
19
+
20
+ # Public: This function returns either the domain name entered or '** All
21
+ # Public Domains **'.
22
+ #
23
+ # options - Hash options for API call params (default: {})
24
+ # :domain - String value. If a domain name is entered, it will be
25
+ # returned. If this is set to '.*', '** All Public Domains **'
26
+ # will be returned. (default: '')
27
+ # :url - String value. If a url is entered, it will be returned. If this
28
+ # is set to '.*' or '(.*)', '** All Requests **' will be
29
+ # returned (default: '')
30
+ #
31
+ # Returns Hash API response
32
+ def show(options = {})
33
+ if options[:domain] && options[:url]
34
+ raise ArgumentError,
35
+ "#{self.class.name}##{__method__} cannot accept both `:url` and `:domain`"
36
+ end
37
+ function = options[:domain].present? ? 'redirectname' : 'redirecturlname'
38
+ perform_request({ :api_function => function }.merge(options))
39
+ end
40
+ end
41
+ end
42
+ end
43
+
44
+
@@ -0,0 +1,198 @@
1
+ module Lumberg
2
+ module Cpanel
3
+ class Ssl < Base
4
+ def self.api_module; "SSL"; end
5
+
6
+ # Public: Install an SSL certificate, key, and cabundle.
7
+ #
8
+ # options - Hash options for API call params (default: {}):
9
+ # :cabundle - Contents of the CA bundle file (optional)
10
+ # :crt - Contents of the certificate file
11
+ # :domain - Domain name for the cert (optional)
12
+ # :key - Contents of the key file associated with the CSR
13
+ # :subject - String subject line.
14
+ #
15
+ # Returns Hash API response.
16
+ def installssl(options = {})
17
+ perform_request({
18
+ :api_function => "installssl"
19
+ }.merge(options))
20
+ end
21
+
22
+ # Public: List CSRs associated with your cPanel account.
23
+ #
24
+ # options - Hash options for API call params (default: {}):
25
+ #
26
+ # Returns Hash API response.
27
+ def listcsrs(options = {})
28
+ perform_request({
29
+ :api_function => "listcsrs",
30
+ }.merge(options))
31
+ end
32
+
33
+ # Public: Print a specific Certificate Signing Request.
34
+ #
35
+ # options - Hash options for API call params (default: {}):
36
+ # :domain - The name of the domain the CSR was generated for.
37
+ # :textmode - 0 for human readable, 1 for binary.
38
+ #
39
+ # Returns Hash API response.
40
+ def showcsr(options = {})
41
+ perform_request({
42
+ :api_function => "showcsr",
43
+ :api_version => 1,
44
+ :user => options[:user],
45
+ :response_key => "data",
46
+ "arg-0" => options[:domain],
47
+ "arg-1" => options[:textmode]
48
+ })
49
+ end
50
+
51
+ # Public: Print a key that has already been generated.
52
+ #
53
+ # options - Hash options for API call params (default: {}):
54
+ # :domain - The name of the domain the CSR was generated for.
55
+ # :textmode - 0 for human readable, 1 for binary.
56
+ #
57
+ # Returns Hash API response.
58
+ def showkey(options = {})
59
+ perform_request({
60
+ :api_function => "showkey",
61
+ :api_version => 1,
62
+ :user => options[:user],
63
+ :response_key => "data",
64
+ "arg-0" => options[:domain],
65
+ "arg-1" => options[:textmode]
66
+ })
67
+ end
68
+
69
+ # Public: Print the current cert for a specific host.
70
+ #
71
+ # options - Hash options for API call params (default: {}):
72
+ #
73
+ # Returns Hash API response.
74
+ def showcrt(options = {})
75
+ perform_request({
76
+ :api_function => "showcrt",
77
+ :api_version => 1,
78
+ :user => options[:user],
79
+ :response_key => "data",
80
+ "arg-0" => options[:domain],
81
+ "arg-1" => options[:textmode]
82
+ })
83
+ end
84
+
85
+ # Public: List SSL certificates currently installed for a cPanel account.
86
+ #
87
+ # options - Hash options for API call params (default: {}):
88
+ #
89
+ # Returns Hash API response.
90
+ def listcrts(options = {})
91
+ perform_request({
92
+ :api_function => "listcrts",
93
+ }.merge(options))
94
+ end
95
+
96
+ # Public: List SSL keys associated with a domain.
97
+ #
98
+ # options - Hash options for API call params (default: {}):
99
+ #
100
+ # Returns Hash API response.
101
+ def listkeys(options = {})
102
+ perform_request({
103
+ :api_function => "listkeys",
104
+ }.merge(options))
105
+ end
106
+
107
+ # Public: Fetch the cabundle that corresponds to the certificate
108
+ #
109
+ # options - Hash options for API call params (default: {}):
110
+ # :crt - Contents of the certificate file
111
+ #
112
+ # Returns Hash API response.
113
+ def fetchcabundle(options = {})
114
+ perform_request({
115
+ :api_function => "fetchcabundle",
116
+ }.merge(options))
117
+ end
118
+
119
+ # Public: Query for SSL related items installed via cPanel
120
+ #
121
+ # options - Hash options for API call params (default: {}):
122
+ # :domains - The domains you wish to query.
123
+ # :items - The type of SSL items for which you wish to query.
124
+ # Acceptable values include 'key', 'crt', and 'csr'.
125
+ #
126
+ # Returns Hash API response.
127
+ def listsslitems(options = {})
128
+ perform_request({
129
+ :api_function => "listsslitems",
130
+ }.merge(options))
131
+ end
132
+
133
+ # Public: Generate a certificate signing request.
134
+ #
135
+ # options - Hash options for API call params (default: {}):
136
+ # :city - The city in which your server resides.
137
+ # :company - The name of the company.
138
+ # :companydivision - The division of your company.
139
+ # :country - A two letter abbreviation for the country.
140
+ # :email - A valid email address that will correspond to the csr.
141
+ # :host - The domain that corresponds to the csr.
142
+ # :state - A two letter abbreviation that corresponds to the state.
143
+ # :password - The password of the csr.
144
+ #
145
+ # Returns Hash API response.
146
+ def gencsr(options = {})
147
+ perform_request({
148
+ :api_function => "gencsr",
149
+ :response_key => "cpanelresult",
150
+ }.merge(options))
151
+ end
152
+
153
+ # Public: Generate a self-signed SSL certificate for a specific domain.
154
+ #
155
+ # options - Hash options for API call params (default: {}):
156
+ # :city - The city in which your server resides.
157
+ # :company - The name of the company.
158
+ # :companydivision - The division of your company.
159
+ # :country - A two letter abbreviation for the country.
160
+ # :email - A valid email address that will correspond to the csr.
161
+ # :host - The domain that corresponds to the csr.
162
+ # :state - A two letter abbreviation that corresponds to the state.
163
+ #
164
+ # Returns Hash API response.
165
+ def gencrt(options = {})
166
+ perform_request({
167
+ :api_function => "gencrt",
168
+ }.merge(options))
169
+ end
170
+
171
+ # Public: Generate an SSL key. You must have access to the 'sslmanager'.
172
+ #
173
+ # options - Hash options for API call params (default: {}):
174
+ # :host - The domain that corresponds to the csr.
175
+ # :keysize - The size of the key
176
+ # Optional, may range from 1024 to 4096.
177
+ #
178
+ # Returns Hash API response.
179
+ def genkey(options = {})
180
+ perform_request({
181
+ :api_function => "genkey",
182
+ }.merge(options))
183
+ end
184
+
185
+ # Public: Upload an SSL certificate.
186
+ #
187
+ # options - Hash options for API call params (default: {}):
188
+ # :crt - Contents of the SSL certificate
189
+ #
190
+ # Returns Hash API response.
191
+ def uploadcrt(options = {})
192
+ perform_request({
193
+ :api_function => "uploadcrt",
194
+ }.merge(options))
195
+ end
196
+ end
197
+ end
198
+ end
@@ -0,0 +1,61 @@
1
+ module Lumberg
2
+ module Cpanel
3
+ class SubDomain < Base
4
+ # Public: Add a subdomain.
5
+ #
6
+ # options - Hash options for API call params (default: {}):
7
+ # :domain - String local part of the subdomain to add.
8
+ # "sub" if "sub.domain.com".
9
+ # :rootdomain - String domain on which to add the subdomain.
10
+ # :dir - String docroot for subdomain (optional, default:
11
+ # "public_html/[:domain value]")
12
+ # :disallowdot - String value (optional). Set to "1" to strip "."
13
+ # chars from specified :domain value.
14
+ #
15
+ # Returns Hash API response.
16
+ def add(options = {})
17
+ perform_request({
18
+ :api_function => "addsubdomain"
19
+ }.merge(options))
20
+ end
21
+
22
+ # Public: Remove a subdomain.
23
+ #
24
+ # options - Hash options for API call params (default: {}):
25
+ # :domain - String subdomain to delete.
26
+ #
27
+ # Returns Hash API response.
28
+ def remove(options = {})
29
+ perform_request({
30
+ :api_function => "delsubdomain"
31
+ }.merge(options))
32
+ end
33
+
34
+ # Public: Get list of subdomains.
35
+ #
36
+ # options - Hash options for API call params (default: {}):
37
+ # :regex - String regular expression to filter results (optional).
38
+ #
39
+ # Returns Hash API response.
40
+ def list(options = {})
41
+ perform_request({
42
+ :api_function => "listsubdomains"
43
+ }.merge(options))
44
+ end
45
+
46
+ # Public: Modify the document root of a subdomain
47
+ #
48
+ # options - Hash options for API call params (default: {}):
49
+ # :dir - String docroot to which you want to move the subdomain
50
+ # :subdomain - String subdomain whose docroot you want to modify
51
+ # :rootdomain - String domain on which to modify the subdomain
52
+ #
53
+ # Returns Hash API response
54
+ def modify(options = {})
55
+ perform_request({
56
+ :api_function => "changedocroot"
57
+ }.merge(options))
58
+ end
59
+ end
60
+ end
61
+ end
@@ -0,0 +1,29 @@
1
+ module Lumberg
2
+ module Cpanel
3
+ class Support < Base
4
+ def self.api_module; "Contactus"; end
5
+
6
+ # Public: Send a support request.
7
+ #
8
+ # options - Hash options for API call params (default: {}):
9
+ # :email - String destination email address.
10
+ # :issue - String brief explantation of issue (body text).
11
+ # :subject - String subject line.
12
+ #
13
+ # Returns Hash API response.
14
+ def open_ticket(options = {})
15
+ perform_request({
16
+ :api_function => "sendcontact"
17
+ }.merge(options))
18
+ end
19
+
20
+ # Public: Check if you can open a support ticket, or if you are able to
21
+ # contact your hosting provider through Cpanel
22
+ #
23
+ # Returns Hash API response
24
+ def contactable
25
+ perform_request({ :api_function => "isenabled" })
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,134 @@
1
+ module Lumberg
2
+ module Cpanel
3
+ # Public: This module allows users to modify their domains
4
+ class ZoneEdit < Base
5
+ # Public: Retrieve a list of your account's zones and zone file contents.
6
+ #
7
+ # Returns Hash API Response
8
+ def list
9
+ perform_request({ :api_function => 'fetchzones' })
10
+ end
11
+
12
+ # Public: Add an A, CNAME, or TXT record to a zone file, specified by
13
+ # line number
14
+ #
15
+ # options - Hash options for API call params (default: {})
16
+ # :domain - String addon domain for which yo wish to add an entry
17
+ # :name - String name of the record, aka subdomain
18
+ # :type - String type of the record you wish to add to the zone file.
19
+ # Acceptable values include A, CNAME or TXT
20
+ # :txt - String text you wish to contain in your TXT record. Required
21
+ # parameter when you specify "TXT" in the :type parameter
22
+ # (default: '')
23
+ # :cname - String required parameter when you specify CNAME in the
24
+ # :type parameter (default: '')
25
+ # :address - String ip address to map to the subdomain. (default: '')
26
+ # :ttl - Integer time to live in seconds (default: 0)
27
+ # :class - String class to be used for the record. Ordinarily this
28
+ # parameter is not required (default: '')
29
+ #
30
+ # Returns Hash API response.
31
+ def create(options = {})
32
+ options[:txtdata] = options.delete(:txt)
33
+ perform_request({ :api_function => 'add_zone_record' }.merge(options))
34
+ end
35
+
36
+ # Public: Show dns zone for a domain
37
+ #
38
+ # options - Hash options for API call params (default: {})
39
+ # :domain - String domain that corresponds to the zone file you wish to
40
+ # show
41
+ # :get_custom_entries - Boolean parameter. Entering a value of "1" will
42
+ # cause the function to return only non-essential
43
+ # A and CNAME records. These will include www.*,
44
+ # ftp.*, mail.* and localhost.* (default: '')
45
+ # :keys - String parameter that may contain a serie of values, all of
46
+ # which act the same way. Each value searches the data
47
+ # structure, like a grep, for a single hash (line of the zone
48
+ # file). Acceptable values include: line, ttl, name, class,
49
+ # address, type, txtdata, preference and exchange.
50
+ #
51
+ # Returns Hash API response.
52
+ def show(options = {})
53
+ options[:customonly] = options.delete(:get_custom_entries)
54
+ perform_request({ :api_function => 'fetchzone' }.merge(options))
55
+ end
56
+
57
+ # Public: Revert a zone file to its original state.
58
+ #
59
+ # options - Hash options for API call params (default: {})
60
+ # :domain - String domain that corresponds to the zone file you wish to
61
+ # revert
62
+ #
63
+ # Returns Hash API response
64
+ def reset(options = {})
65
+ perform_request({ :api_function => 'resetzone' })
66
+ end
67
+
68
+ # Public: Edit an A, CNAME, or TXT record in a zone file, specified by
69
+ # line number. This function works nicely with "show" method to easily
70
+ # fetch line number and record information.
71
+ #
72
+ # options - Hash options for API call params (default: {})
73
+ # :domain - String domain that corresponds to the zone you wish to edit
74
+ # :line - Integer line number of the zone file you wish to edit
75
+ # :type - The type fo record you wish to add to the zone file.
76
+ # Acceptable values include A, CNAME or TXT. Each type of
77
+ # record requires a specific parameter
78
+ # :txt - String text you wish to contain in your TXT record. Required
79
+ # parameter when you specify "TXT" in the :type parameter
80
+ # (default: '')
81
+ # :cname - String required parameter when you specify CNAME in the
82
+ # :type parameter (default: '')
83
+ # :address - String ip address to map to the subdomain. (default: '')
84
+ # :ttl - Integer time to live in seconds (default: 0)
85
+ # :class - String class to be used for the record. Ordinarily this
86
+ # parameter is not required (default: '')
87
+ #
88
+ # Returns Hash API response.
89
+ def edit(options = {})
90
+ options[:Line] = options.delete(:line)
91
+ options[:txtdata] = options.delete(:txt)
92
+ perform_request({ :api_function => 'edit_zone_record' }.merge(options))
93
+ end
94
+
95
+ # Public: Remove lines from a DNS zone file. You may only remove A, TXT,
96
+ # and CNAME records with this function.
97
+ #
98
+ # options - Hash options for API call params (default: {})
99
+ # :domain - String domain that corresponds to the zone you wish to
100
+ # remove a line
101
+ # :line - Integer line number of the zone file you wish to remove. Use
102
+ # "show" method to obtain the line number of a record
103
+ #
104
+ # Returns Hash API response.
105
+ def remove(options = {})
106
+ perform_request({ :api_function => 'remove_zone_record' }.merge(options))
107
+ end
108
+
109
+ # Public: Retrieve a list of domains, created within cPanel, associated
110
+ # with your cPanel account.
111
+ #
112
+ # options - Hash options for API call params (default: {})
113
+ # :domain - String domain parameter which allows you to append one
114
+ # domain name to the end of the resulting output
115
+ # (default: '')
116
+ #
117
+ # Returns Hash API response.
118
+ def show_domains(options = {})
119
+ perform_request({ :api_function => 'fetch_cpanel_generated_domains' })
120
+ end
121
+
122
+ # Public: Retrieve a list of zone modifications for a specific domain.
123
+ #
124
+ # options - Hash options for API call params (default: {})
125
+ # :domain - String domain whose zone modifications you wish to view
126
+ #
127
+ # Returns Hash API response.
128
+ def modifications_for(options = {})
129
+ perform_request({ :api_function => 'fetchzone_records' }.merge(options))
130
+ end
131
+ end
132
+ end
133
+ end
134
+