lumberg 1.0.1 → 2.0.0.pre4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (248) hide show
  1. checksums.yaml +7 -0
  2. data/.travis.yml +8 -7
  3. data/LICENSE +1 -1
  4. data/README.md +130 -23
  5. data/Rakefile +3 -1
  6. data/lib/lumberg/config.rb +19 -0
  7. data/lib/lumberg/cpanel/addon_domain.rb +50 -0
  8. data/lib/lumberg/cpanel/backups.rb +16 -0
  9. data/lib/lumberg/cpanel/base.rb +56 -0
  10. data/lib/lumberg/cpanel/box_trapper.rb +18 -0
  11. data/lib/lumberg/cpanel/branding.rb +89 -0
  12. data/lib/lumberg/cpanel/contact.rb +38 -0
  13. data/lib/lumberg/cpanel/cron.rb +89 -0
  14. data/lib/lumberg/cpanel/dns_lookup.rb +23 -0
  15. data/lib/lumberg/cpanel/domain_keys.rb +37 -0
  16. data/lib/lumberg/cpanel/domain_lookup.rb +71 -0
  17. data/lib/lumberg/cpanel/email.rb +491 -0
  18. data/lib/lumberg/cpanel/file_manager.rb +146 -0
  19. data/lib/lumberg/cpanel/gpg.rb +36 -0
  20. data/lib/lumberg/cpanel/locale.rb +15 -0
  21. data/lib/lumberg/cpanel/mime.rb +34 -0
  22. data/lib/lumberg/cpanel/mysql.rb +66 -0
  23. data/lib/lumberg/cpanel/net.rb +28 -0
  24. data/lib/lumberg/cpanel/park.rb +58 -0
  25. data/lib/lumberg/cpanel/password.rb +52 -0
  26. data/lib/lumberg/cpanel/random_data.rb +25 -0
  27. data/lib/lumberg/cpanel/redirect.rb +44 -0
  28. data/lib/lumberg/cpanel/ssl.rb +206 -0
  29. data/lib/lumberg/cpanel/sub_domain.rb +61 -0
  30. data/lib/lumberg/cpanel/support.rb +29 -0
  31. data/lib/lumberg/cpanel/zone_edit.rb +134 -0
  32. data/lib/lumberg/cpanel.rb +29 -0
  33. data/lib/lumberg/format_whm.rb +125 -0
  34. data/lib/lumberg/version.rb +1 -1
  35. data/lib/lumberg/whm/account.rb +28 -105
  36. data/lib/lumberg/whm/base.rb +3 -7
  37. data/lib/lumberg/whm/cert.rb +76 -0
  38. data/lib/lumberg/whm/dns.rb +49 -77
  39. data/lib/lumberg/whm/reseller.rb +24 -117
  40. data/lib/lumberg/whm/server.rb +111 -230
  41. data/lib/lumberg/whm.rb +2 -1
  42. data/lib/lumberg.rb +34 -8
  43. data/lumberg.gemspec +7 -4
  44. data/spec/config_spec.rb +28 -0
  45. data/spec/cpanel/addon_domain_spec.rb +84 -0
  46. data/spec/cpanel/backups_spec.rb +22 -0
  47. data/spec/cpanel/base_spec.rb +128 -0
  48. data/spec/cpanel/box_trapper_spec.rb +22 -0
  49. data/spec/cpanel/branding_spec.rb +46 -0
  50. data/spec/cpanel/contact_spec.rb +50 -0
  51. data/spec/cpanel/cron_spec.rb +161 -0
  52. data/spec/cpanel/dns_lookup_spec.rb +22 -0
  53. data/spec/cpanel/domain_keys_spec.rb +46 -0
  54. data/spec/cpanel/domain_lookup_spec.rb +77 -0
  55. data/spec/cpanel/email_spec.rb +615 -0
  56. data/spec/cpanel/file_manager_spec.rb +73 -0
  57. data/spec/cpanel/gpg_spec.rb +48 -0
  58. data/spec/cpanel/locale_spec.rb +23 -0
  59. data/spec/cpanel/mime_spec.rb +0 -0
  60. data/spec/cpanel/mysql_spec.rb +0 -0
  61. data/spec/cpanel/net_spec.rb +30 -0
  62. data/spec/cpanel/park_spec.rb +94 -0
  63. data/spec/cpanel/password_spec.rb +35 -0
  64. data/spec/cpanel/random_data_spec.rb +24 -0
  65. data/spec/cpanel/redirect_spec.rb +0 -0
  66. data/spec/cpanel/ssl_spec.rb +148 -0
  67. data/spec/cpanel/sub_domain_spec.rb +72 -0
  68. data/spec/cpanel/support_spec.rb +38 -0
  69. data/spec/cpanel/zone_edit_spec.rb +0 -0
  70. data/spec/sample_certs/cpanel.crt +28 -0
  71. data/spec/sample_certs/cpanel.key +28 -0
  72. data/spec/sample_certs/main.crt +27 -0
  73. data/spec/sample_certs/sample.crt +26 -0
  74. data/spec/sample_certs/sample.key +27 -0
  75. data/spec/spec_helper.rb +9 -3
  76. data/spec/support/cpanel_matchers.rb +17 -0
  77. data/spec/vcr_cassettes/cpanel/addon_domain/add.yml +77 -0
  78. data/spec/vcr_cassettes/cpanel/addon_domain/list.yml +77 -0
  79. data/spec/vcr_cassettes/cpanel/addon_domain/remove.yml +77 -0
  80. data/spec/vcr_cassettes/cpanel/backups/list.yml +40 -0
  81. data/spec/vcr_cassettes/cpanel/box_trapper/list.yml +40 -0
  82. data/spec/vcr_cassettes/cpanel/branding/list_icons.yml +40 -0
  83. data/spec/vcr_cassettes/cpanel/branding/list_image_types.yml +40 -0
  84. data/spec/vcr_cassettes/cpanel/branding/list_object_types.yml +40 -0
  85. data/spec/vcr_cassettes/cpanel/branding/list_pkgs.yml +40 -0
  86. data/spec/vcr_cassettes/cpanel/branding/list_sprites.yml +40 -0
  87. data/spec/vcr_cassettes/cpanel/contact/show.yml +40 -0
  88. data/spec/vcr_cassettes/cpanel/contact/update.yml +40 -0
  89. data/spec/vcr_cassettes/cpanel/cron/add.yml +77 -0
  90. data/spec/vcr_cassettes/cpanel/cron/edit.yml +114 -0
  91. data/spec/vcr_cassettes/cpanel/cron/email.yml +77 -0
  92. data/spec/vcr_cassettes/cpanel/cron/list.yml +77 -0
  93. data/spec/vcr_cassettes/cpanel/cron/remove.yml +151 -0
  94. data/spec/vcr_cassettes/cpanel/cron/set_email.yml +77 -0
  95. data/spec/vcr_cassettes/cpanel/dns_lookup/name_to_ip.yml +40 -0
  96. data/spec/vcr_cassettes/cpanel/domain_keys/add.yml +40 -0
  97. data/spec/vcr_cassettes/cpanel/domain_keys/available.yml +40 -0
  98. data/spec/vcr_cassettes/cpanel/domain_keys/installed.yml +40 -0
  99. data/spec/vcr_cassettes/cpanel/domain_keys/remove.yml +40 -0
  100. data/spec/vcr_cassettes/cpanel/domain_lookup/count.yml +40 -0
  101. data/spec/vcr_cassettes/cpanel/domain_lookup/docroot.yml +40 -0
  102. data/spec/vcr_cassettes/cpanel/domain_lookup/docroots.yml +40 -0
  103. data/spec/vcr_cassettes/cpanel/domain_lookup/document_root.yml +40 -0
  104. data/spec/vcr_cassettes/cpanel/domain_lookup/document_roots.yml +40 -0
  105. data/spec/vcr_cassettes/cpanel/domain_lookup/list.yml +40 -0
  106. data/spec/vcr_cassettes/cpanel/email/acceptable_encodings.yml +40 -0
  107. data/spec/vcr_cassettes/cpanel/email/accounts.yml +188 -0
  108. data/spec/vcr_cassettes/cpanel/email/add_account.yml +77 -0
  109. data/spec/vcr_cassettes/cpanel/email/add_filter.yml +77 -0
  110. data/spec/vcr_cassettes/cpanel/email/add_forwarder.yml +77 -0
  111. data/spec/vcr_cassettes/cpanel/email/add_mailing_list.yml +73 -0
  112. data/spec/vcr_cassettes/cpanel/email/add_mx.yml +40 -0
  113. data/spec/vcr_cassettes/cpanel/email/change_mx.yml +40 -0
  114. data/spec/vcr_cassettes/cpanel/email/check_local_delivery_local.yml +77 -0
  115. data/spec/vcr_cassettes/cpanel/email/check_local_delivery_remote.yml +77 -0
  116. data/spec/vcr_cassettes/cpanel/email/default_address.yml +40 -0
  117. data/spec/vcr_cassettes/cpanel/email/delete_mx.yml +40 -0
  118. data/spec/vcr_cassettes/cpanel/email/disk_usage.yml +77 -0
  119. data/spec/vcr_cassettes/cpanel/email/domains.yml +40 -0
  120. data/spec/vcr_cassettes/cpanel/email/domains_with_aliases.yml +77 -0
  121. data/spec/vcr_cassettes/cpanel/email/edit_quota.yml +112 -0
  122. data/spec/vcr_cassettes/cpanel/email/filters.yml +114 -0
  123. data/spec/vcr_cassettes/cpanel/email/forwarders.yml +77 -0
  124. data/spec/vcr_cassettes/cpanel/email/mail_dir.yml +77 -0
  125. data/spec/vcr_cassettes/cpanel/email/mail_dirs.yml +77 -0
  126. data/spec/vcr_cassettes/cpanel/email/mailing_lists.yml +73 -0
  127. data/spec/vcr_cassettes/cpanel/email/main_discard.yml +40 -0
  128. data/spec/vcr_cassettes/cpanel/email/mx.yml +40 -0
  129. data/spec/vcr_cassettes/cpanel/email/remove.yml +77 -0
  130. data/spec/vcr_cassettes/cpanel/email/set_mail_delivery_local.yml +77 -0
  131. data/spec/vcr_cassettes/cpanel/email/set_mail_delivery_remote.yml +77 -0
  132. data/spec/vcr_cassettes/cpanel/email/set_mx_type.yml +40 -0
  133. data/spec/vcr_cassettes/cpanel/file_manager/disk_usage.yml +38 -0
  134. data/spec/vcr_cassettes/cpanel/file_manager/list.yml +38 -0
  135. data/spec/vcr_cassettes/cpanel/file_manager/operate.yml +77 -0
  136. data/spec/vcr_cassettes/cpanel/file_manager/show.yml +40 -0
  137. data/spec/vcr_cassettes/cpanel/file_manager/stat.yml +38 -0
  138. data/spec/vcr_cassettes/cpanel/gpg/count.yml +40 -0
  139. data/spec/vcr_cassettes/cpanel/gpg/count_private.yml +40 -0
  140. data/spec/vcr_cassettes/cpanel/gpg/list.yml +40 -0
  141. data/spec/vcr_cassettes/cpanel/gpg/list_private.yml +40 -0
  142. data/spec/vcr_cassettes/cpanel/locale/show.yml +40 -0
  143. data/spec/vcr_cassettes/cpanel/net/query_hostname.yml +40 -0
  144. data/spec/vcr_cassettes/cpanel/net/traceroute.yml +40 -0
  145. data/spec/vcr_cassettes/cpanel/park/add.yml +77 -0
  146. data/spec/vcr_cassettes/cpanel/park/list.yml +77 -0
  147. data/spec/vcr_cassettes/cpanel/park/list_addon_domains.yml +77 -0
  148. data/spec/vcr_cassettes/cpanel/park/remove.yml +77 -0
  149. data/spec/vcr_cassettes/cpanel/password/digest_authentication.yml +77 -0
  150. data/spec/vcr_cassettes/cpanel/password/modify.yml +77 -0
  151. data/spec/vcr_cassettes/cpanel/random_data/show.yml +40 -0
  152. data/spec/vcr_cassettes/cpanel/ssl/fetchcabundle.yml +40 -0
  153. data/spec/vcr_cassettes/cpanel/ssl/gencrt.yml +43 -0
  154. data/spec/vcr_cassettes/cpanel/ssl/gencsr.yml +43 -0
  155. data/spec/vcr_cassettes/cpanel/ssl/genkey.yml +40 -0
  156. data/spec/vcr_cassettes/cpanel/ssl/installssl.yml +40 -0
  157. data/spec/vcr_cassettes/cpanel/ssl/listcrts.yml +40 -0
  158. data/spec/vcr_cassettes/cpanel/ssl/listcsrs.yml +40 -0
  159. data/spec/vcr_cassettes/cpanel/ssl/listkeys.yml +40 -0
  160. data/spec/vcr_cassettes/cpanel/ssl/listsslitems.yml +40 -0
  161. data/spec/vcr_cassettes/cpanel/ssl/showcrt.yml +38 -0
  162. data/spec/vcr_cassettes/cpanel/ssl/showcsr.yml +38 -0
  163. data/spec/vcr_cassettes/cpanel/ssl/showkey.yml +38 -0
  164. data/spec/vcr_cassettes/cpanel/ssl/uploadcrt.yml +40 -0
  165. data/spec/vcr_cassettes/cpanel/sub_domain/add.yml +77 -0
  166. data/spec/vcr_cassettes/cpanel/sub_domain/list.yml +77 -0
  167. data/spec/vcr_cassettes/cpanel/sub_domain/remove.yml +77 -0
  168. data/spec/vcr_cassettes/cpanel/support/contactable.yml +40 -0
  169. data/spec/vcr_cassettes/whm/account/accountsummary.yml +41 -29
  170. data/spec/vcr_cassettes/whm/account/changepackage.yml +73 -43
  171. data/spec/vcr_cassettes/whm/account/createacct.yml +101 -31
  172. data/spec/vcr_cassettes/whm/account/domainuserdata.yml +43 -29
  173. data/spec/vcr_cassettes/whm/account/editquota.yml +78 -57
  174. data/spec/vcr_cassettes/whm/account/limitbw.yml +79 -57
  175. data/spec/vcr_cassettes/whm/account/listaccts.yml +195 -100
  176. data/spec/vcr_cassettes/whm/account/listsuspended.yml +41 -29
  177. data/spec/vcr_cassettes/whm/account/modifyacct.yml +61 -42
  178. data/spec/vcr_cassettes/whm/account/myprivs.yml +41 -29
  179. data/spec/vcr_cassettes/whm/account/passwd.yml +44 -29
  180. data/spec/vcr_cassettes/whm/account/removeacct.yml +134 -57
  181. data/spec/vcr_cassettes/whm/account/restoreaccount.yml +310 -135
  182. data/spec/vcr_cassettes/whm/account/setsiteip.yml +166 -127
  183. data/spec/vcr_cassettes/whm/account/suspend.yml +75 -43
  184. data/spec/vcr_cassettes/whm/account/unsuspend.yml +46 -29
  185. data/spec/vcr_cassettes/whm/cert/fetchsslinfo.yml +38 -0
  186. data/spec/vcr_cassettes/whm/cert/generatessl.yml +94 -0
  187. data/spec/vcr_cassettes/whm/cert/installssl.yml +38 -0
  188. data/spec/vcr_cassettes/whm/cert/listcrts.yml +38 -0
  189. data/spec/vcr_cassettes/whm/dns/adddns.yml +61 -43
  190. data/spec/vcr_cassettes/whm/dns/addzonerecord.yml +42 -29
  191. data/spec/vcr_cassettes/whm/dns/dumpzone.yml +44 -29
  192. data/spec/vcr_cassettes/whm/dns/editzonerecord.yml +61 -43
  193. data/spec/vcr_cassettes/whm/dns/getzonerecord.yml +60 -43
  194. data/spec/vcr_cassettes/whm/dns/killdns.yml +42 -29
  195. data/spec/vcr_cassettes/whm/dns/listmxs.yml +23 -15
  196. data/spec/vcr_cassettes/whm/dns/listzones.yml +22 -15
  197. data/spec/vcr_cassettes/whm/dns/lookupnsip.yml +40 -29
  198. data/spec/vcr_cassettes/whm/dns/removezonerecord.yml +61 -43
  199. data/spec/vcr_cassettes/whm/dns/resetzone.yml +42 -29
  200. data/spec/vcr_cassettes/whm/dns/resolvedomainname.yml +40 -29
  201. data/spec/vcr_cassettes/whm/dns/savemxs.yml +23 -15
  202. data/spec/vcr_cassettes/whm/reseller/acctcounts.yml +41 -29
  203. data/spec/vcr_cassettes/whm/reseller/listacls.yml +22 -15
  204. data/spec/vcr_cassettes/whm/reseller/listresellers.yml +22 -15
  205. data/spec/vcr_cassettes/whm/reseller/resellerstats.yml +42 -29
  206. data/spec/vcr_cassettes/whm/reseller/saveacllist.yml +76 -57
  207. data/spec/vcr_cassettes/whm/reseller/setacls.yml +40 -29
  208. data/spec/vcr_cassettes/whm/reseller/setresellerips.yml +42 -28
  209. data/spec/vcr_cassettes/whm/reseller/setresellerlimits.yml +41 -29
  210. data/spec/vcr_cassettes/whm/reseller/setresellermainip.yml +59 -43
  211. data/spec/vcr_cassettes/whm/reseller/setresellernameservers.yml +58 -43
  212. data/spec/vcr_cassettes/whm/reseller/setresellerpackagelimit.yml +61 -43
  213. data/spec/vcr_cassettes/whm/reseller/setupreseller.yml +41 -29
  214. data/spec/vcr_cassettes/whm/reseller/suspendreseller.yml +75 -44
  215. data/spec/vcr_cassettes/whm/reseller/terminatereseller.yml +83 -46
  216. data/spec/vcr_cassettes/whm/reseller/unsetupreseller.yml +41 -29
  217. data/spec/vcr_cassettes/whm/reseller/unsuspendreseller.yml +46 -29
  218. data/spec/vcr_cassettes/whm/server/addip.yml +24 -15
  219. data/spec/vcr_cassettes/whm/server/applist.yml +22 -15
  220. data/spec/vcr_cassettes/whm/server/delip.yml +23 -15
  221. data/spec/vcr_cassettes/whm/server/gethostname.yml +22 -15
  222. data/spec/vcr_cassettes/whm/server/getlanglist.yml +22 -15
  223. data/spec/vcr_cassettes/whm/server/gettweaksetting.yml +44 -0
  224. data/spec/vcr_cassettes/whm/server/listips.yml +22 -15
  225. data/spec/vcr_cassettes/whm/server/loadavg.yml +26 -19
  226. data/spec/vcr_cassettes/whm/server/my_function.yml +59 -43
  227. data/spec/vcr_cassettes/whm/server/nvget.yml +22 -15
  228. data/spec/vcr_cassettes/whm/server/nvset.yml +22 -15
  229. data/spec/vcr_cassettes/whm/server/reboot.yml +22 -15
  230. data/spec/vcr_cassettes/whm/server/sethostname.yml +24 -15
  231. data/spec/vcr_cassettes/whm/server/setresolvers.yml +23 -15
  232. data/spec/vcr_cassettes/whm/server/settweaksetting.yml +44 -0
  233. data/spec/vcr_cassettes/whm/server/showbw.yml +22 -15
  234. data/spec/vcr_cassettes/whm/server/systemloadavg.yml +40 -29
  235. data/spec/vcr_cassettes/whm/server/themes.yml +38 -0
  236. data/spec/vcr_cassettes/whm/server/version.yml +22 -15
  237. data/spec/whm/account_spec.rb +40 -199
  238. data/spec/whm/base_spec.rb +0 -4
  239. data/spec/whm/cert_spec.rb +99 -0
  240. data/spec/whm/dns_spec.rb +5 -123
  241. data/spec/whm/reseller_spec.rb +11 -79
  242. data/spec/whm/server_spec.rb +85 -142
  243. metadata +367 -47
  244. data/.rvmrc +0 -49
  245. data/lib/lumberg/whm/args.rb +0 -113
  246. data/lib/net_http_hacked.rb +0 -42
  247. data/spec/vcr_cassettes/whm/server/response_type.yml +0 -85
  248. data/spec/whm/args_spec.rb +0 -179
@@ -0,0 +1,146 @@
1
+ module Lumberg
2
+ module Cpanel
3
+ # Public: This module provides access to file functions such as listing
4
+ # directories and viewing files.
5
+ class FileManager < Base
6
+ def self.api_module; "Fileman"; end
7
+
8
+ # Public: list files and attributes contained within a specified
9
+ # directory
10
+ #
11
+ # options - Hash options for API call params (default: {})
12
+ # :check_leaf - Boolean value of "1" will cause the function to add
13
+ # "isleaf" parameter to the output key, e.g: true value
14
+ # (1) indicates a directory that has no subdirectories
15
+ # (default: '')
16
+ #
17
+ # :directory - String directory that contains the files you wish to
18
+ # browse, and '/' represents your home directory.
19
+ # (default: 'your home directory')
20
+ #
21
+ # :list - A Boolean value of "1" indicates the function to look for
22
+ # keys that begin with "filepath-*". These keys are used to
23
+ # indicate specific files to list (default: '')
24
+ #
25
+ # :path - String parameter allows you to specify files you want listed
26
+ # with the output if :list is set to "1". This can be any
27
+ # number of parameters such as "filelist-A", "filelist-B", etc.
28
+ # Each of these keys indicate a file you wish to view
29
+ # (default:'')
30
+ #
31
+ # :need_mime - A Boolean value of "1" indicates that you would like the
32
+ # function to add the 'mimename' and 'mimetype' to output
33
+ # (default: '')
34
+ #
35
+ #
36
+ # :show_dot_files - A Boolean value of "1" indicates that you'd like
37
+ # the function to add dotfiles to output
38
+ # (default: '')
39
+ #
40
+ # :types - String filter allowing you to specify which file types you
41
+ # wish to view. Acceptable values include "dir", "file" and
42
+ # "special". Separate each type using a pipe (|) to add
43
+ # multiple values. (default: '')
44
+ #
45
+ # Examples
46
+ # api_args = { host: "x.x.x.x", hash: "pass", api_username: "user" }
47
+ # file_manager = Lumberg::Cpanel::FileManager.new(api_args.dup)
48
+ #
49
+ # file_manager.list
50
+ #
51
+ # Returns Hash API response.
52
+ def list(options = {})
53
+ options[:dir] = options.delete(:directory)
54
+ options[:filelist] = options.delete(:list)
55
+ options[:filepath] = options.delete(:path)
56
+ options[:needmime] = options.delete(:need_mime)
57
+ options[:checkleaf] = options.delete(:check_leaf)
58
+ options[:showdotfiles] = options.delete(:show_dot_files)
59
+
60
+ perform_request({ :api_function => 'listfiles' }.merge(options))
61
+ end
62
+
63
+ # Public: View a file within your home directory. This function also
64
+ # display additional information about the file such as the contents of a
65
+ # tarball, a link to an image and more
66
+ #
67
+ # options - Hash options for API call params (default: {})
68
+ # :directory - String directory in which the file is located. Path must
69
+ # be relative to user's home, e.g: 'public_html/files/'
70
+ # (default: '')
71
+ # :file - String path to the file you wish to view
72
+ #
73
+ # Returns Hash API response.
74
+ def show(options = {})
75
+ options[:dir] = options.delete(:directory)
76
+
77
+ perform_request({ :api_function => 'viewfile' }.merge(options))
78
+ end
79
+
80
+ # Public: Retrieve information about specific files
81
+ #
82
+ # options - Hash options for API call params (default: {})
83
+ # :directory - String directory whose files you wish to review, (e.g:
84
+ # /home/user/public_html/files). (default: 'your home')
85
+ #
86
+ # :file - String name of the file whose statistics you wish to review.
87
+ # You may define multiple files by separating each value with a
88
+ # pipe, e.g: 'file1|file2|file3'
89
+ #
90
+ # Returns Hash API response.
91
+ def stat(options = {})
92
+ options[:dir] = options.delete(:directory)
93
+
94
+ perform_request({ :api_function => 'statfiles' }.merge(options))
95
+ end
96
+
97
+ # Public: Retrieve disk usage statistics about your account.
98
+ #
99
+ # Returns Hash API response.
100
+ def disk_usage
101
+ perform_request({ :api_function => 'getdiskinfo' })
102
+ end
103
+
104
+ # Public: Perform an operation on a file or group of files. You can use
105
+ # this function to copy, move, rename, chmod, extract and compress, link
106
+ # and unlink, and trash files and directories.
107
+ #
108
+ # options - Hash options for API call params (default: {})
109
+ # :name - String naming the operation to perform. Acceptable values
110
+ # include 'copy', 'move', 'rename', 'chmod', 'extract',
111
+ # 'compress', 'link', 'unlink', and 'trash' (move to .trash
112
+ # directory)
113
+ # :source_files - String files on which you wish to perform the
114
+ # operation. You can include multiple files by
115
+ # separating each file with a comma (,). Do not add
116
+ # spaces.
117
+ # :destination_files - String list of destination filenames. If
118
+ # multiple sourcefiles are listed with multiple
119
+ # destination files ('destfiles'), the function
120
+ # attempts to handle each transaction on a 1-to-1
121
+ # basis. If only 1 file is specified in
122
+ # 'sourcefiles', it will be moved, or copied, or
123
+ # etc. to the first directory listed.
124
+ # :decode_uri - Boolean value. Entering '1' will cause the function to
125
+ # decode the URI-encoded variables :source_files and
126
+ # :destination_files
127
+ # :metadata - String parameter which contains any added values required
128
+ # by the named operation. When using 'compress', tihs would
129
+ # be the archive type. Acceptable values for the compress
130
+ # operation include: tar, gz, bz2, zip, tar.gz and tar.bz2.
131
+ # The chmod operation requires octal octal permissions like
132
+ # 0755 or 0700.
133
+ #
134
+ # Returns Hash API response
135
+ def operate(options={})
136
+ options[:op] = options.delete(:name)
137
+ options[:doubledecode] = options.delete(:decode_uri)
138
+ options[:sourcefiles] = options.delete(:source_files)
139
+ options[:destfiles] = options.delete(:destination_files)
140
+
141
+ perform_request({ :api_function => "fileop" }.merge(options))
142
+ end
143
+ end
144
+ end
145
+ end
146
+
@@ -0,0 +1,36 @@
1
+ module Lumberg
2
+ module Cpanel
3
+ # Public: Allows users to create and manage GnuPG keys
4
+ class Gpg < Base
5
+ # Public: List public GPG keys installed for the user
6
+ #
7
+ # Returns Hash API response
8
+ def list
9
+ perform_request({ :api_function => 'listgpgkeys' })
10
+ end
11
+
12
+ # Public: Count the number of public GPG keys installed for a user. You
13
+ # must have access to the 'gpg' feature to use this function.
14
+ #
15
+ # Returns Hash API response
16
+ def count
17
+ perform_request({ :api_function => 'number_of_public_keys' })
18
+ end
19
+
20
+ # Public: List GPG private (secret) keys associated with a user
21
+ #
22
+ # Returns Hash API response
23
+ def list_private
24
+ perform_request({ :api_function => 'listsecretgpgkeys' })
25
+ end
26
+
27
+ # Public: Count the number of private GPG keys installed for a user
28
+ #
29
+ # Returns Hash API response
30
+ def count_private
31
+ perform_request({ :api_function => 'number_of_private_keys' })
32
+ end
33
+ end
34
+ end
35
+ end
36
+
@@ -0,0 +1,15 @@
1
+ module Lumberg
2
+ module Cpanel
3
+ # Public: Allows access into cPanel's language system
4
+ class Locale < Base
5
+ # Public: Retrieve a user's character set encoding
6
+ #
7
+ # Returns Hash API response
8
+ def show
9
+ perform_request({ :api_function => 'get_encoding' })
10
+ end
11
+ end
12
+ end
13
+ end
14
+
15
+
@@ -0,0 +1,34 @@
1
+ module Lumberg
2
+ module Cpanel
3
+ # Public: Allows users to list mime types and handlers
4
+ class Mime < Base
5
+ # Public: List mime types associated with Apache
6
+ #
7
+ # options - Hash options for API call params (default: {})
8
+ # :system - String parameter allows you to specify whether or not to
9
+ # only return system wide mime types (default: '')
10
+ # :user - String parameter allows you to specify whether or not to
11
+ # only return user defined mime types (default: '')
12
+ #
13
+ # Returns Hash API response
14
+ def list(options = {})
15
+ perform_request({ :api_function => 'listmime' }.merge(options))
16
+ end
17
+
18
+ # Public: List handlers associated with Apache
19
+ #
20
+ # options - Hash options for API call params (default: {})
21
+ # :system - String parameter allows you to specify whether or not to
22
+ # only return system wide handlers (default: '')
23
+ # :user - String parameter allows you to specify whether or not to
24
+ # only return user defined handlers (default: '')
25
+ #
26
+ # Returns Hash API response
27
+ def handlers(options = {})
28
+ perform_request({ :api_function => 'listhandlers' }.merge(options))
29
+ end
30
+ end
31
+ end
32
+ end
33
+
34
+
@@ -0,0 +1,66 @@
1
+ module Lumberg
2
+ module Cpanel
3
+ # Public: Allows you to access information about an account's MySQL users,
4
+ # databases, and permissions
5
+ class Mysql < Base
6
+ def self.api_module; "MysqlFE"; end
7
+ # Public: Retrieve a list of databases that belong to username
8
+ #
9
+ # options - Hash options for API call params (default: {})
10
+ # :regex - String regular expression to filter results (optional)
11
+ #
12
+ # Returns Hash API response
13
+ def list(options = {})
14
+ perform_request({ :api_function => 'listdbs' }.merge(options))
15
+ end
16
+
17
+ # Public: List all of the MySQL users available to a cPanel account
18
+ #
19
+ # Returns Hash API response
20
+ def accounts
21
+ perform_request({ :api_function => 'listusers' })
22
+ end
23
+
24
+ # Public: Retrieve a list of remote MySQL connection hosts
25
+ #
26
+ # Returns Hash API response
27
+ def remote_hosts
28
+ perform_request({ :api_function => 'listhosts' })
29
+ end
30
+
31
+ # Public: Retrieve a list of existing database backups
32
+ #
33
+ # Returns Hash API response
34
+ def backups
35
+ perform_request({ :api_function => 'listdbsbackup' })
36
+ end
37
+
38
+ # Public: List users who can access a particular database
39
+ #
40
+ # options - Hash options for API call params (default: {})
41
+ # :db - String name of the database whose users you wish to review. Be
42
+ # sure to use Cpanel convention's full mysql database name, e.g:
43
+ # cpanelaccount_databasename
44
+ #
45
+ # Returns Hash API response
46
+ def usernames_for_db(options = {})
47
+ perform_request({ :api_function => 'listusersindb' })
48
+ end
49
+
50
+ # Public: Retrieve a list of permissions that correspond to a specific
51
+ # user and database
52
+ #
53
+ # options - Hash options for API call params (default: {})
54
+ # :db - String database that corresponds to th user whose permission
55
+ # you wish to view
56
+ # :username - String user whose permissions you wish to view
57
+ #
58
+ # Returns Hash API response
59
+ def permissions(options = {})
60
+ perform_request({ :api_function => 'userdbprivs' }.merge(options))
61
+ end
62
+ end
63
+ end
64
+ end
65
+
66
+
@@ -0,0 +1,28 @@
1
+ module Lumberg
2
+ module Cpanel
3
+ # Public: Allows users to access networking functions
4
+ class Net < Base
5
+ # Public: Perform a traceroute back to your local IP address while
6
+ # displaying packet speed at each hop in milliseconds.
7
+ #
8
+ # Returns Hash API response
9
+ def traceroute
10
+ perform_request({ :api_function => 'traceroute' })
11
+ end
12
+
13
+ # Public: Performs an A record DNS query for the hostname presented via
14
+ # the 'host' variable, with a 60 second timeout. If more than one A record
15
+ # exists for a given FQDN, all will be returned.
16
+ #
17
+ # options - Hash options for API call params (default: {})
18
+ # :host - String fully qualified domain name, either host.domain.com or
19
+ # domain.com
20
+ #
21
+ # Returns Hash API response
22
+ def query_hostname(options = {})
23
+ perform_request({ :api_function => 'dnszone' }.merge(options))
24
+ end
25
+ end
26
+ end
27
+ end
28
+
@@ -0,0 +1,58 @@
1
+ module Lumberg
2
+ module Cpanel
3
+ class Park < Base
4
+ # Public: Add a parked domain.
5
+ #
6
+ # options - Hash options for API call params (default: {}):
7
+ # :domain - String domain to park.
8
+ # :topdomain - String domain to park on top of (optional, default:
9
+ # account primary domain).
10
+ #
11
+ # Returns Hash API response.
12
+ def add(options = {})
13
+ perform_request({
14
+ :api_function => "park"
15
+ }.merge(options))
16
+ end
17
+
18
+ # Public: Remove a parked domain.
19
+ #
20
+ # options - Hash options for API call params (default: {}):
21
+ # :domain - String parked domain to remove.
22
+ #
23
+ # Returns Hash API response.
24
+ def remove(options = {})
25
+ perform_request({
26
+ :api_function => "unpark"
27
+ }.merge(options))
28
+ end
29
+
30
+ # Public: Get a list of parked domains.
31
+ #
32
+ # options - Hash options for API call params (default: {}):
33
+ # :regex - String regular expression to filter search results
34
+ # (optional).
35
+ #
36
+ # Returns Hash API response.
37
+ def list(options = {})
38
+ perform_request({
39
+ :api_function => "listparkeddomains"
40
+ }.merge(options))
41
+ end
42
+
43
+ # Public: Get a list addon domains.
44
+ #
45
+ # options - Hash options for API call params (default: {}):
46
+ # :regex - String regular expresion to filter search results
47
+ # (optional).
48
+ #
49
+ # Returns Hash API response.
50
+ def list_addon_domains(options = {})
51
+ perform_request({
52
+ :api_function => "listaddondomains"
53
+ }.merge(options))
54
+ end
55
+
56
+ end
57
+ end
58
+ end
@@ -0,0 +1,52 @@
1
+ module Lumberg
2
+ module Cpanel
3
+ # Public: The Passwd module allows users to change their cPanel account's
4
+ # password.
5
+ class Password < Base
6
+ def self.api_module; "Passwd"; end
7
+
8
+ # Public: Change a cPanel account's password.
9
+ #
10
+ # options - Hash options for API call params (default: {})
11
+ # :newpass - String new password for the Cpanel account
12
+ # :oldpass - String old password for the Cpanel account
13
+ #
14
+ # Examples
15
+ # api_args = { host: "x.x.x.x", hash: "pass", api_username: "user" }
16
+ # password = Lumberg::Cpanel::Password.new(api_args.dup)
17
+ #
18
+ # password.modify(new: "", old: "")
19
+ #
20
+ # Returns Hash API response.
21
+ def modify(options = {})
22
+ perform_request({ :api_function => 'change_password' }.merge(options))
23
+ end
24
+
25
+ # Public: Enables or disables Digest Authentication for an account.
26
+ # Windows Vista(R), Windows(R) 7, and Windows(R) 8 require Digest
27
+ # Authentication support to be enabled in order to access your
28
+ # Web Disk over a clear text, unencrypted connection. If the
29
+ # server has a SSL certificate signed by a recognized certificate
30
+ # authority and you are able to make an SSL connection over port
31
+ # 2078, you do not need to enable this.
32
+ #
33
+ # options - Hash options for API call params (default: {})
34
+ # :password - String current password for your account
35
+ # :enable - Boolean value indicating if Digest Authentication should
36
+ # be enabled or disabled for the web disk user.
37
+ #
38
+ # Examples
39
+ # api_args = { host: "x.x.x.x", hash: "pass", api_username: "user" }
40
+ # password = Lumberg::Cpanel::Password.new(api_args.dup)
41
+ #
42
+ # password.digest_authentication(password: "", enable: true)
43
+ #
44
+ # Returns Hash API response.
45
+ def digest_authentication(options = {})
46
+ options[:enabledigest] = options.delete([:enable]) ? 1 : 0
47
+ perform_request({ :api_function => 'set_digest_auth' }.merge(options))
48
+ end
49
+ end
50
+ end
51
+ end
52
+
@@ -0,0 +1,25 @@
1
+ module Lumberg
2
+ module Cpanel
3
+ # Public: Allows you to create random data
4
+ class RandomData < Base
5
+ def self.api_module; "Rand" ; end
6
+
7
+ # Public: Retrieve a random string
8
+ #
9
+ # options - Hash options for API call params (default: {})
10
+ # :length - Integer length of the random string you wish to receive
11
+ #
12
+ # Examples
13
+ # api_args = { host: "x.x.x.x", hash: "pass", api_username: "user" }
14
+ # random_data = Lumberg::Cpanel::RandomData.new(api_args.dup)
15
+ #
16
+ # random_data.show
17
+ #
18
+ # Returns Hash API response
19
+ def show(options = {})
20
+ perform_request({ :api_function => 'getranddata' }.merge(options))
21
+ end
22
+ end
23
+ end
24
+ end
25
+
@@ -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
+