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
@@ -4,43 +4,28 @@ require 'lumberg/whm'
4
4
  module Lumberg
5
5
  describe Whm::Account do
6
6
  before(:each) do
7
- @login = { :host => @whm_host, :hash => @whm_hash }
7
+ @login = { host: @whm_host, hash: @whm_hash }
8
8
  @server = Whm::Server.new(@login.dup)
9
- @account = Whm::Account.new(:server => @server.dup)
9
+ @account = Whm::Account.new(server: @server.dup)
10
10
  end
11
11
 
12
12
  describe "#create" do
13
13
  use_vcr_cassette "whm/account/createacct"
14
14
 
15
- it "requires a username" do
16
- requires_attr('username') { @account.create }
17
- end
18
-
19
- it "requires a domain" do
20
- requires_attr('domain') { @account.create(:username => 'user') }
21
- end
22
-
23
- it "requires a password" do
24
- requires_attr('password') {
25
- @account.create(:username => 'user', :domain => 'example.com')
26
- }
27
- end
28
-
29
15
  it "creates the account with proper params" do
30
- result = @account.create(:username => 'valid', :password => 'hummingbird123', :domain => 'valid-thing.com')
16
+ result = @account.create(username: 'valid', password: 'hummingbird123', domain: 'valid-thing.com')
31
17
  result[:success].should be_true
32
18
  result[:message].should match(/Account Creation Ok/i)
33
19
  result[:params].should_not be_empty
34
20
  result[:params].should have_key(:options)
35
- result[:params][:options].should include(:nameserver4, :nameserver, :nameserverentry2, :nameserverentry3,
36
- :nameserverentry4, :nameserverentry, :ip, :nameservera2,
37
- :nameservera3, :package, :nameservera4, :nameserver2,
21
+ result[:params][:options].should include(:nameserver4, :nameserver, :nameserverentry2, :nameserverentry3,
22
+ :nameserverentry4, :nameserverentry, :ip, :nameservera2,
23
+ :nameservera3, :package, :nameservera4, :nameserver2,
38
24
  :nameservera, :nameserver3)
39
25
  end
40
26
 
41
27
  it "returns an error on duplicate accounts" do
42
- @account.create(:username => 'invalid', :password => 'hummingbird123', :domain => 'invalid-thing.com')
43
- result = @account.create(:username => 'invalid', :password => 'hummingbird123', :domain => 'invalid-thing.com')
28
+ result = @account.create(username: 'invalid', password: 'hummingbird123', domain: 'invalid-thing.com')
44
29
  result[:success].should be(false)
45
30
  result[:message].should match(/username already exists/i)
46
31
  end
@@ -49,30 +34,26 @@ module Lumberg
49
34
  describe "#remove" do
50
35
  use_vcr_cassette "whm/account/removeacct"
51
36
 
52
- it "requires a username" do
53
- requires_attr('username') { @account.remove }
54
- end
55
-
56
37
  it "removes a user and keeps DNS by default" do
57
- result = @account.remove(:username => 'removeme')
38
+ result = @account.remove(username: 'removeme')
58
39
  result[:success].should be_true
59
40
  result[:params][:rawout].should match(/Removing DNS Entries/i)
60
41
  end
61
42
 
62
43
  it "removes a user and DNS when asked" do
63
- result = @account.remove(:username => 'removeme', :keepdns => false)
44
+ result = @account.remove(username: 'removeme', keepdns: false)
64
45
  result[:success].should be_true
65
46
  result[:params][:rawout].should match(/Removing DNS Entries/i)
66
47
  end
67
48
 
68
49
  it "removes a user but keep DNS" do
69
- result = @account.remove(:username => 'removeme', :keepdns => true)
50
+ result = @account.remove(username: 'removeme', keepdns: true)
70
51
  result[:success].should be_true
71
52
  result[:params][:rawout].should_not match(/Removing DNS Entries/i)
72
53
  end
73
54
 
74
55
  it "returns an error when the user doesn't exist" do
75
- result = @account.remove(:username => 'notreal')
56
+ result = @account.remove(username: 'notreal')
76
57
  result[:success].should be(false)
77
58
  result[:message].should match(/notreal does not exist/i)
78
59
  end
@@ -81,22 +62,14 @@ module Lumberg
81
62
  describe "#change_password" do
82
63
  use_vcr_cassette "whm/account/passwd"
83
64
 
84
- it "requires a username" do
85
- requires_attr('username') { @account.change_password }
86
- end
87
-
88
- it "requires a password" do
89
- requires_attr('password') { @account.change_password(:username => 'changeme') }
90
- end
91
-
92
65
  it "changes the password" do
93
- result = @account.change_password(:username => 'changeme', :password => 'superpass')
66
+ result = @account.change_password(username: 'changeme', password: 'superpass')
94
67
  result[:success].should be_true
95
68
  result[:message].should match(/Password changed for user changeme/i)
96
69
  end
97
70
 
98
71
  it "isn't successful when the user doesn't exist" do
99
- result = @account.change_password(:username => 'dontchangeme', :password => 'superpass')
72
+ result = @account.change_password(username: 'dontchangeme', password: 'superpass')
100
73
  result[:success].should be(false)
101
74
  result[:message].should match(/dontchangeme does not exist/i)
102
75
  end
@@ -105,16 +78,8 @@ module Lumberg
105
78
  describe "#limit bandwidth" do
106
79
  use_vcr_cassette "whm/account/limitbw"
107
80
 
108
- it "requires a user" do
109
- requires_attr('username') { @account.limit_bandwidth(:bwlimit => 99999) }
110
- end
111
-
112
- it "requires a bandwidth" do
113
- requires_attr('bwlimit') { @account.limit_bandwidth(:username => 'changeme') }
114
- end
115
-
116
81
  it "sets the bandwidth limit" do
117
- result = @account.limit_bandwidth(:username => 'changeme', :bwlimit => 99999)
82
+ result = @account.limit_bandwidth(username: 'changeme', bwlimit: 99999)
118
83
  result[:success].should be_true
119
84
  result[:message].should match(/Bandwidth Limit for changeme set to 99999/i)
120
85
  result[:params][:bwlimit][:bwlimitenable].should equal(false)
@@ -122,11 +87,11 @@ module Lumberg
122
87
  end
123
88
 
124
89
  it "isn't successful when the user doesn't exist" do
125
- expect {
126
- @account.limit_bandwidth(:username => 'notexists', :bwlimit => 99999)
90
+ expect {
91
+ @account.limit_bandwidth(username: 'notexists', bwlimit: 99999)
127
92
  }.to raise_error(WhmInvalidUser, /User notexists does not exist/i)
128
93
  end
129
- end
94
+ end
130
95
 
131
96
  describe "#list" do
132
97
  use_vcr_cassette "whm/account/listaccts"
@@ -139,7 +104,7 @@ module Lumberg
139
104
  end
140
105
 
141
106
  it "returns data for the account" do
142
- result = @account.list(:searchtype => 'user', :search => 'changeme')
107
+ result = @account.list(searchtype: 'user', search: 'changeme')
143
108
  result[:success].should be_true
144
109
  account = result[:params][:acct].first
145
110
  account[:email].should == "*unknown*"
@@ -150,82 +115,82 @@ module Lumberg
150
115
  end
151
116
 
152
117
  it "lists accounts that match a regex search for the user" do
153
- result = @account.list(:searchtype => 'user', :search => 'changeme')
118
+ result = @account.list(searchtype: 'user', search: 'changeme')
154
119
  result[:success].should be_true
155
120
  result[:params][:acct].should have(1).account
156
121
  end
157
122
 
158
123
  it "lists accounts that match a regex search for the ip" do
159
- result = @account.list(:searchtype => 'ip', :search => '192\..*?\.1\.20')
124
+ result = @account.list(searchtype: 'ip', search: '192\..*?\.1\.20')
160
125
  result[:success].should be_true
161
126
  result[:params][:acct].should have(6).accounts
162
127
  end
163
128
 
164
129
  it "lists accounts that match a regex search for the domain" do
165
- result = @account.list(:searchtype => 'domain', :search => 'ch.*?e.com')
130
+ result = @account.list(searchtype: 'domain', search: 'ch.*?e.com')
166
131
  result[:success].should be_true
167
132
  result[:params][:acct].should have(1).account
168
133
  end
169
- end
134
+ end
170
135
 
171
136
  describe "#modify" do
172
137
  use_vcr_cassette "whm/account/modifyacct"
173
138
 
174
139
  it "allows domain modification" do
175
- result = @account.modify(:username => 'changeme', :domain => 'example.com')
140
+ result = @account.modify(username: 'changeme', domain: 'example.com')
176
141
  result[:success].should be_true
177
142
  result[:params][:newcfg][:cpuser][:DOMAIN].should == 'example.com'
178
143
  end
179
144
 
180
145
  it "returns an error for an invalid user" do
181
- result = @account.modify(:username => 'notexists')
146
+ result = @account.modify(username: 'notexists')
182
147
  result[:success].should_not be_true
183
148
  result[:message].should match(/Unable to fetch the cPanel user file for notexists/)
184
149
  end
185
150
 
186
151
  it "returns the bandwidth limit" do
187
- result = @account.modify(:username => 'changeme')
188
- result[:params][:newcfg][:cpuser][:BWLIMIT].should == "unlimited"
152
+ result = @account.modify(username: 'changeme')
153
+ result[:params][:newcfg][:cpuser][:BWLIMIT].should == "unlimited"
189
154
  end
190
155
 
191
156
  it "returns the primary contact email" do
192
- result = @account.modify(:username => 'changeme')
157
+ result = @account.modify(username: 'changeme')
193
158
  result[:params][:newcfg][:cpuser][:CONTACTEMAIL].should == "user@address.com"
194
159
  end
195
160
 
196
161
  it "returns the secondary contact email" do
197
- result = @account.modify(:username => 'changeme')
162
+ result = @account.modify(username: 'changeme')
198
163
  result[:params][:newcfg][:cpuser][:CONTACTEMAIL2].should == "user2@address.com"
199
164
  end
200
165
 
201
166
  it "returns the main domain" do
202
- result = @account.modify(:username => 'changeme')
167
+ result = @account.modify(username: 'changeme')
203
168
  result[:params][:newcfg][:cpuser][:DOMAIN].should == "example.com"
204
169
  end
205
170
 
206
171
  it "returns whether or not the domain has CGI access" do
207
- result = @account.modify(:username => 'changeme')
172
+ result = @account.modify(username: 'changeme')
208
173
  result[:params][:newcfg][:cpuser][:HASCGI].should be_true
209
174
  end
210
- end
175
+ end
211
176
 
212
177
  describe "#editquota" do
213
178
  use_vcr_cassette "whm/account/editquota"
214
179
 
215
180
  it "returns an error for an invalid user" do
216
- result = @account.edit_quota(:username => 'notexists', :quota => 500)
181
+ result = @account.edit_quota(username: 'notexists', quota: 500)
217
182
  result[:success].should_not be_true
218
183
  result[:message].should match(/Invalid User\. Cannot set quota\./i)
219
184
  end
220
185
 
221
186
  it "changes the user's disk space usage quota" do
222
- result = @account.edit_quota(:username => 'changeme', :quota => 500)
187
+ result = @account.edit_quota(username: 'changeme', quota: 500)
223
188
  result[:success].should be_true
224
189
  result[:message].should match(/Set quota for user./i)
225
190
  end
226
191
 
227
192
  it "returns an error if a negative usage quota is passed" do
228
- result = @account.edit_quota(:username => 'changeme', :quota => -1)
193
+ result = @account.edit_quota(username: 'changeme', quota: -1)
229
194
  result[:success].should_not be_true
230
195
  result[:message].should match(/Failed to set quota for user\./i)
231
196
  end
@@ -233,75 +198,66 @@ module Lumberg
233
198
 
234
199
  describe "#summary" do
235
200
  use_vcr_cassette "whm/account/accountsummary"
236
- it "requires a user" do
237
- requires_attr('username') { @account.create }
238
- end
239
201
 
240
202
  it "returns an error for invalid users" do
241
- result = @account.summary(:username => 'notexists')
203
+ result = @account.summary(username: 'notexists')
242
204
  result[:success].should_not be_true
243
205
  result[:message].should match(/does not exist/i)
244
206
  end
245
207
 
246
208
  it "returns a summary" do
247
- result = @account.summary(:username => 'summary')
209
+ result = @account.summary(username: 'summary')
248
210
  result[:success].should be_true
249
211
  result[:message].should match(/ok/i)
250
212
  end
251
- end
213
+ end
252
214
 
253
215
  describe "#suspend" do
254
216
  use_vcr_cassette "whm/account/suspend"
255
217
 
256
- it "requires a username" do
257
- requires_attr('username') { @account.suspend }
258
- end
259
-
260
218
  it "returns an error for invalid users" do
261
- result = @account.suspend(:username => 'notexists')
219
+ result = @account.suspend(username: 'notexists')
262
220
  result[:success].should_not be_true
263
221
  result[:message].should match(/does not exist/i)
264
222
  end
265
223
 
266
224
  it "suspends" do
267
- result = @account.suspend(:username => 'suspendme')
225
+ result = @account.suspend(username: 'suspendme')
268
226
  result[:success].should be_true
269
227
  result[:message].should match(/has been suspended/i)
270
228
  end
271
229
 
272
230
  it "suspends with a reason" do
273
- @account.server.should_receive(:perform_request).with('suspendacct', hash_including(:user => 'suspendme', :reason => 'abusive user'))
274
- @account.suspend(:username => 'suspendme', :reason => 'abusive user')
231
+ @account.server.should_receive(:perform_request).with('suspendacct', hash_including(user: 'suspendme', reason: 'abusive user'))
232
+ @account.suspend(username: 'suspendme', reason: 'abusive user')
275
233
  end
276
- end
234
+ end
277
235
 
278
236
  describe "#unsuspend" do
279
237
  use_vcr_cassette "whm/account/unsuspend"
280
- it "require a username" do
281
- requires_attr('username') { @account.unsuspend }
282
- end
283
238
 
284
239
  it "returns an error for invalid users" do
285
- result = @account.unsuspend(:username => 'notexists')
240
+ result = @account.unsuspend(username: 'notexists')
286
241
  result[:success].should_not be_true
287
242
  result[:message].should match(/does not exist/i)
288
243
  end
289
244
 
290
245
  it "unsuspends" do
291
- result = @account.unsuspend(:username => 'asdfasdf')
246
+ result = @account.unsuspend(username: 'asdfasdf')
292
247
  result[:success].should be_true
293
248
  result[:message].should match(/unsuspending .* account/i)
294
249
  end
295
- end
250
+ end
296
251
 
297
252
  describe "#list_suspended" do
298
253
  use_vcr_cassette 'whm/account/listsuspended'
254
+
299
255
  it "returns non-empty result" do
300
256
  # empty isn't a real param. VCR Hacks
301
- result = @account.list_suspended(:empty => true)
257
+ result = @account.list_suspended(empty: true)
302
258
  result[:success].should be_true
303
259
  result[:params][:accts].should_not be_empty
304
- result[:params][:accts].first.should include(:user => 'removeme')
260
+ result[:params][:accts].first.should include(user: 'removeme')
305
261
  end
306
262
 
307
263
  it "returns empty result" do
@@ -309,80 +265,65 @@ module Lumberg
309
265
  result[:success].should be_true
310
266
  result[:params][:accts].should be_empty
311
267
  end
312
- end
268
+ end
313
269
 
314
270
  describe "#change package" do
315
271
  use_vcr_cassette "whm/account/changepackage"
316
272
 
317
273
  it "returns an error for an invalid user" do
318
- result = @account.change_package(:username => 'notexists', :pkg => 'default')
274
+ result = @account.change_package(username: 'notexists', pkg: 'default')
319
275
  result[:success].should_not be_true
320
276
  result[:message].should match(/user notexists does not exist/i)
321
277
  end
322
278
 
323
- it "requires a username" do
324
- requires_attr('username') { @account.change_package(:pkg => '') }
325
- end
326
-
327
- it "requires a pkg" do
328
- requires_attr('pkg') { @account.change_package(:username => 'changeme') }
329
- end
330
-
331
279
  it "fails if the package was not found" do
332
- result = @account.change_package(:username => 'changeme', :pkg => 'fakepackage')
280
+ result = @account.change_package(username: 'changeme', pkg: 'fakepackage')
333
281
  result[:success].should_not be_true
334
282
  result[:message].should match(/package does not exist/i)
335
283
  end
336
284
 
337
285
  it "changes the package" do
338
- result = @account.change_package(:username => 'changeme', :pkg => 'gold')
286
+ result = @account.change_package(username: 'changeme', pkg: 'gold')
339
287
  result[:success].should be_true
340
288
  result[:message].should match(/Account Upgrade\/Downgrade Complete for changeme/i)
341
289
  end
342
- end
290
+ end
343
291
 
344
292
  describe "#privs" do
345
293
  use_vcr_cassette 'whm/account/myprivs'
346
- it "requires a user" do
347
- requires_attr('username') { @account.privs }
348
- end
349
294
 
350
295
  it "has a result" do
351
- result = @account.privs(:username => 'privs')
296
+ result = @account.privs(username: 'privs')
352
297
  result[:success].should be_true
353
298
 
354
299
  params = result[:params]
355
300
  expected = {
356
- :kill_dns => false, :edit_dns => false, :edit_mx => false, :add_pkg => false,
357
- :suspend_acct => false, :add_pkg_shell => false, :viewglobalpackages => false,
358
- :resftp => false, :list_accts => false, :all => true, :passwd => false, :quota => false,
359
- :park_dns => false, :rearrange_accts => false, :allow_addoncreate => false, :demo => false,
360
- :news => false, :edit_account => false, :allow_unlimited_disk_pkgs => false, :allow_parkedcreate => false,
361
- :frontpage => false, :restart => false, :ssl_gencrt => false, :allow_unlimited_pkgs => false,
362
- :add_pkg_ip => false, :disallow_shell => false, :res_cart => false, :ssl_buy => false, :kill_acct => false,
363
- :allow_unlimited_bw_pkgs => false, :create_dns => false, :mailcheck => false, :clustering => false, :ssl => false,
364
- :edit_pkg => false, :locale_edit => false, :show_bandwidth => false, :upgrade_account => false, :thirdparty => false,
365
- :limit_bandwidth => false, :create_acct => false, :demo_setup => false, :stats => false}
301
+ kill_dns: false, edit_dns: false, edit_mx: false, add_pkg: false,
302
+ suspend_acct: false, add_pkg_shell: false, viewglobalpackages: false,
303
+ resftp: false, list_accts: false, all: true, passwd: false, quota: false,
304
+ park_dns: false, rearrange_accts: false, allow_addoncreate: false, demo: false,
305
+ news: false, edit_account: false, allow_unlimited_disk_pkgs: false, allow_parkedcreate: false,
306
+ frontpage: false, restart: false, ssl_gencrt: false, allow_unlimited_pkgs: false,
307
+ add_pkg_ip: false, disallow_shell: false, res_cart: false, ssl_buy: false, kill_acct: false,
308
+ allow_unlimited_bw_pkgs: false, create_dns: false, mailcheck: false, clustering: false, ssl: false,
309
+ edit_pkg: false, locale_edit: false, show_bandwidth: false, upgrade_account: false, thirdparty: false,
310
+ limit_bandwidth: false, create_acct: false, demo_setup: false, stats: false}
366
311
 
367
312
  params.should include(expected)
368
313
  end
369
- end
314
+ end
370
315
 
371
316
  describe "#domainuserdata" do
372
317
  use_vcr_cassette "whm/account/domainuserdata"
373
318
 
374
319
  it "returns an error for an unknown domain" do
375
- result = @account.domain_user_data(:domain => 'notexists.com')
320
+ result = @account.domain_user_data(domain: 'notexists.com')
376
321
  result[:success].should_not be_true
377
322
  result[:message].should match(/Unable to determine account owner for domain\./i)
378
323
  end
379
324
 
380
- it "requires a domain" do
381
- requires_attr('domain') { @account.domain_user_data }
382
- end
383
-
384
325
  it "returns the correct data" do
385
- result = @account.domain_user_data(:domain => 'example.com')
326
+ result = @account.domain_user_data(domain: 'example.com')
386
327
  result[:success].should be_true
387
328
  result[:params][:documentroot].should == "/home/changeme/public_html"
388
329
  result[:params][:group].should == "changeme"
@@ -398,159 +339,59 @@ module Lumberg
398
339
  result[:params][:servername].should == "example.com"
399
340
  result[:params][:user].should == "changeme"
400
341
  end
401
- end
342
+ end
402
343
 
403
344
  describe "#setsiteip" do
404
345
  use_vcr_cassette "whm/account/setsiteip"
405
346
 
406
- it "requires an ip" do
407
- requires_attr('ip') { @account.set_site_ip }
408
- end
409
-
410
- it "requires a username or a domain" do
411
- expect { @account.set_site_ip(:ip => '1.1.1.1') }.to raise_error(WhmArgumentError, /may include only one of 'username, domain'/i)
412
- end
413
-
414
347
  it "accepts a username for the account to use" do
415
- result = @account.set_site_ip(:ip => '192.1.2.3', :username => 'changeme')
348
+ result = @account.set_site_ip(ip: '192.1.2.3', username: 'changeme')
416
349
  result[:success].should be_true
417
350
  end
418
351
 
419
352
  it "accepts a domain for the account to use" do
420
- result = @account.set_site_ip(:ip => '192.1.2.3', :domain => 'example.com')
353
+ result = @account.set_site_ip(ip: '192.1.2.3', domain: 'example.com')
421
354
  result[:success].should be_true
422
355
  end
423
356
 
424
357
  it "sets the site ip" do
425
- result = @account.set_site_ip(:ip => '192.1.2.3', :username => 'changeme')
358
+ result = @account.set_site_ip(ip: '192.1.2.3', username: 'changeme')
426
359
  result[:success].should be_true
427
360
  result[:message].should match(/OK/i)
428
361
  end
429
- end
362
+ end
430
363
 
431
364
  describe "#restore" do
432
365
  # 11.27/11.28+ only
433
366
  use_vcr_cassette "whm/account/restoreaccount"
434
- it "requires api.version" do
435
- requires_attr('api.version') {
436
- @account.restore_account(:username => 'changeme',
437
- :type => 'monthly',
438
- :all => false,
439
- :ip => false,
440
- :mail => false,
441
- :mysql => false,
442
- :subs => false)
443
- }
444
- end
445
-
446
- it "requires a username" do
447
- requires_attr('username') {
448
- @account.restore_account("api.version".to_sym => 1,
449
- :type => 'monthly',
450
- :all => false,
451
- :ip => false,
452
- :mail => false,
453
- :mysql => false,
454
- :subs => false)
455
- }
456
- end
457
-
458
- it "requires type" do
459
- requires_attr('type') {
460
- @account.restore_account("api.version".to_sym => 1,
461
- :username => 'changeme',
462
- :all => false,
463
- :ip => false,
464
- :mail => false,
465
- :mysql => false,
466
- :subs => false)
467
- }
468
- end
469
-
470
- it "requires all" do
471
- requires_attr('all') {
472
- @account.restore_account("api.version".to_sym => 1,
473
- :username => 'changeme',
474
- :type => 'monthly',
475
- :ip => false,
476
- :mail => false,
477
- :mysql => false,
478
- :subs => false)
479
- }
480
- end
481
-
482
- it "requires ip" do
483
- requires_attr('ip') {
484
- @account.restore_account("api.version".to_sym => 1,
485
- :username => 'changeme',
486
- :type => 'monthly',
487
- :all => false,
488
- :mail => false,
489
- :mysql => false,
490
- :subs => false)
491
- }
492
- end
493
-
494
- it "requires mail" do
495
- requires_attr('mail') { @account.restore_account("api.version".to_sym => 1,
496
- :username => 'changeme',
497
- :type => 'monthly',
498
- :all => false,
499
- :ip => false,
500
- :mysql => false,
501
- :subs => false)
502
- }
503
- end
504
-
505
- it "requires mysql" do
506
- requires_attr('mysql') { @account.restore_account("api.version".to_sym => 1,
507
- :username => 'changeme',
508
- :type => 'monthly',
509
- :all => false,
510
- :ip => false,
511
- :mail => false,
512
- :subs => false)
513
- }
514
- end
515
-
516
- it "require subs" do
517
- requires_attr('subs') { @account.restore_account("api.version".to_sym => 1,
518
- :username => 'changeme',
519
- :type => 'monthly',
520
- :all => false,
521
- :ip => false,
522
- :mail => false,
523
- :mysql => false)
524
- }
525
- end
526
367
 
527
368
  it "returns an error if it can't find the backup" do
528
- result = @account.restore_account("api.version".to_sym => 1,
529
- :username => 'notexists',
530
- :type => 'daily',
531
- :all => false,
532
- :ip => false,
533
- :mail => false,
534
- :mysql => false,
535
- :subs => false)
369
+ result = @account.restore_account("api.version".to_sym => 1,
370
+ username: 'notexists',
371
+ type: 'daily',
372
+ all: false,
373
+ ip: false,
374
+ mail: false,
375
+ mysql: false,
376
+ subs: false)
536
377
  result[:params][:result].to_i.should == 0
537
378
  result[:params][:reason].should match(/Unable to find archive/i)
538
379
  end
539
380
 
540
381
  it "restores the account" do
541
- result = @account.restore_account("api.version".to_sym => 1,
542
- :username => 'changeme',
543
- :type => 'daily',
544
- :all => false,
545
- :ip => false,
546
- :mail => false,
547
- :mysql => false,
548
- :subs => false)
382
+ result = @account.restore_account("api.version".to_sym => 1,
383
+ username: 'changeme',
384
+ type: 'daily',
385
+ all: false,
386
+ ip: false,
387
+ mail: false,
388
+ mysql: false,
389
+ subs: false)
549
390
  result[:params][:result].to_i.should == 1
550
391
  result[:params][:reason].should == "OK"
551
392
  result[:params][:output][:raw].should match(/Account Restore Complete/i)
552
393
  end
553
- end
394
+ end
554
395
 
555
396
  describe "#verify_user" do
556
397
  use_vcr_cassette "whm/account/accountsummary"
@@ -559,7 +400,7 @@ module Lumberg
559
400
 
560
401
  it "does not call the block if the user doesn't exist" do
561
402
  @something.should_not_receive(:gold)
562
- expect {
403
+ expect {
563
404
  @account.send(:verify_user, 'notexists') do
564
405
  @something.gold
565
406
  end
@@ -4,22 +4,18 @@ require 'lumberg/whm'
4
4
  module Lumberg
5
5
  describe Whm::Base do
6
6
  before(:each) do
7
- @login = { :host => @whm_host, :hash => @whm_hash }
7
+ @login = { host: @whm_host, hash: @whm_hash }
8
8
  @server = Whm::Server.new(@login.dup)
9
- @base = Whm::Base.new(:server => @server)
9
+ @base = Whm::Base.new(server: @server)
10
10
  end
11
11
 
12
12
  describe "#initialize" do
13
- it "creates a new instance of server" do
14
- expect { Whm::Base.new }.to raise_error(WhmArgumentError, /Missing required param/)
15
- end
16
-
17
13
  it "allows a server instance to be passed in" do
18
14
  @base.server.should be_a(Whm::Server)
19
15
  end
20
16
 
21
17
  it "allows a server hash to be passed in" do
22
- base = Whm::Base.new(:server => @login)
18
+ base = Whm::Base.new(server: @login)
23
19
  base.server.should be_a(Whm::Server)
24
20
  end
25
21
  end