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
data/.gitignore DELETED
@@ -1,10 +0,0 @@
1
- pkg/*
2
- *.gem
3
- .bundle
4
- .idea
5
- *.swp
6
- test.rb
7
- *~
8
- coverage/
9
- doc/
10
- Gemfile.lock
data/.rspec DELETED
@@ -1,2 +0,0 @@
1
- --format documentation
2
- --color
data/.rvmrc DELETED
@@ -1,49 +0,0 @@
1
- #!/usr/bin/env bash
2
-
3
- # This is an RVM Project .rvmrc file, used to automatically load the ruby
4
- # development environment upon cd'ing into the directory
5
-
6
- # First we specify our desired <ruby>[@<gemset>], the @gemset name is optional.
7
- environment_id="ruby-1.9.2-p180@lumberg"
8
-
9
- #
10
- # First we attempt to load the desired environment directly from the environment
11
- # file. This is very fast and efficicent compared to running through the entire
12
- # CLI and selector. If you want feedback on which environment was used then
13
- # insert the word 'use' after --create as this triggers verbose mode.
14
- #
15
- if [[ -d "${rvm_path:-$HOME/.rvm}/environments" \
16
- && -s "${rvm_path:-$HOME/.rvm}/environments/$environment_id" ]] ; then
17
- \. "${rvm_path:-$HOME/.rvm}/environments/$environment_id"
18
-
19
- [[ -s ".rvm/hooks/after_use" ]] && . ".rvm/hooks/after_use"
20
- else
21
- # If the environment file has not yet been created, use the RVM CLI to select.
22
- rvm --create use "$environment_id"
23
- fi
24
-
25
- #
26
- # If you use an RVM gemset file to install a list of gems (*.gems), you can have
27
- # it be automatically loaded. Uncomment the following and adjust the filename if
28
- # necessary.
29
- #
30
- # filename=".gems"
31
- # if [[ -s "$filename" ]] ; then
32
- # rvm gemset import "$filename" | grep -v already | grep -v listed | grep -v complete | sed '/^$/d'
33
- # fi
34
-
35
- #
36
- # If you use bundler and would like to run bundle each time you enter the
37
- # directory, you can uncomment the following code.
38
- #
39
- # # Ensure that Bundler is installed. Install it if it is not.
40
- # if ! command -v bundle >/dev/null; then
41
- # printf "The rubygem 'bundler' is not installed. Installing it now.\n"
42
- # gem install bundler
43
- # fi
44
- #
45
- # # Bundle while reducing excess noise.
46
- # printf "Bundling your gems. This may take a few minutes on a fresh clone.\n"
47
- # bundle | grep -v '^Using ' | grep -v ' is complete' | sed '/^$/d'
48
- #
49
-
data/.travis.yml DELETED
@@ -1,11 +0,0 @@
1
- script: "bundle exec rake spec"
2
- notifications:
3
- disabled: true
4
- rvm:
5
- - 1.8.7
6
- - 1.9.2
7
- - 1.9.3
8
- - ree
9
- - rbx
10
- - rbx-head
11
- - jruby
@@ -1,113 +0,0 @@
1
- module Lumberg
2
-
3
- #
4
- # ==== Optional
5
- # * <tt>:whatever</tt> - PENDING
6
- module Whm
7
- class Args
8
- attr_reader :required_params, :boolean_params, :optional_params, :one_of_params
9
- attr_reader :options
10
- # Check the included hash for the included parameters.
11
- # Raises WhmArgumentError when it's mising the proper params
12
- #
13
- # ==== Example
14
- #
15
- # Args.new(options) do |c|
16
- # c.requries :user, :pass
17
- # c.booleans :name
18
- # c.optionals :whatever
19
- # end
20
- def initialize(options)
21
- @required_params ||= []
22
- @boolean_params ||= []
23
- @optional_params ||= []
24
- @one_of_params ||= []
25
- @options = options
26
-
27
- yield self
28
-
29
- requires!
30
- booleans!
31
- one_ofs!
32
- valid_options!
33
- end
34
-
35
- # Specifies the required arguments
36
- def requires(*values)
37
- @optional_params.concat(values)
38
- @required_params = values
39
- end
40
-
41
- # Specifies which arguments are boolean
42
- def booleans(*values)
43
- @optional_params.concat(values)
44
- @boolean_params = values
45
- end
46
-
47
- # Specifies which arguments are optional
48
- def optionals(*values)
49
- @optional_params.concat(values)
50
- end
51
-
52
- # Specifies which arguments take one of a set of arguments
53
- def one_of(*values)
54
- @optional_params.concat(values)
55
- @one_of_params = values
56
- end
57
-
58
- protected
59
-
60
- # Verifies that all required arguments are present
61
- def requires!
62
- @required_params.each do |param|
63
- key = (param.is_a?(Array) ? param.first : param)
64
- verify_required_param(key)
65
- end
66
- end
67
-
68
-
69
- # Checks to see if supplied params (which are booleans) contain
70
- # either a 1 ("Yes") or 0 ("No") value.
71
- def booleans!
72
- @boolean_params.each do |param|
73
- key = (param.is_a?(Array) ? param.first : param)
74
- verify_boolean_param(key)
75
- end
76
- end
77
-
78
- # Verifies that only valid arguments were set
79
- def valid_options!
80
- @options.keys.uniq.each do |key|
81
- raise WhmArgumentError.new("Not a valid parameter: #{key}") unless @optional_params.include?(key)
82
- end
83
- end
84
-
85
- # Verifies that the one_of arguments were used correctly
86
- def one_ofs!
87
- if @one_of_params.size > 1
88
- specified = @options.keys.select { |key| @one_of_params.include?(key) }.uniq
89
- if specified.size > 1 || specified.size == 0
90
- raise WhmArgumentError.new("The parameters may include only one of '#{@one_of_params.join(', ')}'")
91
- end
92
- else
93
- raise WhmArgumentError.new("One of requires two or more items") unless @one_of_params.empty?
94
- end
95
- end
96
-
97
- private
98
-
99
- # Internal method for verifiying required arguments
100
- def verify_required_param(param)
101
- raise WhmArgumentError.new("Missing required parameter: #{param}") unless @options.has_key?(param)
102
- raise WhmArgumentError.new("Required parameter cannot be blank: #{param}") if (@options[param].nil? || (@options[param].respond_to?(:empty?) && @options[param].empty?))
103
- end
104
-
105
- # Internal method for verifying boolean arguments
106
- def verify_boolean_param(param)
107
- if @options.include?(param) && ![true, false].include?(@options[param])
108
- raise WhmArgumentError.new("Boolean parameter must be \"true\" or \"false\": #{param}")
109
- end
110
- end
111
- end
112
- end
113
- end
@@ -1,42 +0,0 @@
1
- module Net
2
- class HTTP
3
- @skip_bad_headers = false
4
-
5
- class << self
6
- # Accessor for @skip_bad_headers
7
- def skip_bad_headers
8
- @skip_bad_headers
9
- end
10
-
11
- # Mutator for @skip_bad_headers
12
- def skip_bad_headers=(value)
13
- @skip_bad_headers = value
14
- end
15
- end
16
- end
17
-
18
- class << HTTPResponse
19
- # Parses each response header and strips out bad headers if skip_bad_headers is set
20
- def each_response_header(sock)
21
- key = value = nil
22
- while true
23
- line = sock.readuntil("\n", true).sub(/\s+\z/, '')
24
- break if line.empty?
25
- if line[0] == ?\s or line[0] == ?\t and value
26
- value << ' ' unless value.empty?
27
- value << line.strip
28
- else
29
- tmp_key, tmp_value = line.strip.split(/\s*:\s*/, 2)
30
- next if tmp_value.nil? && Net::HTTP.skip_bad_headers
31
-
32
- yield key, value if key
33
-
34
- key = tmp_key
35
- value = tmp_value
36
- raise HTTPBadResponse, 'wrong header line format' if value.nil?
37
- end
38
- end
39
- yield key, value if key
40
- end
41
- end
42
- end
data/lumberg.gemspec DELETED
@@ -1,28 +0,0 @@
1
- # -*- encoding: utf-8 -*-
2
- $:.push File.expand_path("../lib", __FILE__)
3
- require "lumberg/version"
4
-
5
- Gem::Specification.new do |s|
6
- s.name = "lumberg"
7
- s.version = Lumberg::VERSION
8
- s.platform = Gem::Platform::RUBY
9
- s.authors = ["Justin Mazzi"]
10
- s.email = ["jmazzi@site5.com"]
11
- s.homepage = ""
12
- s.summary = %q{Ruby library for the WHM & cPanel API}
13
- s.description = %q{Ruby library for the WHM & cPanel API; It's not a half day or anything like that}
14
-
15
- s.rubyforge_project = "lumberg"
16
-
17
- s.add_dependency 'json'
18
- s.add_runtime_dependency('jruby-openssl', '~> 0.7.3') if RUBY_PLATFORM == 'java'
19
- s.add_development_dependency 'rspec', '~> 2.8.0'
20
- s.add_development_dependency 'fakeweb', '~> 1.3.0'
21
- s.add_development_dependency 'vcr', '~> 1.11.3'
22
- s.add_development_dependency 'rake', '~> 0.9.2.2'
23
-
24
- s.files = `git ls-files`.split("\n")
25
- s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
26
- s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
27
- s.require_paths = ["lib"]
28
- end
@@ -1,85 +0,0 @@
1
- ---
2
- - !ruby/struct:VCR::HTTPInteraction
3
- request: !ruby/struct:VCR::Request
4
- method: :get
5
- uri: https://myhost.com:2087/json-api/testing
6
- body:
7
- headers:
8
- authorization:
9
- - WHM root:iscool
10
- response: !ruby/struct:VCR::Response
11
- status: !ruby/struct:VCR::ResponseStatus
12
- code: 200
13
- message: OK
14
- headers:
15
- server:
16
- - cpsrvd/11.28.64
17
- transfer-encoding:
18
- - chunked
19
- content-type:
20
- - text/plain
21
- body: "{\"result\":[ { \"status\": 1, \"statusmsg\": null } ] }"
22
- http_version: "1.1"
23
- - !ruby/struct:VCR::HTTPInteraction
24
- request: !ruby/struct:VCR::Request
25
- method: :get
26
- uri: https://myhost.com:2087/json-api/testing_error
27
- body:
28
- headers:
29
- authorization:
30
- - WHM root:iscool
31
- response: !ruby/struct:VCR::Response
32
- status: !ruby/struct:VCR::ResponseStatus
33
- code: 200
34
- message: OK
35
- headers:
36
- server:
37
- - cpsrvd/11.28.64
38
- transfer-encoding:
39
- - chunked
40
- content-type:
41
- - text/plain
42
- body: "{\"error\":\"Unknown App Requested: testing_error\"}"
43
- http_version: "1.1"
44
- - !ruby/struct:VCR::HTTPInteraction
45
- request: !ruby/struct:VCR::Request
46
- method: :get
47
- uri: https://myhost.com:2087/json-api/testing_query
48
- body:
49
- headers:
50
- authorization:
51
- - WHM root:iscool
52
- response: !ruby/struct:VCR::Response
53
- status: !ruby/struct:VCR::ResponseStatus
54
- code: 200
55
- message: OK
56
- headers:
57
- server:
58
- - cpsrvd/11.28.64
59
- transfer-encoding:
60
- - chunked
61
- content-type:
62
- - text/plain
63
- body: "{ \"status\":1, \"statusmsg\":\"Ok\", \"acct\":[ { \"Item\":\"Parameters/Results\", \"Next Item\":\"Parameters/Results\" }, { \"Item\":\"Parameters/Results\", \"Next Item\":\"Parameters/Results\" } ] }"
64
- http_version: "1.1"
65
- - !ruby/struct:VCR::HTTPInteraction
66
- request: !ruby/struct:VCR::Request
67
- method: :get
68
- uri: https://myhost.com:2087/json-api/testing_unknown
69
- body:
70
- headers:
71
- authorization:
72
- - WHM root:iscool
73
- response: !ruby/struct:VCR::Response
74
- status: !ruby/struct:VCR::ResponseStatus
75
- code: 200
76
- message: OK
77
- headers:
78
- server:
79
- - cpsrvd/11.28.64
80
- transfer-encoding:
81
- - chunked
82
- content-type:
83
- - text/plain
84
- body: "{ \"wtf\":1 }"
85
- http_version: "1.1"
@@ -1,179 +0,0 @@
1
- require 'spec_helper'
2
- require 'lumberg/whm/args'
3
-
4
- module Lumberg
5
- describe Whm::Args do
6
- context "required_parms" do
7
- it "raises an error when missing" do
8
- options = {:arg1 => true}
9
- args = lambda {
10
- Whm::Args.new(options) do |c|
11
- c.requires :arg2
12
- end
13
- }
14
- expect { args.call }.to raise_error(WhmArgumentError, /Missing required parameter: arg2/)
15
- end
16
-
17
- it "does not raise an error with valid params" do
18
- options = {:arg1 => true}
19
- args = Whm::Args.new(options) { |c|
20
- c.requires :arg1
21
- }
22
-
23
- args.required_params.should have(1).value
24
- args.required_params.should include(:arg1)
25
- end
26
-
27
- it "sets optional_params" do
28
- options = {:arg1 => true, :arg2 => 2}
29
- args = Whm::Args.new(options) { |c|
30
- c.requires :arg1, :arg2
31
- }
32
-
33
- args.optional_params.should have(2).values
34
- args.required_params.should have(2).values
35
-
36
- args.optional_params.should include(*args.required_params)
37
- end
38
-
39
- it "does not set boolean_params" do
40
- options = {:arg1 => true, :arg2 => 2}
41
- args = Whm::Args.new(options) { |c|
42
- c.requires :arg1, :arg2
43
- }
44
-
45
- args.boolean_params.should be_empty
46
- end
47
- end
48
-
49
- context "boolean_params" do
50
- it "raises an error when the param is not boolean" do
51
- options = {:arg1 => 'string'}
52
- args = lambda {
53
- Whm::Args.new(options) do |c|
54
- c.booleans :arg1
55
- end
56
- }
57
- expect { args.call }.to raise_error(WhmArgumentError, /Boolean parameter must be.*: arg1/)
58
- end
59
-
60
- it "raises an error with boolean params" do
61
- options = {:arg1 => true}
62
- args = Whm::Args.new(options) { |c|
63
- c.booleans :arg1
64
- }
65
-
66
- args.boolean_params.should have(1).value
67
- args.boolean_params.should include(:arg1)
68
- end
69
-
70
- it "sets optional_params" do
71
- options = {:arg1 => true, :arg2 => false}
72
- args = Whm::Args.new(options) { |c|
73
- c.booleans :arg1, :arg2
74
- }
75
-
76
- args.optional_params.should have(2).values
77
- args.boolean_params.should have(2).values
78
-
79
- args.optional_params.should include(:arg1, :arg2)
80
- end
81
-
82
- it "sets required_params" do
83
- options = {:arg1 => true, :arg2 => false}
84
- args = Whm::Args.new(options) { |c|
85
- c.booleans :arg1, :arg2
86
- }
87
-
88
- args.required_params.should be_empty
89
- end
90
- end
91
-
92
- context "optional_params" do
93
- it "raises an error with unknown params" do
94
- options = {:arg1 => true}
95
- args = lambda {
96
- Whm::Args.new(options) do |c|
97
- c.optionals :arg2
98
- end
99
- }
100
-
101
- expect { args.call }.to raise_error(WhmArgumentError, /Not a valid parameter: arg1/)
102
- end
103
-
104
- it "does not raise an error with known params" do
105
- options = {:arg1 => true, :arg2 => 2}
106
- args = Whm::Args.new(options) { |c|
107
- c.optionals :arg1, :arg2
108
- }
109
-
110
- args.optional_params.should have(2).values
111
- args.optional_params.should include(:arg1, :arg2)
112
- end
113
-
114
- it "does not set required_params" do
115
- options = {:arg1 => true, :arg2 => 2}
116
- args = Whm::Args.new(options) { |c|
117
- c.optionals :arg1, :arg2
118
- }
119
-
120
- args.required_params.should be_empty
121
- end
122
-
123
- it "does not set boolean_params" do
124
- options = {:arg1 => true, :arg2 => 2}
125
- args = Whm::Args.new(options) { |c|
126
- c.optionals :arg1, :arg2
127
- }
128
-
129
- args.boolean_params.should be_empty
130
- end
131
- end
132
-
133
- context "one_of" do
134
- it "allows one arg" do
135
- options = {:arg1 => true}
136
- args = lambda {
137
- Whm::Args.new(options) do |c|
138
- c.one_of :arg1
139
- end
140
- }
141
-
142
- expect { args.call }.to raise_error(WhmArgumentError, /One of requires two or more items/)
143
- end
144
-
145
- it "allows two or more args" do
146
- options = {:arg1 => true}
147
-
148
- args = Whm::Args.new(options) do |c|
149
- c.one_of :arg1, :arg2
150
- end
151
-
152
- args.one_of_params.should have(2).values
153
- args.one_of_params.should include(:arg1, :arg2)
154
- end
155
-
156
- it "does not allow 0 params" do
157
- options = {}
158
- args = lambda {
159
- Whm::Args.new(options) do |c|
160
- c.one_of :arg1, :arg2
161
- end
162
- }
163
-
164
- expect { args.call }.to raise_error(WhmArgumentError, /The parameters may include only one of 'arg1, arg2'/)
165
- end
166
-
167
- it "does not allow both args" do
168
- options = {:arg1 => true, :arg2 => 2}
169
- args = lambda {
170
- Whm::Args.new(options) do |c|
171
- c.one_of :arg1, :arg2
172
- end
173
- }
174
-
175
- expect { args.call }.to raise_error(WhmArgumentError, /The parameters may include only one of 'arg1, arg2'/)
176
- end
177
- end
178
- end
179
- end