lumberg 1.0.1 → 2.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (306) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +1 -1
  3. data/README.md +184 -70
  4. data/Rakefile +3 -1
  5. data/lib/lumberg/config.rb +19 -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 +522 -0
  17. data/lib/lumberg/cpanel/file_manager.rb +146 -0
  18. data/lib/lumberg/cpanel/ftp.rb +101 -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/mysql_db.rb +190 -0
  24. data/lib/lumberg/cpanel/net.rb +28 -0
  25. data/lib/lumberg/cpanel/park.rb +58 -0
  26. data/lib/lumberg/cpanel/password.rb +52 -0
  27. data/lib/lumberg/cpanel/password_strength.rb +63 -0
  28. data/lib/lumberg/cpanel/random_data.rb +25 -0
  29. data/lib/lumberg/cpanel/redirect.rb +44 -0
  30. data/lib/lumberg/cpanel/ssl.rb +220 -0
  31. data/lib/lumberg/cpanel/sub_domain.rb +61 -0
  32. data/lib/lumberg/cpanel/support.rb +29 -0
  33. data/lib/lumberg/cpanel/zone_edit.rb +134 -0
  34. data/lib/lumberg/cpanel.rb +32 -0
  35. data/lib/lumberg/format_whm.rb +162 -0
  36. data/lib/lumberg/version.rb +1 -1
  37. data/lib/lumberg/whm/account.rb +29 -106
  38. data/lib/lumberg/whm/base.rb +3 -7
  39. data/lib/lumberg/whm/cert.rb +88 -0
  40. data/lib/lumberg/whm/dns.rb +49 -77
  41. data/lib/lumberg/whm/reseller.rb +25 -118
  42. data/lib/lumberg/whm/server.rb +163 -222
  43. data/lib/lumberg/whm/transfer_tool.rb +165 -0
  44. data/lib/lumberg/whm.rb +11 -9
  45. data/lib/lumberg/whostmgr/base.rb +13 -0
  46. data/lib/lumberg/whostmgr/ssl.rb +57 -0
  47. data/lib/lumberg/whostmgr.rb +6 -0
  48. data/lib/lumberg.rb +35 -8
  49. data/spec/config_spec.rb +28 -0
  50. data/spec/cpanel/addon_domain_spec.rb +84 -0
  51. data/spec/cpanel/backups_spec.rb +22 -0
  52. data/spec/cpanel/base_spec.rb +128 -0
  53. data/spec/cpanel/box_trapper_spec.rb +22 -0
  54. data/spec/cpanel/branding_spec.rb +46 -0
  55. data/spec/cpanel/contact_spec.rb +50 -0
  56. data/spec/cpanel/cron_spec.rb +161 -0
  57. data/spec/cpanel/dns_lookup_spec.rb +22 -0
  58. data/spec/cpanel/domain_keys_spec.rb +46 -0
  59. data/spec/cpanel/domain_lookup_spec.rb +77 -0
  60. data/spec/cpanel/email_spec.rb +639 -0
  61. data/spec/cpanel/file_manager_spec.rb +73 -0
  62. data/spec/cpanel/ftp_spec.rb +71 -0
  63. data/spec/cpanel/gpg_spec.rb +48 -0
  64. data/spec/cpanel/locale_spec.rb +23 -0
  65. data/spec/cpanel/mime_spec.rb +0 -0
  66. data/spec/cpanel/mysql_db_spec.rb +119 -0
  67. data/spec/cpanel/mysql_spec.rb +0 -0
  68. data/spec/cpanel/net_spec.rb +30 -0
  69. data/spec/cpanel/park_spec.rb +94 -0
  70. data/spec/cpanel/password_spec.rb +35 -0
  71. data/spec/cpanel/password_strength_spec.rb +50 -0
  72. data/spec/cpanel/random_data_spec.rb +24 -0
  73. data/spec/cpanel/redirect_spec.rb +0 -0
  74. data/spec/cpanel/ssl_spec.rb +158 -0
  75. data/spec/cpanel/sub_domain_spec.rb +72 -0
  76. data/spec/cpanel/support_spec.rb +38 -0
  77. data/spec/cpanel/zone_edit_spec.rb +0 -0
  78. data/spec/format_whm_spec.rb +53 -0
  79. data/spec/sample_certs/cpanel.crt +28 -0
  80. data/spec/sample_certs/cpanel.key +28 -0
  81. data/spec/sample_certs/main.crt +27 -0
  82. data/spec/sample_certs/sample.crt +26 -0
  83. data/spec/sample_certs/sample.key +27 -0
  84. data/spec/spec_helper.rb +10 -3
  85. data/spec/support/cpanel_matchers.rb +17 -0
  86. data/spec/vcr_cassettes/cpanel/addon_domain/add.yml +77 -0
  87. data/spec/vcr_cassettes/cpanel/addon_domain/list.yml +77 -0
  88. data/spec/vcr_cassettes/cpanel/addon_domain/remove.yml +77 -0
  89. data/spec/vcr_cassettes/cpanel/backups/list.yml +40 -0
  90. data/spec/vcr_cassettes/cpanel/box_trapper/list.yml +40 -0
  91. data/spec/vcr_cassettes/cpanel/branding/list_icons.yml +40 -0
  92. data/spec/vcr_cassettes/cpanel/branding/list_image_types.yml +40 -0
  93. data/spec/vcr_cassettes/cpanel/branding/list_object_types.yml +40 -0
  94. data/spec/vcr_cassettes/cpanel/branding/list_pkgs.yml +40 -0
  95. data/spec/vcr_cassettes/cpanel/branding/list_sprites.yml +40 -0
  96. data/spec/vcr_cassettes/cpanel/contact/show.yml +40 -0
  97. data/spec/vcr_cassettes/cpanel/contact/update.yml +40 -0
  98. data/spec/vcr_cassettes/cpanel/cron/add.yml +77 -0
  99. data/spec/vcr_cassettes/cpanel/cron/edit.yml +114 -0
  100. data/spec/vcr_cassettes/cpanel/cron/email.yml +77 -0
  101. data/spec/vcr_cassettes/cpanel/cron/list.yml +77 -0
  102. data/spec/vcr_cassettes/cpanel/cron/remove.yml +151 -0
  103. data/spec/vcr_cassettes/cpanel/cron/set_email.yml +77 -0
  104. data/spec/vcr_cassettes/cpanel/dns_lookup/name_to_ip.yml +40 -0
  105. data/spec/vcr_cassettes/cpanel/domain_keys/add.yml +40 -0
  106. data/spec/vcr_cassettes/cpanel/domain_keys/available.yml +40 -0
  107. data/spec/vcr_cassettes/cpanel/domain_keys/installed.yml +40 -0
  108. data/spec/vcr_cassettes/cpanel/domain_keys/remove.yml +40 -0
  109. data/spec/vcr_cassettes/cpanel/domain_lookup/count.yml +40 -0
  110. data/spec/vcr_cassettes/cpanel/domain_lookup/docroot.yml +40 -0
  111. data/spec/vcr_cassettes/cpanel/domain_lookup/docroots.yml +40 -0
  112. data/spec/vcr_cassettes/cpanel/domain_lookup/document_root.yml +40 -0
  113. data/spec/vcr_cassettes/cpanel/domain_lookup/document_roots.yml +40 -0
  114. data/spec/vcr_cassettes/cpanel/domain_lookup/list.yml +40 -0
  115. data/spec/vcr_cassettes/cpanel/email/acceptable_encodings.yml +40 -0
  116. data/spec/vcr_cassettes/cpanel/email/accounts.yml +188 -0
  117. data/spec/vcr_cassettes/cpanel/email/add_account.yml +77 -0
  118. data/spec/vcr_cassettes/cpanel/email/add_filter.yml +77 -0
  119. data/spec/vcr_cassettes/cpanel/email/add_forwarder.yml +77 -0
  120. data/spec/vcr_cassettes/cpanel/email/add_mailing_list.yml +73 -0
  121. data/spec/vcr_cassettes/cpanel/email/add_mx.yml +40 -0
  122. data/spec/vcr_cassettes/cpanel/email/change_mx.yml +40 -0
  123. data/spec/vcr_cassettes/cpanel/email/change_password.yml +43 -0
  124. data/spec/vcr_cassettes/cpanel/email/check_local_delivery_local.yml +77 -0
  125. data/spec/vcr_cassettes/cpanel/email/check_local_delivery_remote.yml +77 -0
  126. data/spec/vcr_cassettes/cpanel/email/default_address.yml +40 -0
  127. data/spec/vcr_cassettes/cpanel/email/delete_mx.yml +40 -0
  128. data/spec/vcr_cassettes/cpanel/email/disk_usage.yml +77 -0
  129. data/spec/vcr_cassettes/cpanel/email/domains.yml +40 -0
  130. data/spec/vcr_cassettes/cpanel/email/domains_with_aliases.yml +77 -0
  131. data/spec/vcr_cassettes/cpanel/email/edit_quota.yml +112 -0
  132. data/spec/vcr_cassettes/cpanel/email/filters.yml +114 -0
  133. data/spec/vcr_cassettes/cpanel/email/forwarders.yml +77 -0
  134. data/spec/vcr_cassettes/cpanel/email/mail_dir.yml +77 -0
  135. data/spec/vcr_cassettes/cpanel/email/mail_dirs.yml +77 -0
  136. data/spec/vcr_cassettes/cpanel/email/mailing_lists.yml +73 -0
  137. data/spec/vcr_cassettes/cpanel/email/main_discard.yml +40 -0
  138. data/spec/vcr_cassettes/cpanel/email/mx.yml +40 -0
  139. data/spec/vcr_cassettes/cpanel/email/remove.yml +77 -0
  140. data/spec/vcr_cassettes/cpanel/email/set_default_address.yml +43 -0
  141. data/spec/vcr_cassettes/cpanel/email/set_mail_delivery_local.yml +77 -0
  142. data/spec/vcr_cassettes/cpanel/email/set_mail_delivery_remote.yml +77 -0
  143. data/spec/vcr_cassettes/cpanel/email/set_mx_type.yml +40 -0
  144. data/spec/vcr_cassettes/cpanel/file_manager/disk_usage.yml +38 -0
  145. data/spec/vcr_cassettes/cpanel/file_manager/list.yml +38 -0
  146. data/spec/vcr_cassettes/cpanel/file_manager/operate.yml +77 -0
  147. data/spec/vcr_cassettes/cpanel/file_manager/show.yml +40 -0
  148. data/spec/vcr_cassettes/cpanel/file_manager/stat.yml +38 -0
  149. data/spec/vcr_cassettes/cpanel/ftp/addftp.yml +43 -0
  150. data/spec/vcr_cassettes/cpanel/ftp/delftp.yml +43 -0
  151. data/spec/vcr_cassettes/cpanel/ftp/listftp.yml +43 -0
  152. data/spec/vcr_cassettes/cpanel/ftp/listftpsessions.yml +43 -0
  153. data/spec/vcr_cassettes/cpanel/ftp/listftpwithdisk.yml +95 -0
  154. data/spec/vcr_cassettes/cpanel/ftp/passwd.yml +43 -0
  155. data/spec/vcr_cassettes/cpanel/ftp/setquota.yml +43 -0
  156. data/spec/vcr_cassettes/cpanel/gpg/count.yml +40 -0
  157. data/spec/vcr_cassettes/cpanel/gpg/count_private.yml +40 -0
  158. data/spec/vcr_cassettes/cpanel/gpg/list.yml +40 -0
  159. data/spec/vcr_cassettes/cpanel/gpg/list_private.yml +40 -0
  160. data/spec/vcr_cassettes/cpanel/locale/show.yml +40 -0
  161. data/spec/vcr_cassettes/cpanel/mysql_db/add_db.yml +42 -0
  162. data/spec/vcr_cassettes/cpanel/mysql_db/add_host.yml +42 -0
  163. data/spec/vcr_cassettes/cpanel/mysql_db/add_user.yml +42 -0
  164. data/spec/vcr_cassettes/cpanel/mysql_db/add_user_db.yml +42 -0
  165. data/spec/vcr_cassettes/cpanel/mysql_db/check_db.yml +42 -0
  166. data/spec/vcr_cassettes/cpanel/mysql_db/del_db.yml +42 -0
  167. data/spec/vcr_cassettes/cpanel/mysql_db/del_host.yml +42 -0
  168. data/spec/vcr_cassettes/cpanel/mysql_db/del_user.yml +42 -0
  169. data/spec/vcr_cassettes/cpanel/mysql_db/del_user_db.yml +42 -0
  170. data/spec/vcr_cassettes/cpanel/mysql_db/init_cache.yml +42 -0
  171. data/spec/vcr_cassettes/cpanel/mysql_db/number_of_dbs.yml +42 -0
  172. data/spec/vcr_cassettes/cpanel/mysql_db/repair_db.yml +42 -0
  173. data/spec/vcr_cassettes/cpanel/mysql_db/update_privs.yml +42 -0
  174. data/spec/vcr_cassettes/cpanel/net/query_hostname.yml +40 -0
  175. data/spec/vcr_cassettes/cpanel/net/traceroute.yml +40 -0
  176. data/spec/vcr_cassettes/cpanel/park/add.yml +77 -0
  177. data/spec/vcr_cassettes/cpanel/park/list.yml +77 -0
  178. data/spec/vcr_cassettes/cpanel/park/list_addon_domains.yml +77 -0
  179. data/spec/vcr_cassettes/cpanel/park/remove.yml +77 -0
  180. data/spec/vcr_cassettes/cpanel/password/digest_authentication.yml +77 -0
  181. data/spec/vcr_cassettes/cpanel/password/modify.yml +77 -0
  182. data/spec/vcr_cassettes/cpanel/password_strength/all_required_strengths.yml +43 -0
  183. data/spec/vcr_cassettes/cpanel/password_strength/required_strength.yml +43 -0
  184. data/spec/vcr_cassettes/cpanel/password_strength/strength.yml +83 -0
  185. data/spec/vcr_cassettes/cpanel/random_data/show.yml +40 -0
  186. data/spec/vcr_cassettes/cpanel/ssl/fetchcabundle.yml +40 -0
  187. data/spec/vcr_cassettes/cpanel/ssl/gencrt.yml +43 -0
  188. data/spec/vcr_cassettes/cpanel/ssl/gencsr.yml +43 -0
  189. data/spec/vcr_cassettes/cpanel/ssl/genkey.yml +40 -0
  190. data/spec/vcr_cassettes/cpanel/ssl/installssl.yml +40 -0
  191. data/spec/vcr_cassettes/cpanel/ssl/listcrts.yml +40 -0
  192. data/spec/vcr_cassettes/cpanel/ssl/listcsrs.yml +40 -0
  193. data/spec/vcr_cassettes/cpanel/ssl/listkeys.yml +40 -0
  194. data/spec/vcr_cassettes/cpanel/ssl/listsslitems.yml +40 -0
  195. data/spec/vcr_cassettes/cpanel/ssl/remove.yml +43 -0
  196. data/spec/vcr_cassettes/cpanel/ssl/showcrt.yml +38 -0
  197. data/spec/vcr_cassettes/cpanel/ssl/showcsr.yml +38 -0
  198. data/spec/vcr_cassettes/cpanel/ssl/showkey.yml +38 -0
  199. data/spec/vcr_cassettes/cpanel/ssl/uploadcrt.yml +40 -0
  200. data/spec/vcr_cassettes/cpanel/sub_domain/add.yml +77 -0
  201. data/spec/vcr_cassettes/cpanel/sub_domain/list.yml +77 -0
  202. data/spec/vcr_cassettes/cpanel/sub_domain/remove.yml +77 -0
  203. data/spec/vcr_cassettes/cpanel/support/contactable.yml +40 -0
  204. data/spec/vcr_cassettes/whm/account/accountsummary.yml +41 -29
  205. data/spec/vcr_cassettes/whm/account/changepackage.yml +73 -43
  206. data/spec/vcr_cassettes/whm/account/createacct.yml +101 -31
  207. data/spec/vcr_cassettes/whm/account/domainuserdata.yml +43 -29
  208. data/spec/vcr_cassettes/whm/account/editquota.yml +78 -57
  209. data/spec/vcr_cassettes/whm/account/limitbw.yml +79 -57
  210. data/spec/vcr_cassettes/whm/account/listaccts.yml +195 -100
  211. data/spec/vcr_cassettes/whm/account/listsuspended.yml +41 -29
  212. data/spec/vcr_cassettes/whm/account/modifyacct.yml +61 -42
  213. data/spec/vcr_cassettes/whm/account/myprivs.yml +41 -29
  214. data/spec/vcr_cassettes/whm/account/passwd.yml +44 -29
  215. data/spec/vcr_cassettes/whm/account/removeacct.yml +134 -57
  216. data/spec/vcr_cassettes/whm/account/restoreaccount.yml +310 -135
  217. data/spec/vcr_cassettes/whm/account/setsiteip.yml +166 -127
  218. data/spec/vcr_cassettes/whm/account/suspend.yml +75 -43
  219. data/spec/vcr_cassettes/whm/account/unsuspend.yml +46 -29
  220. data/spec/vcr_cassettes/whm/cert/fetch_ssl_vhosts.yml +44 -0
  221. data/spec/vcr_cassettes/whm/cert/fetchsslinfo.yml +38 -0
  222. data/spec/vcr_cassettes/whm/cert/generatessl.yml +94 -0
  223. data/spec/vcr_cassettes/whm/cert/installssl.yml +38 -0
  224. data/spec/vcr_cassettes/whm/cert/listcrts.yml +38 -0
  225. data/spec/vcr_cassettes/whm/dns/adddns.yml +61 -43
  226. data/spec/vcr_cassettes/whm/dns/addzonerecord.yml +42 -29
  227. data/spec/vcr_cassettes/whm/dns/dumpzone.yml +44 -29
  228. data/spec/vcr_cassettes/whm/dns/editzonerecord.yml +61 -43
  229. data/spec/vcr_cassettes/whm/dns/getzonerecord.yml +60 -43
  230. data/spec/vcr_cassettes/whm/dns/killdns.yml +42 -29
  231. data/spec/vcr_cassettes/whm/dns/listmxs.yml +23 -15
  232. data/spec/vcr_cassettes/whm/dns/listzones.yml +22 -15
  233. data/spec/vcr_cassettes/whm/dns/lookupnsip.yml +40 -29
  234. data/spec/vcr_cassettes/whm/dns/removezonerecord.yml +61 -43
  235. data/spec/vcr_cassettes/whm/dns/resetzone.yml +42 -29
  236. data/spec/vcr_cassettes/whm/dns/resolvedomainname.yml +40 -29
  237. data/spec/vcr_cassettes/whm/dns/savemxs.yml +23 -15
  238. data/spec/vcr_cassettes/whm/reseller/acctcounts.yml +41 -29
  239. data/spec/vcr_cassettes/whm/reseller/listacls.yml +22 -15
  240. data/spec/vcr_cassettes/whm/reseller/listresellers.yml +22 -15
  241. data/spec/vcr_cassettes/whm/reseller/resellerstats.yml +42 -29
  242. data/spec/vcr_cassettes/whm/reseller/saveacllist.yml +76 -57
  243. data/spec/vcr_cassettes/whm/reseller/setacls.yml +40 -29
  244. data/spec/vcr_cassettes/whm/reseller/setresellerips.yml +42 -28
  245. data/spec/vcr_cassettes/whm/reseller/setresellerlimits.yml +41 -29
  246. data/spec/vcr_cassettes/whm/reseller/setresellermainip.yml +59 -43
  247. data/spec/vcr_cassettes/whm/reseller/setresellernameservers.yml +58 -43
  248. data/spec/vcr_cassettes/whm/reseller/setresellerpackagelimit.yml +61 -43
  249. data/spec/vcr_cassettes/whm/reseller/setupreseller.yml +41 -29
  250. data/spec/vcr_cassettes/whm/reseller/suspendreseller.yml +75 -44
  251. data/spec/vcr_cassettes/whm/reseller/terminatereseller.yml +83 -46
  252. data/spec/vcr_cassettes/whm/reseller/unsetupreseller.yml +41 -29
  253. data/spec/vcr_cassettes/whm/reseller/unsuspendreseller.yml +46 -29
  254. data/spec/vcr_cassettes/whm/server/addip.yml +24 -15
  255. data/spec/vcr_cassettes/whm/server/applist.yml +22 -15
  256. data/spec/vcr_cassettes/whm/server/delip.yml +23 -15
  257. data/spec/vcr_cassettes/whm/server/disk_usage.yml +45 -0
  258. data/spec/vcr_cassettes/whm/server/edit_hook.yml +44 -0
  259. data/spec/vcr_cassettes/whm/server/gethostname.yml +22 -15
  260. data/spec/vcr_cassettes/whm/server/getlanglist.yml +22 -15
  261. data/spec/vcr_cassettes/whm/server/gettweaksetting.yml +44 -0
  262. data/spec/vcr_cassettes/whm/server/list_hooks.yml +44 -0
  263. data/spec/vcr_cassettes/whm/server/listips.yml +22 -15
  264. data/spec/vcr_cassettes/whm/server/loadavg.yml +26 -19
  265. data/spec/vcr_cassettes/whm/server/lookup_nameserver_ip.yml +44 -0
  266. data/spec/vcr_cassettes/whm/server/my_function.yml +59 -43
  267. data/spec/vcr_cassettes/whm/server/nvget.yml +22 -15
  268. data/spec/vcr_cassettes/whm/server/nvset.yml +22 -15
  269. data/spec/vcr_cassettes/whm/server/reboot.yml +22 -15
  270. data/spec/vcr_cassettes/whm/server/sethostname.yml +24 -15
  271. data/spec/vcr_cassettes/whm/server/setresolvers.yml +23 -15
  272. data/spec/vcr_cassettes/whm/server/settweaksetting.yml +44 -0
  273. data/spec/vcr_cassettes/whm/server/showbw.yml +22 -15
  274. data/spec/vcr_cassettes/whm/server/systemloadavg.yml +40 -29
  275. data/spec/vcr_cassettes/whm/server/themes.yml +38 -0
  276. data/spec/vcr_cassettes/whm/server/version.yml +22 -15
  277. data/spec/vcr_cassettes/whm/transfer_tool/check.yml +44 -0
  278. data/spec/vcr_cassettes/whm/transfer_tool/create.yml +72 -0
  279. data/spec/vcr_cassettes/whm/transfer_tool/enqueue.yml +44 -0
  280. data/spec/vcr_cassettes/whm/transfer_tool/pause.yml +44 -0
  281. data/spec/vcr_cassettes/whm/transfer_tool/show_log.yml +44 -0
  282. data/spec/vcr_cassettes/whm/transfer_tool/start.yml +44 -0
  283. data/spec/vcr_cassettes/whm/transfer_tool/status.yml +44 -0
  284. data/spec/vcr_cassettes/whm/transfer_tool/validate_user.yml +44 -0
  285. data/spec/vcr_cassettes/whostmgr/ssl/create.yml +219 -0
  286. data/spec/vcr_cassettes/whostmgr/ssl/remove.yml +172 -0
  287. data/spec/vcr_cassettes/whostmgr/ssl/remove_data.yml +179 -0
  288. data/spec/whm/account_spec.rb +90 -249
  289. data/spec/whm/base_spec.rb +3 -7
  290. data/spec/whm/cert_spec.rb +110 -0
  291. data/spec/whm/dns_spec.rb +37 -155
  292. data/spec/whm/reseller_spec.rb +46 -114
  293. data/spec/whm/server_spec.rb +142 -156
  294. data/spec/whm/transfer_tool_spec.rb +172 -0
  295. data/spec/whm/whm_spec.rb +8 -8
  296. data/spec/whostmgr/ssl_spec.rb +55 -0
  297. metadata +528 -108
  298. data/.gitignore +0 -10
  299. data/.rspec +0 -2
  300. data/.rvmrc +0 -49
  301. data/.travis.yml +0 -11
  302. data/lib/lumberg/whm/args.rb +0 -113
  303. data/lib/net_http_hacked.rb +0 -42
  304. data/lumberg.gemspec +0 -28
  305. data/spec/vcr_cassettes/whm/server/response_type.yml +0 -85
  306. data/spec/whm/args_spec.rb +0 -179
@@ -0,0 +1,71 @@
1
+ require "spec_helper"
2
+
3
+ module Lumberg
4
+ describe Cpanel::Ftp do
5
+ let(:server) { Whm::Server.new(host: @whm_host, hash: @whm_hash) }
6
+ let(:api_username) { "lumberg" }
7
+
8
+ let(:ftp) do
9
+ described_class.new(
10
+ server: server,
11
+ api_username: api_username
12
+ )
13
+ end
14
+
15
+ describe "#list_ftp" do
16
+ use_vcr_cassette("cpanel/ftp/listftp")
17
+
18
+ it "lists ftp accounts associated to the account" do
19
+ ftp.list_ftp[:params][:data][0][:user].should eq("hello")
20
+ end
21
+ end
22
+
23
+ describe "#list_ftp_sessions" do
24
+ use_vcr_cassette("cpanel/ftp/listftpsessions")
25
+
26
+ it "lists ftp sessions associated to the account" do
27
+ ftp.list_ftp_sessions[:params][:data][0][:status].should eq("IDLE")
28
+ end
29
+ end
30
+
31
+ describe "#list_ftp_with_disk" do
32
+ use_vcr_cassette("cpanel/ftp/listftpwithdisk")
33
+
34
+ it "lists ftp accounts with disk information" do
35
+ ftp.list_ftp_with_disk[:params][:data][0][:_diskused].should eq("0")
36
+ end
37
+ end
38
+
39
+ describe "#add_ftp" do
40
+ use_vcr_cassette("cpanel/ftp/addftp")
41
+
42
+ it "creates the account" do
43
+ ftp.add_ftp(user: 'bob', pass: 'boo')[:params][:data][0][:reason].should eq("OK")
44
+ end
45
+ end
46
+
47
+ describe "#passwd" do
48
+ use_vcr_cassette("cpanel/ftp/passwd")
49
+
50
+ it "changes the password of the account" do
51
+ ftp.passwd(user: 'bob', pass: 'boo')[:params][:data][0][:reason].should eq("OK")
52
+ end
53
+ end
54
+
55
+ describe "#setquota" do
56
+ use_vcr_cassette("cpanel/ftp/setquota")
57
+
58
+ it "sets a quota for the account" do
59
+ ftp.set_quota(user: 'bob', quota: '100')[:params][:data][0][:reason].should eq("OK")
60
+ end
61
+ end
62
+
63
+ describe "#del_ftp" do
64
+ use_vcr_cassette("cpanel/ftp/delftp")
65
+
66
+ it "removes the account" do
67
+ ftp.del_ftp(user: 'bob', destroy: '1')[:params][:data][0][:reason].should eq("OK")
68
+ end
69
+ end
70
+ end
71
+ end
@@ -0,0 +1,48 @@
1
+ require "spec_helper"
2
+
3
+ module Lumberg
4
+ describe Cpanel::Gpg do
5
+ let(:server) { Whm::Server.new(host: @whm_host, hash: @whm_hash) }
6
+ let(:api_username) { "lumberg" }
7
+ let(:gpg) do
8
+ described_class.new(
9
+ server: server,
10
+ api_username: api_username
11
+ )
12
+ end
13
+
14
+ describe "#list" do
15
+ use_vcr_cassette "cpanel/gpg/list"
16
+
17
+ subject { gpg.list[:params][:data] }
18
+
19
+ it { should be_an(Array) }
20
+ end
21
+
22
+ describe "#count" do
23
+ use_vcr_cassette "cpanel/gpg/count"
24
+
25
+ subject { gpg.count[:params][:data][0][:count] }
26
+
27
+ it { should be_a(Integer) }
28
+ end
29
+
30
+ describe "#list_private" do
31
+ use_vcr_cassette "cpanel/gpg/list_private"
32
+
33
+ subject { gpg.list_private[:params][:data] }
34
+
35
+ it { should be_an(Array) }
36
+ end
37
+
38
+ describe "#count_private" do
39
+ use_vcr_cassette "cpanel/gpg/count_private"
40
+
41
+ subject { gpg.count_private[:params][:data][0][:count] }
42
+
43
+ it { should be_a(Integer) }
44
+ end
45
+
46
+ end
47
+ end
48
+
@@ -0,0 +1,23 @@
1
+ require "spec_helper"
2
+
3
+ module Lumberg
4
+ describe Cpanel::Locale do
5
+ let(:server) { Whm::Server.new(host: @whm_host, hash: @whm_hash) }
6
+ let(:api_username) { "lumberg" }
7
+ let(:locale) do
8
+ described_class.new(
9
+ server: server,
10
+ api_username: api_username
11
+ )
12
+ end
13
+
14
+ describe "#show" do
15
+ use_vcr_cassette "cpanel/locale/show"
16
+
17
+ subject { locale.show[:params][:data][0][:encoding] }
18
+
19
+ it { should be_a(String) }
20
+ end
21
+ end
22
+ end
23
+
File without changes
@@ -0,0 +1,119 @@
1
+ require 'spec_helper'
2
+
3
+ module Lumberg
4
+ describe Cpanel::MysqlDb do
5
+ let(:server) { Whm::Server.new(host: @whm_host, hash: @whm_hash) }
6
+ let(:api_username) { "lumberg" }
7
+ let(:mysql_db) do
8
+ described_class.new(
9
+ server: server,
10
+ api_username: api_username
11
+ )
12
+ end
13
+
14
+ describe "#add_db" do
15
+ use_vcr_cassette("cpanel/mysql_db/add_db")
16
+
17
+ it "adds a db" do
18
+ mysql_db.add_db(dbname: 'cpanel')[:params][:result].should_not be_nil
19
+ end
20
+ end
21
+
22
+ describe "#add_user" do
23
+ use_vcr_cassette("cpanel/mysql_db/add_user")
24
+
25
+ it "adds a user" do
26
+ mysql_db.add_user(username: 'first', password: 'first_pass')[:params][:result].should_not be_nil
27
+ end
28
+ end
29
+
30
+ describe "#add_user_db" do
31
+ use_vcr_cassette("cpanel/mysql_db/add_user_db")
32
+
33
+ it "adds a user to a db" do
34
+ mysql_db.add_user_db(dbname: 'lumberg_cpanel', dbuser: 'lumberg_first',
35
+ perms_list: 'all')[:params][:result].should_not be_nil
36
+ end
37
+ end
38
+
39
+ describe "#number_of_dbs" do
40
+ use_vcr_cassette("cpanel/mysql_db/number_of_dbs")
41
+
42
+ it "gets number of dbs" do
43
+ mysql_db.number_of_dbs[:params][:result].should eq("1")
44
+ end
45
+ end
46
+
47
+ describe "#check_db" do
48
+ use_vcr_cassette("cpanel/mysql_db/check_db")
49
+
50
+ it "checks db" do
51
+ mysql_db.check_db(dbname: 'lumberg_cpanel')[:params][:result].should_not be_nil
52
+ end
53
+ end
54
+
55
+ describe "#repair_db" do
56
+ use_vcr_cassette("cpanel/mysql_db/repair_db")
57
+
58
+ it "repairs the db" do
59
+ mysql_db.repair_db(dbname: 'lumberg_cpanel')[:params][:result].should_not be_nil
60
+ end
61
+ end
62
+
63
+ describe "#update_privs" do
64
+ use_vcr_cassette("cpanel/mysql_db/update_privs")
65
+
66
+ it "updates privileges" do
67
+ mysql_db.update_privs[:params][:result].should_not be_nil
68
+ end
69
+ end
70
+
71
+ describe "#init_cache" do
72
+ use_vcr_cassette("cpanel/mysql_db/init_cache")
73
+
74
+ it "refreshes the cache of MySQL information" do
75
+ mysql_db.init_cache[:params][:result].should_not be_nil
76
+ end
77
+ end
78
+
79
+ describe "#del_user_db" do
80
+ use_vcr_cassette("cpanel/mysql_db/del_user_db")
81
+
82
+ it "disallows a user from accessing a db" do
83
+ mysql_db.del_user_db(dbname: 'lumberg_cpanel', dbuser: 'lumberg_first')[:params][:result].should_not be_nil
84
+ end
85
+ end
86
+
87
+ describe "#del_user" do
88
+ use_vcr_cassette("cpanel/mysql_db/del_user")
89
+
90
+ it "deletes a user" do
91
+ mysql_db.del_user(dbuser: 'lumberg_first')[:params][:result].should_not be_nil
92
+ end
93
+ end
94
+
95
+ describe "#del_db" do
96
+ use_vcr_cassette("cpanel/mysql_db/del_db")
97
+
98
+ it "deletes a db" do
99
+ mysql_db.del_db(dbname: 'lumberg_cpanel')[:params][:result].should_not be_nil
100
+ end
101
+ end
102
+
103
+ describe "#add_host" do
104
+ use_vcr_cassette("cpanel/mysql_db/add_host")
105
+
106
+ it "adds a host" do
107
+ mysql_db.add_host(hostname: 'cpanel_test.com')[:params][:result].should_not be_nil
108
+ end
109
+ end
110
+
111
+ describe "#del_host" do
112
+ use_vcr_cassette("cpanel/mysql_db/del_host")
113
+
114
+ it "deletes a host" do
115
+ mysql_db.del_host(host: 'cpanel_test.com')[:params][:result].should_not be_nil
116
+ end
117
+ end
118
+ end
119
+ end
File without changes
@@ -0,0 +1,30 @@
1
+ require "spec_helper"
2
+
3
+ module Lumberg
4
+ describe Cpanel::Net do
5
+ let(:server) { Whm::Server.new(host: @whm_host, hash: @whm_hash) }
6
+ let(:api_username) { "lumberg" }
7
+ let(:net) do
8
+ described_class.new(
9
+ server: server,
10
+ api_username: api_username
11
+ )
12
+ end
13
+
14
+ describe "#traceroute" do
15
+ use_vcr_cassette "cpanel/net/traceroute"
16
+
17
+ subject { net.traceroute[:params][:data] }
18
+
19
+ it { should be_an(Array) }
20
+ end
21
+
22
+ describe "#query_hostname" do
23
+ use_vcr_cassette "cpanel/net/query_hostname"
24
+
25
+ subject { net.query_hostname({ host: 'google.com' })[:params][:data] }
26
+
27
+ it { should be_an(Array) }
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,94 @@
1
+ require "spec_helper"
2
+
3
+ module Lumberg
4
+ describe Cpanel::Park do
5
+ before(:each) do
6
+ @login = { host: @whm_host, hash: @whm_hash }
7
+ @server = Whm::Server.new(@login.dup)
8
+
9
+ @api_username = "lumberg"
10
+ @park = Cpanel::Park.new(
11
+ server: @server.dup,
12
+ api_username: @api_username
13
+ )
14
+ end
15
+
16
+ describe "#add" do
17
+ use_vcr_cassette "cpanel/park/add"
18
+
19
+ it "creates a new parked domain" do
20
+ # Remove first
21
+ @park.remove(domain: "test-park.com")
22
+
23
+ result = @park.add(domain: "test-park.com")
24
+ result[:params][:data].first[:result].should == 1
25
+ end
26
+ end
27
+
28
+ describe "#remove" do
29
+ use_vcr_cassette "cpanel/park/remove"
30
+
31
+ it "removes a parked domain" do
32
+ # Add first
33
+ @park.add(domain: "test-park.com")
34
+
35
+ result = @park.remove(domain: "test-park.com")
36
+ result[:params][:data].first[:result].should == 1
37
+ end
38
+ end
39
+
40
+ describe "#list" do
41
+ use_vcr_cassette "cpanel/park/list"
42
+
43
+ context "parked domains exist on the account" do
44
+ let(:result) { @park.list }
45
+ subject { result[:params][:data] }
46
+
47
+ it "returns an array with info for each parked domain" do
48
+ subject.should be_an(Array)
49
+ subject.each {|info|
50
+ info.keys.should include(
51
+ :status, :reldir, :dir, :basedir, :domain
52
+ )
53
+ }
54
+ end
55
+ end
56
+
57
+ context "no parked domains exist on the account" do
58
+ before { @park.api_username = "minimal" }
59
+ after { @park.api_username = "lumberg" }
60
+
61
+ it "returns an empty array" do
62
+ @park.list[:params][:data].should be_empty
63
+ end
64
+ end
65
+ end
66
+
67
+ describe "#list_addon_domains" do
68
+ use_vcr_cassette "cpanel/park/list_addon_domains"
69
+
70
+ context "addon domains exist on the account" do
71
+ let(:result) { @park.list_addon_domains }
72
+ subject { result[:params][:data] }
73
+
74
+ it "returns an array with info for each addon domain" do
75
+ subject.should be_an(Array)
76
+ subject.each {|info|
77
+ info.keys.should include(
78
+ :status, :reldir, :dir, :basedir, :domain
79
+ )
80
+ }
81
+ end
82
+ end
83
+
84
+ context "no addon domains exist on the account" do
85
+ before { @park.api_username = "minimal" }
86
+ after { @park.api_username = "lumberg" }
87
+
88
+ it "returns an empty array" do
89
+ @park.list_addon_domains[:params][:data].should be_empty
90
+ end
91
+ end
92
+ end
93
+ end
94
+ end
@@ -0,0 +1,35 @@
1
+ require "spec_helper"
2
+
3
+ module Lumberg
4
+ describe Cpanel::Password do
5
+ let(:server) { Whm::Server.new(host: @whm_host, hash: @whm_hash) }
6
+ let(:api_username) { "lumberg" }
7
+ let(:password) do
8
+ described_class.new(
9
+ server: server,
10
+ api_username: api_username
11
+ )
12
+ end
13
+
14
+ let(:random_password) { "realtopsecretpassword" }
15
+
16
+ describe "#modify" do
17
+ use_vcr_cassette "cpanel/password/modify"
18
+
19
+ it "sets a new password for account" do
20
+ result = password.modify({ old: '12345', new: random_password })
21
+ result[:params][:data][0].should be_a(Hash)
22
+ end
23
+ end
24
+
25
+ describe "#digest_authentication" do
26
+ use_vcr_cassette "cpanel/password/digest_authentication"
27
+
28
+ it "enables digest authentication for account" do
29
+ result = password.digest_authentication({ password: random_password, enable: true })
30
+ result[:params][:data][0].should be_a(Hash)
31
+ end
32
+ end
33
+ end
34
+ end
35
+
@@ -0,0 +1,50 @@
1
+ require "spec_helper"
2
+
3
+ module Lumberg
4
+ describe Cpanel::PasswordStrength do
5
+ let(:server) { Whm::Server.new(host: @whm_host, hash: @whm_hash) }
6
+ let(:api_username) { "lumberg" }
7
+ let(:password_strength) do
8
+ described_class.new(
9
+ server: server,
10
+ api_username: api_username
11
+ )
12
+ end
13
+
14
+ let(:weak_password) { "weakness" }
15
+ let(:strong_password) { "0zUIcv-0" }
16
+
17
+ describe "#strength" do
18
+ use_vcr_cassette "cpanel/password_strength/strength"
19
+
20
+ it "tests a weak password" do
21
+ result = password_strength.strength( password: weak_password )
22
+ result[:params][:data][0][:strength].to_s.should =~ /\A\d+\z/
23
+ end
24
+
25
+ it "tests a strong password" do
26
+ result = password_strength.strength( password: strong_password )
27
+ result[:params][:data][0][:strength].to_s.should =~ /\A\d+\z/
28
+ end
29
+ end
30
+
31
+ describe "#required_strength" do
32
+ use_vcr_cassette "cpanel/password_strength/required_strength"
33
+
34
+ it "gets required password strength for a specific app" do
35
+ result = password_strength.required_strength( app: 'htaccess' )
36
+ result[:params][:data][0][:strength].should be_an(Integer)
37
+ end
38
+ end
39
+
40
+ describe "#all_required_strengths" do
41
+ use_vcr_cassette "cpanel/password_strength/all_required_strengths"
42
+
43
+ it "gets required password strengths for all apps" do
44
+ result = password_strength.all_required_strengths
45
+ result[:params][:data][0].should be_a(Hash)
46
+ end
47
+ end
48
+ end
49
+ end
50
+
@@ -0,0 +1,24 @@
1
+ require "spec_helper"
2
+
3
+ module Lumberg
4
+ describe Cpanel::RandomData do
5
+ let(:server) { Whm::Server.new(host: @whm_host, hash: @whm_hash) }
6
+ let(:api_username) { "lumberg" }
7
+ let(:random_data) do
8
+ described_class.new(
9
+ server: server,
10
+ api_username: api_username
11
+ )
12
+ end
13
+
14
+ describe "#show" do
15
+ use_vcr_cassette "cpanel/random_data/show"
16
+
17
+ it "gets a random string" do
18
+ result = random_data.show({ length: 10 })[:params][:data]
19
+ result[0][:random].size.should === 10
20
+ end
21
+ end
22
+
23
+ end
24
+ end
File without changes
@@ -0,0 +1,158 @@
1
+ require "spec_helper"
2
+
3
+
4
+ module Lumberg
5
+ describe Cpanel::Ssl do
6
+ let(:domain) { "lumberg-test.com" }
7
+ let(:server) { Whm::Server.new(host: @whm_host, hash: @whm_hash) }
8
+ let(:api_username) { "lumberg" }
9
+
10
+ CP_CERT = File.read('./spec/sample_certs/cpanel.crt')
11
+ CP_KEY = File.read('./spec/sample_certs/cpanel.key')
12
+
13
+ let(:cert_params) do
14
+ {
15
+ user: :api_username,
16
+ city: "Chicago",
17
+ company: "Initech",
18
+ company_division: "TPS",
19
+ country: "US",
20
+ state: "IL",
21
+ email: "lumberg@initech.com",
22
+ host: domain,
23
+ pass: "Tru3St0ry",
24
+ key: CP_KEY
25
+ }
26
+ end
27
+
28
+ let(:ssl) do
29
+ described_class.new(
30
+ server: server,
31
+ api_username: api_username
32
+ )
33
+ end
34
+
35
+ describe "#installssl" do
36
+ use_vcr_cassette("cpanel/ssl/installssl")
37
+
38
+ it "installs a certificate for a cPanel account" do
39
+ ssl.installssl(user: :api_username, crt: CP_CERT,
40
+ domain: domain, key: CP_KEY)[:params][:data][0][:result].should eq(1)
41
+ end
42
+ end
43
+
44
+ describe "#listcsrs" do
45
+ use_vcr_cassette("cpanel/ssl/listcsrs")
46
+
47
+ it "prints the csrs for a cPanel account" do
48
+ ssl.listcsrs(user: :api_username
49
+ )[:params][:data][0][:host].should == domain
50
+ end
51
+ end
52
+
53
+ describe "#showcsr" do
54
+ use_vcr_cassette("cpanel/ssl/showcsr")
55
+
56
+ it "prints the current csr for a domain" do
57
+ ssl.showcsr(user: :api_username, domain: domain, textmode: 0
58
+ )[:params].to_s.should =~ /CERTIFICATE REQUEST/
59
+ end
60
+ end
61
+
62
+ describe "#showkey" do
63
+ use_vcr_cassette("cpanel/ssl/showkey")
64
+
65
+ it "prints the current key for a domain" do
66
+ ssl.showkey(user: :api_username, domain: domain, textmode: 0
67
+ )[:params].to_s.should =~ /PRIVATE KEY/
68
+ end
69
+ end
70
+
71
+ describe "#showcrt" do
72
+ use_vcr_cassette("cpanel/ssl/showcrt")
73
+
74
+ it "prints the current cert for a domain" do
75
+ ssl.showcrt(user: :api_username, domain: domain, textmode: 0
76
+ )[:params].to_s.should =~ /BEGIN CERTIFICATE/
77
+ end
78
+ end
79
+
80
+ describe "#listcrts" do
81
+ use_vcr_cassette("cpanel/ssl/listcrts")
82
+
83
+ it "lists the certs installed for an account " do
84
+ ssl.listcrts(user: :api_username)[:params][:data][0][:ssltxt].to_s.should \
85
+ =~ /Certificate/
86
+ end
87
+ end
88
+
89
+ describe "#listkeys" do
90
+ use_vcr_cassette("cpanel/ssl/listkeys")
91
+
92
+ it "lists the keys installed for an account" do
93
+ ssl.listkeys(user: :api_username)[:params][:data][0][:host].should == domain
94
+ end
95
+ end
96
+
97
+ describe "#fetchcabundle" do
98
+ use_vcr_cassette("cpanel/ssl/fetchcabundle")
99
+
100
+ it "fetches the CA bundle tied to the cert if any exist" do
101
+ ssl.listsslitems(crt: CP_CERT)[:params][:event][:result].should eq(1)
102
+ end
103
+ end
104
+
105
+ describe "#listsslitems" do
106
+ use_vcr_cassette("cpanel/ssl/listsslitems")
107
+
108
+ it "lists keys for a domain" do
109
+ ssl.listsslitems(domains: domain, items: 'key')[:params][:data][0][:host].should \
110
+ == domain
111
+ end
112
+ end
113
+
114
+ describe "#gencsr" do
115
+ use_vcr_cassette "cpanel/ssl/gencsr"
116
+
117
+ it "generates a certificate signing request" do
118
+ ssl.gencsr(cert_params)[:params][:data][0][:result].should eq(1)
119
+ end
120
+ end
121
+
122
+ describe "#gencrt" do
123
+ use_vcr_cassette "cpanel/ssl/gencrt"
124
+
125
+ it "generates a certificate" do
126
+ ssl.gencrt(cert_params.merge(key: CP_KEY))[:params][:data][0][:result].should eq(1)
127
+ end
128
+ end
129
+
130
+ describe "#genkey" do
131
+ use_vcr_cassette("cpanel/ssl/genkey")
132
+
133
+ it "generates a key" do
134
+ ssl.genkey(user: api_username, host: domain, keysize: 2048
135
+ )[:params][:data][0][:result].should eq(1)
136
+ end
137
+ end
138
+
139
+ describe "#uploadcrt" do
140
+ use_vcr_cassette("cpanel/ssl/uploadcrt")
141
+
142
+ it "uploads a certificate " do
143
+ ssl.uploadcrt(user: api_username, crt: CP_CERT,
144
+ host: domain)[:params][:data][0][:result].should eq(1)
145
+ end
146
+ end
147
+
148
+ describe "#remove" do
149
+ use_vcr_cassette "cpanel/ssl/remove"
150
+
151
+ subject { ssl.remove(domain: domain)[:params][:result] }
152
+
153
+ it "removes a certificate " do
154
+ subject.should include "The SSL host was successfully removed."
155
+ end
156
+ end
157
+ end
158
+ end