Class: Fusebox::Request
- Inherits:
-
Object
- Object
- Fusebox::Request
- Defined in:
- lib/fusebox/request.rb
Overview
Constant Summary collapse
- COMMANDS =
%w(adddomain addforward changeusername checkalias checkdomain suspend enable getforward modify order terminate removealias removedomain removeforward report reportmail)
Class Attribute Summary collapse
-
.auth_yaml_paths ⇒ Array<String>
Paths to search for API platform authentication information.
-
.url ⇒ String
API URL to POST requests to.
Instance Attribute Summary collapse
-
#password ⇒ String
Platform API password.
-
#username ⇒ String
Platform API username.
Instance Method Summary collapse
-
#adddomain(opts) ⇒ Response
This request will add a domain to the specified account.
-
#addforward(opts) ⇒ Response
This request will add an email forwarder.
-
#changeusername(opts) ⇒ Response
This request is used to change the an account's username.
-
#checkalias(opts) ⇒ Response
This request will check the availability of an alias against the whole system.
-
#checkdomain(opts) ⇒ Response
This request will check the availability of a domain name.
-
#enable(opts) ⇒ Response
The enable request allow you to activate an account under your platform or temporarily start access to the account.
-
#getforward(opts) ⇒ Response
This request will return the forward currently set on an alias in the Fusebox::Response#detail attribute.
-
#initialize(username = nil, password = nil) ⇒ Request
constructor
A new instance of Request.
-
#modify(opts) ⇒ Response
This request is used to modify personal information, password, and the account plan of the account.
-
#order(opts) ⇒ Response
This is a request to submit a new order and create a new account under your Fused Platform account.
-
#removealias(opts) ⇒ Response
This request will remove a single alias from a fusemail account.
-
#removedomain(opts) ⇒ Response
This request will remove a domain name and all its mail aliases, auto-responders, mailing lists & forwarders associated with it.
-
#removeforward(opts) ⇒ Response
This request will remove an existing email forwarder.
-
#report(opts = {}) ⇒ Response
This request will provide information about one or more accounts under your platform in CSV format.
-
#reportmail(opts = {}) ⇒ Response
This request will provide information about mail aliases, forwarders, autoresponders, or mailing lists on one or more accounts under your platform in CSV format.
-
#suspend(opts) ⇒ Response
The suspend request allow you to suspend an account under your platform or temporarily stop access to the account without deleting any of the accounts data.
-
#terminate(opts) ⇒ Response
The terminate request is used to permanently remove an account and all of the account data associated with it.
Constructor Details
#initialize(username = nil, password = nil) ⇒ Request
29 30 31 32 33 34 35 36 |
# File 'lib/fusebox/request.rb', line 29 def initialize (username = nil, password = nil) if username && password @username = username @password = password else load_auth_from_yaml end end |
Class Attribute Details
.auth_yaml_paths ⇒ Array<String>
9 10 11 |
# File 'lib/fusebox/request.rb', line 9 def auth_yaml_paths @auth_yaml_paths end |
.url ⇒ String
12 13 14 |
# File 'lib/fusebox/request.rb', line 12 def url @url end |
Instance Attribute Details
#password ⇒ String
19 20 21 |
# File 'lib/fusebox/request.rb', line 19 def password @password end |
#username ⇒ String
16 17 18 |
# File 'lib/fusebox/request.rb', line 16 def username @username end |
Instance Method Details
#adddomain(opts) ⇒ Response
This request will add a domain to the specified account. The must be under your platform
44 45 46 47 48 49 50 51 52 |
# File 'lib/fusebox/request.rb', line 44 def adddomain (opts) = { :domain => '', :user => '' } opts.reverse_merge! post 'adddomain', opts end |
#addforward(opts) ⇒ Response
This request will add an email forwarder.
61 62 63 64 65 66 67 68 69 70 |
# File 'lib/fusebox/request.rb', line 61 def addforward (opts) = { :user => '', :forward_what => '', :forward_to => '' } opts.reverse_merge! post 'addforward', opts end |
#changeusername(opts) ⇒ Response
This request is used to change the an account's username
93 94 95 96 97 98 99 100 101 |
# File 'lib/fusebox/request.rb', line 93 def changeusername (opts) = { :user => '', :newuser => '' } opts.reverse_merge! post 'changeusername', opts end |
#checkalias(opts) ⇒ Response
This request will check the availability of an alias against the whole system. Remember to add an alias, the domain must belong to the platform or to that account.
78 79 80 81 82 83 84 85 |
# File 'lib/fusebox/request.rb', line 78 def checkalias (opts) = { :alias => '' } opts.reverse_merge! post 'checkalias', opts end |
#checkdomain(opts) ⇒ Response
This request will check the availability of a domain name. This only checks if the domain name is available on our system, it does not reflect registrar status.
108 109 110 111 112 113 114 115 |
# File 'lib/fusebox/request.rb', line 108 def checkdomain (opts) = { :domain => '' } opts.reverse_merge! post 'checkdomain', opts end |
#enable(opts) ⇒ Response
The enable request allow you to activate an account under your platform or temporarily start access to the account. Below are the variables that are specific to this request.
136 137 138 139 140 141 142 143 |
# File 'lib/fusebox/request.rb', line 136 def enable (opts) = { :user => '' } opts.reverse_merge! post 'enable', opts end |
#getforward(opts) ⇒ Response
This request will return the forward currently set on an alias in the Fusebox::Response#detail attribute
151 152 153 154 155 156 157 158 159 |
# File 'lib/fusebox/request.rb', line 151 def getforward (opts) = { :user => '', :forward_what => '' } opts.reverse_merge! post 'getforward', opts end |
#modify(opts) ⇒ Response
This request is used to modify personal information, password, and the account plan of the account. Only send the variables you wish to modify. If a NULL variable is detected, no change will be made to the account.
165 166 167 168 169 170 171 |
# File 'lib/fusebox/request.rb', line 165 def modify (opts) = { } opts.reverse_merge! post 'modify', opts end |
#order(opts) ⇒ Response
This is a request to submit a new order and create a new account under your Fused Platform account. Orders are processed within 5 minutes of request submission. Below are the variables that are specific to this type of request.
191 192 193 194 195 196 197 198 199 200 201 |
# File 'lib/fusebox/request.rb', line 191 def order (opts) = { :account_type => 'group_subaccount', :first_name => '', :last_name => '', :maxdisk => 1000 } opts.reverse_merge! post 'order', opts end |
#removealias(opts) ⇒ Response
This request will remove a single alias from a fusemail account
225 226 227 228 229 230 231 232 233 |
# File 'lib/fusebox/request.rb', line 225 def removealias (opts) = { :user => '', :alias => '' } opts.reverse_merge! post 'removealias', opts end |
#removedomain(opts) ⇒ Response
This request will remove a domain name and all its mail aliases, auto-responders, mailing lists & forwarders associated with it. Please see below for the specific requirements for this request.
241 242 243 244 245 246 247 248 249 |
# File 'lib/fusebox/request.rb', line 241 def removedomain (opts) = { :domain => '', :confirm => true } opts.reverse_merge! post 'removedomain', opts end |
#removeforward(opts) ⇒ Response
This request will remove an existing email forwarder
259 260 261 262 263 264 265 266 267 268 |
# File 'lib/fusebox/request.rb', line 259 def removeforward (opts) = { :user => '', :forward_what => '', :forward_to => '' } opts.reverse_merge! post 'removeforward', opts end |
#report(opts = {}) ⇒ Response
This request will provide information about one or more accounts under your platform in CSV format
277 278 279 280 281 282 283 284 285 286 |
# File 'lib/fusebox/request.rb', line 277 def report (opts = {}) = { :user => 'all', :group_subaccount => true, :report_type => 'basic' } opts.reverse_merge! post 'report', opts, "report_#{opts[:report_type]}".to_sym end |
#reportmail(opts = {}) ⇒ Response
This request will provide information about mail aliases, forwarders, autoresponders, or mailing lists on one or more accounts under your platform in CSV format.
300 301 302 303 304 305 306 307 308 309 |
# File 'lib/fusebox/request.rb', line 300 def reportmail (opts = {}) = { :user => 'all', :group_subaccount => true, :report_type => 'all' } opts.reverse_merge! post 'reportmail', opts, :reportmail end |
#suspend(opts) ⇒ Response
The suspend request allow you to suspend an account under your platform or temporarily stop access to the account without deleting any of the accounts data. Below are the variables that are specific to this request.
122 123 124 125 126 127 128 129 |
# File 'lib/fusebox/request.rb', line 122 def suspend (opts) = { :user => '', } opts.reverse_merge! post 'suspend', opts end |
#terminate(opts) ⇒ Response
The terminate request is used to permanently remove an account and all of the account data associated with it. This operation cannot be reversed and therefore should be used with caution.
209 210 211 212 213 214 215 216 217 |
# File 'lib/fusebox/request.rb', line 209 def terminate (opts) = { :user => '', :purge => false } opts.reverse_merge! post 'terminate', opts end |