fusebox 0.2.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 128f27fc4b727108ba232f8f664b58677cd5b64e
4
+ data.tar.gz: 13512c5ab86ed410c0f1909d79782245af33d4f0
5
+ SHA512:
6
+ metadata.gz: abb499636f81ebdcbce3f4b3f7d6197cbd70f392456a9455475f18dde250ce3abe6142de6c7cc6a0e3b768a2b0fed9c09f16b72bfbb38465a46308d9f5be33c4
7
+ data.tar.gz: b21be721f34de55eb62ce10b7e947d0b59071c32f7829f8d55289669b975a10e362bec5792aa91d92730c795688d79efac5739f02c69560cc1809b6951220864
@@ -0,0 +1,5 @@
1
+ ._*
2
+ .yardoc/
3
+ doc/
4
+ pkg/
5
+ tmp/
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in fusebox.gemspec
4
+ gemspec
@@ -0,0 +1,45 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ fusebox (0.2.3)
5
+ activesupport (>= 2.0)
6
+ thor (~> 0.14)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ activesupport (4.0.2)
12
+ i18n (~> 0.6, >= 0.6.4)
13
+ minitest (~> 4.2)
14
+ multi_json (~> 1.3)
15
+ thread_safe (~> 0.1)
16
+ tzinfo (~> 0.3.37)
17
+ atomic (1.1.14)
18
+ diff-lcs (1.2.5)
19
+ i18n (0.6.9)
20
+ minitest (4.7.5)
21
+ multi_json (1.8.4)
22
+ rake (10.1.1)
23
+ rspec (2.14.1)
24
+ rspec-core (~> 2.14.0)
25
+ rspec-expectations (~> 2.14.0)
26
+ rspec-mocks (~> 2.14.0)
27
+ rspec-core (2.14.7)
28
+ rspec-expectations (2.14.4)
29
+ diff-lcs (>= 1.1.3, < 2.0)
30
+ rspec-mocks (2.14.4)
31
+ thor (0.18.1)
32
+ thread_safe (0.1.3)
33
+ atomic
34
+ tzinfo (0.3.38)
35
+ yard (0.8.7.2)
36
+
37
+ PLATFORMS
38
+ ruby
39
+
40
+ DEPENDENCIES
41
+ bundler (~> 1.3)
42
+ fusebox!
43
+ rake
44
+ rspec
45
+ yard
data/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  [FuseMail](http://fusemail.com) is a business email hosting provider offering outsourced email hosting to businesses and resellers.
6
6
 
7
- **fusebox** is a ruby gem that provides a 1:1 native ruby interface for every command of [FuseMail Platform Programming Interface v2.6](http://www.fusemail.com/support/administration-api), which allows you to manage your accounts, domains, forwards, and aliases via an underlying HTTP interface.
7
+ **fusebox** is a ruby gem that provides a 1:1 native ruby interface for every command of [FuseMail Platform Programming Interface v2.6](https://www.fusemail.com/support/api-documentation/), which allows you to manage your accounts, domains, forwards, and aliases via an underlying HTTP interface.
8
8
 
9
9
  ## Installation
10
10
  $ gem install fusebox
@@ -45,13 +45,9 @@ See the [Fusebox::Request](http://rubydoc.info/github/mudbugmedia/fusebox/master
45
45
  * [Project Documentation](http://rubydoc.info/github/mudbugmedia/fusebox/master/frames)
46
46
  * [Command Documentation](http://rubydoc.info/github/mudbugmedia/fusebox/master/Fusebox/Request)
47
47
 
48
- ## TODO
49
- * Logging hook
50
- * Leverage ActiveModel to create Account, Domain, Alias, etc, classes.
51
-
52
48
  ## Authors
53
49
  The fusebox gem is independently developed and maintained by [Mudbug Media](http://mudbugmedia.com/) and [Gabe Martin-Dempesy](http://mudbugmedia.com/team/gabe).
54
50
 
55
51
  FuseMail LLC, and its parent company j2 Global Communications, do not provide support or maintenance for this software.
56
52
 
57
- Copyright &copy; 2010
53
+ Copyright &copy; 2010 - 2014
@@ -0,0 +1,27 @@
1
+ require "bundler/gem_tasks"
2
+
3
+ task :default => :spec
4
+ task :test => :spec
5
+
6
+ namespace :cacert do
7
+ desc "Update cacert.pem from curl.haxx.se"
8
+ task :update do
9
+ exec "curl http://curl.haxx.se/ca/cacert.pem > vendor/curl-cacert.pem"
10
+ end
11
+ end
12
+
13
+ begin
14
+ require 'rspec/core/rake_task'
15
+ RSpec::Core::RakeTask.new(:spec)
16
+ rescue LoadError
17
+ warn "warn: RSpec tests not available. `gem install rspec` to enable them."
18
+ end
19
+
20
+ begin
21
+ require 'yard'
22
+ YARD::Rake::YardocTask.new do |t|
23
+ t.options = ['--verbose']
24
+ end
25
+ rescue LoadError
26
+ warn "warn: YARD not available. `gem install yard` to enable."
27
+ end
@@ -0,0 +1,2 @@
1
+ username: my_username
2
+ password: my_password
@@ -0,0 +1,28 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'fusebox/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "fusebox"
8
+ spec.version = Fusebox::VERSION
9
+ spec.authors = ["Gabe Martin-Dempesy"]
10
+ spec.email = ["gabe@mudbugmedia.com"]
11
+ spec.description = "FuseMail API client library and CLI"
12
+ spec.summary = "FuseMail API client library and CLI"
13
+ spec.homepage = "http://github.com/mudbugmedia/fusebox"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_dependency "activesupport", ">= 2.0"
22
+ spec.add_dependency "thor", "~> 0.14"
23
+
24
+ spec.add_development_dependency "bundler", "~> 1.3"
25
+ spec.add_development_dependency "rake"
26
+ spec.add_development_dependency "rspec"
27
+ spec.add_development_dependency "yard"
28
+ end
@@ -23,7 +23,7 @@ module Fusebox
23
23
  response = Fusebox::Request.new.modify(:user => username, :alias => aliases)
24
24
  say response.detail
25
25
  end
26
-
26
+
27
27
  desc "alias-ls user@example.com", "List aliases for a user"
28
28
  def alias_ls (username)
29
29
  response = Fusebox::Request.new.reportmail(:user => username, :report_type => 'alias')
@@ -33,20 +33,20 @@ module Fusebox
33
33
  warn response.detail
34
34
  end
35
35
  end
36
-
36
+
37
37
  desc "alias-rm user@example.com alias1@example.com", "Remove an alias from a maccount"
38
38
  def alias_rm (username, alias_address)
39
39
  response = Fusebox::Request.new.removealias(:user => username, :alias => alias_address)
40
40
  say response.detail
41
41
  end
42
-
42
+
43
43
  desc "domain-add [postmaster@]example.com new.example.com", "Add a domain a group account"
44
44
  def domain_add (username, domain)
45
45
  username = "postmaster@#{username}" unless username =~ /@/
46
46
  response = Fusebox::Request.new.adddomain(:user => username, :domain => domain)
47
47
  say response.detail
48
48
  end
49
-
49
+
50
50
  desc "domain-rm secondary.example.com", "Remove a domain"
51
51
  method_options [:force, '-f'] => false
52
52
  def domain_rm (domain)
@@ -55,13 +55,13 @@ module Fusebox
55
55
  say response.detail
56
56
  end
57
57
  end
58
-
58
+
59
59
  desc "enable user@example.com", "Enable a suspended user account"
60
60
  def enable (username)
61
61
  response = Fusebox::Request.new.enable(:user => username)
62
62
  say response.detail
63
63
  end
64
-
64
+
65
65
  desc "get [user@]example.com", "Get aliases, forwarders, and mailing lists for an account"
66
66
  # @todo Display account metadata from `report`
67
67
  def get (username)
@@ -73,7 +73,7 @@ module Fusebox
73
73
  warn response.detail
74
74
  end
75
75
  end
76
-
76
+
77
77
  desc "group-add [postmaster@]example.com [password]", "Create a group account"
78
78
  def group_add (username, password = nil)
79
79
  username = "postmaster@#{username}" unless username =~ /@/
@@ -82,7 +82,7 @@ module Fusebox
82
82
  response = Fusebox::Request.new.order(:account_type => 'standard', :user => username, :password => password, :first_name => first, :last_name => last)
83
83
  say response.detail
84
84
  end
85
-
85
+
86
86
  desc "ls [[postmaster@]example.com]", "List accounts. This will list all group accounts if argument is blank"
87
87
  method_options [:recursive, '-r'] => :boolean
88
88
  # @todo add flag for ignoring terminated accounts
@@ -96,14 +96,14 @@ module Fusebox
96
96
  warn response.detail
97
97
  end
98
98
  end
99
-
99
+
100
100
  desc "passwd user@example.com [newpassword]", "Change a user's password (will prompt if password left blank)"
101
101
  def passwd (username, password = nil)
102
102
  password = ask "New Password:" unless password
103
103
  response = Fusebox::Request.new.modify(:user => username, :password => password)
104
104
  say response.detail
105
105
  end
106
-
106
+
107
107
  desc "rename old@example.com new@example.com", "Rename an account's username"
108
108
  def rename (old_username, new_username)
109
109
  response = Fusebox::Request.new.changeusername(:user => old_username, :newuser => new_username)
@@ -121,7 +121,7 @@ module Fusebox
121
121
  say "No action taken."
122
122
  end
123
123
  end
124
-
124
+
125
125
  desc "suspend user@example.com", "Suspend a user account"
126
126
  def suspend (username)
127
127
  response = Fusebox::Request.new.suspend(:user => username)
@@ -1,47 +1,47 @@
1
1
  class Array
2
-
2
+
3
3
  # Return an ASCII table for an array of hashes
4
4
  # @example
5
5
  # [{:a => "Uno", :b => "Dos"}, {:a => "Ichi", :b => "Ni"}].to_ascii_table([:a, :b], %w(One Two))
6
6
  # @param [Array<Symbol>] keys Which keys to display, in order
7
7
  # @param [Array<Symbol>] labels Column headings for the keys
8
8
  # @return [String]
9
- def to_ascii_table (keys, labels)
9
+ def to_ascii_table (keys, labels)
10
10
  raise ArgumentError, "`labels` length does not match `keys` length" if keys.length != labels.length
11
11
  return '' if self.length == 0
12
12
  raise ArgumentError, "expected elements to be Hash instances; instead received: #{first.inspect}" unless first.is_a?(Hash)
13
-
13
+
14
14
  widths = keys.map do |key|
15
15
  ([Hash[keys.zip(labels)]] + self).map { |row| row[key].to_s.length }.max
16
16
  end
17
-
17
+
18
18
  text = ''
19
-
19
+
20
20
  text += to_ascii_table_hr(widths)
21
-
21
+
22
22
  labels.each_with_index do |key, i|
23
23
  text += "| " + labels[i].ljust(widths[i] + 1)
24
24
  end
25
25
  text += "|\n"
26
-
26
+
27
27
  text += to_ascii_table_hr(widths)
28
-
28
+
29
29
  each do |row|
30
30
  keys.each_with_index do |key, i|
31
31
  text += "| " + row[key].ljust(widths[i] + 1)
32
32
  end
33
33
  text += "|\n"
34
34
  end
35
-
35
+
36
36
  text += to_ascii_table_hr(widths)
37
37
  text
38
38
  end
39
-
39
+
40
40
  protected
41
41
  # Print a horizonal divider calc
42
42
  # @param [Array<Fixnum>] widths List of column widths
43
43
  def to_ascii_table_hr(widths)
44
44
  '+' + '-' * (widths.inject(&:+) + widths.length * 3 - 1 ) + "+\n"
45
45
  end
46
-
46
+
47
47
  end
@@ -16,7 +16,7 @@ module Net
16
16
  http.ca_file = File.expand_path('../../../../vendor/curl-cacert.pem', __FILE__)
17
17
  http.start {|http|
18
18
  http.request(req)
19
- }
19
+ }
20
20
  end
21
21
  end
22
22
  end
@@ -3,27 +3,27 @@ require 'yaml'
3
3
  module Fusebox
4
4
  # @see http://www.fusemail.com/support/administration-api
5
5
  class Request
6
-
6
+
7
7
  class << self
8
8
  # @return [Array<String>] Paths to search for API platform authentication information
9
9
  attr_accessor :auth_yaml_paths
10
-
10
+
11
11
  # @return [String] API URL to POST requests to
12
12
  attr_accessor :url
13
13
  end
14
-
14
+
15
15
  # @return [String] Platform API username
16
16
  attr_accessor :username
17
17
 
18
18
  # @return [String] Platform API password
19
19
  attr_accessor :password
20
-
20
+
21
21
  self.auth_yaml_paths = %w(~/.fusemail.yaml)
22
22
  self.url = 'https://www.fusemail.com/api/request.html'
23
-
23
+
24
24
  # @return [Array<String>] List of available API commands
25
25
  COMMANDS = %w(adddomain addforward changeusername checkalias checkdomain suspend enable getforward modify order terminate removealias removedomain removeforward report reportmail)
26
-
26
+
27
27
  # @param [String] username API username. If not provided, auth_yaml_paths will be searched for authentication information instead.
28
28
  # @param [String] password API password
29
29
  def initialize (username = nil, password = nil)
@@ -34,9 +34,9 @@ module Fusebox
34
34
  load_auth_from_yaml
35
35
  end
36
36
  end
37
-
37
+
38
38
  # This request will add a domain to the specified account. The must be under your platform
39
- # @see http://www.fusemail.com/support/administration-api/requests/adddomain adddomain API documentation
39
+ # @see https://www.fusemail.com/support/api-documentation/requests#adddomain adddomain API documentation
40
40
  # @param [Array] opts
41
41
  # @option opts [String] :domain The domain to add
42
42
  # @option opts [String] :user The account to add the domain to
@@ -46,13 +46,13 @@ module Fusebox
46
46
  :domain => '',
47
47
  :user => ''
48
48
  }
49
-
49
+
50
50
  opts.reverse_merge! default_options
51
51
  post 'adddomain', opts
52
52
  end
53
53
 
54
54
  # This request will add an email forwarder.
55
- # @see http://www.fusemail.com/support/administration-api/requests/addforward addforward API documentation
55
+ # @see https://www.fusemail.com/support/api-documentation/requests#addforward addforward API documentation
56
56
  # @param [Array] opts
57
57
  # @option opts [String] :user Username of FuseMail account to add forwarder to
58
58
  # @option opts [String] :forward_what Email address of forwarder
@@ -64,14 +64,14 @@ module Fusebox
64
64
  :forward_what => '',
65
65
  :forward_to => ''
66
66
  }
67
-
67
+
68
68
  opts.reverse_merge! default_options
69
69
  post 'addforward', opts
70
70
  end
71
71
 
72
-
72
+
73
73
  # 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.
74
- # @see http://www.fusemail.com/support/administration-api/requests/checkalias checkalias API documentation
74
+ # @see https://www.fusemail.com/support/api-documentation/requests#checkalias checkalias API documentation
75
75
  # @param [Array] opts
76
76
  # @option opts [String] :alias The alias to check the availability of (e.g. user@example.com)
77
77
  # @return [Response]
@@ -79,13 +79,13 @@ module Fusebox
79
79
  default_options = {
80
80
  :alias => ''
81
81
  }
82
-
82
+
83
83
  opts.reverse_merge! default_options
84
84
  post 'checkalias', opts
85
85
  end
86
-
86
+
87
87
  # This request is used to change the an account's username
88
- # @see http://www.fusemail.com/support/administration-api/requests/changeusername changeusername API documentation
88
+ # @see https://www.fusemail.com/support/api-documentation/requests#changeusername changeusername API documentation
89
89
  # @param [Array] opts
90
90
  # @param opts [String] :user Username of FuseMail account to modify
91
91
  # @param opts [String] :newuser New username of the account
@@ -95,13 +95,13 @@ module Fusebox
95
95
  :user => '',
96
96
  :newuser => ''
97
97
  }
98
-
98
+
99
99
  opts.reverse_merge! default_options
100
100
  post 'changeusername', opts
101
101
  end
102
-
102
+
103
103
  # 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.
104
- # @see http://www.fusemail.com/support/administration-api/requests/checkdomain checkdomain API documentation
104
+ # @see https://www.fusemail.com/support/api-documentation/requests#checkdomain checkdomain API documentation
105
105
  # @param [Array] opts
106
106
  # @option opts [String] :domain The domain to check the availability of
107
107
  # @return [Response]
@@ -109,13 +109,13 @@ module Fusebox
109
109
  default_options = {
110
110
  :domain => ''
111
111
  }
112
-
112
+
113
113
  opts.reverse_merge! default_options
114
114
  post 'checkdomain', opts
115
115
  end
116
-
116
+
117
117
  # This request is used to change the an account's username
118
- # @see http://www.fusemail.com/support/administration-api/requests/suspend suspend API documentation
118
+ # @see https://www.fusemail.com/support/api-documentation/requests#suspend suspend API documentation
119
119
  # @param [Array] opts
120
120
  # @option opts [String] :user Username of FuseMail account to modify
121
121
  # @return [Response]
@@ -123,13 +123,13 @@ module Fusebox
123
123
  default_options = {
124
124
  :user => '',
125
125
  }
126
-
126
+
127
127
  opts.reverse_merge! default_options
128
128
  post 'suspend', opts
129
129
  end
130
130
 
131
131
  # 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.
132
- # @see http://www.fusemail.com/support/administration-api/requests/enable enable API documentation
132
+ # @see https://www.fusemail.com/support/api-documentation/requests#enable enable API documentation
133
133
  # @param [Array] opts
134
134
  # @option opts [String] :user Username of FuseMail account to enable
135
135
  # @return [Response]
@@ -137,13 +137,13 @@ module Fusebox
137
137
  default_options = {
138
138
  :user => ''
139
139
  }
140
-
140
+
141
141
  opts.reverse_merge! default_options
142
142
  post 'enable', opts
143
143
  end
144
-
144
+
145
145
  # This request will return the forward currently set on an alias in the {Response#detail} attribute
146
- # @see http://www.fusemail.com/support/administration-api/requests/getforward getforward API documentation
146
+ # @see https://www.fusemail.com/support/api-documentation/requests#getforward getforward API documentation
147
147
  # @param [Array] opts
148
148
  # @option opts [String] :user Username of FuseMail account where the forwarding alias resides
149
149
  # @option opts [String] :forward_what Alias for the forwarder
@@ -153,25 +153,25 @@ module Fusebox
153
153
  :user => '',
154
154
  :forward_what => ''
155
155
  }
156
-
156
+
157
157
  opts.reverse_merge! default_options
158
158
  post 'getforward', opts
159
159
  end
160
-
160
+
161
161
  # 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.
162
- # @see http://www.fusemail.com/support/administration-api/requests/modify modify API documentation
162
+ # @see https://www.fusemail.com/support/api-documentation/requests#modify modify API documentation
163
163
  # @param opts (see Fusemail::Request#order)
164
164
  # @return [Response]
165
165
  def modify (opts)
166
166
  default_options = {
167
167
  }
168
-
168
+
169
169
  opts.reverse_merge! default_options
170
170
  post 'modify', opts
171
171
  end
172
-
172
+
173
173
  # 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.
174
- # @see http://www.fusemail.com/support/administration-api/requests/order order API documentation
174
+ # @see https://www.fusemail.com/support/api-documentation/requests#order order API documentation
175
175
  # @param [Array] opts
176
176
  # @option opts [String] :user Username of FuseMail account to create
177
177
  # @option opts [String] :password Password of FuseMail account to create
@@ -195,13 +195,13 @@ module Fusebox
195
195
  :last_name => '',
196
196
  :maxdisk => 1000
197
197
  }
198
-
198
+
199
199
  opts.reverse_merge! default_options
200
200
  post 'order', opts
201
201
  end
202
-
202
+
203
203
  # 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.
204
- # @see http://www.fusemail.com/support/administration-api/requests/terminate terminate API documentation
204
+ # @see https://www.fusemail.com/support/api-documentation/requests#terminate terminate API documentation
205
205
  # @param [Array] opts
206
206
  # @option opts [String] :user Username of FuseMail account to terminate
207
207
  # @option opts [Boolean] :purge (false) Will purge all data (such as removing the username) from our system. This process might take a few hours to complete.
@@ -211,13 +211,13 @@ module Fusebox
211
211
  :user => '',
212
212
  :purge => false
213
213
  }
214
-
214
+
215
215
  opts.reverse_merge! default_options
216
216
  post 'terminate', opts
217
217
  end
218
-
218
+
219
219
  # This request will remove a single alias from a fusemail account
220
- # @see http://www.fusemail.com/support/administration-api/requests/removealias removealias API documentation
220
+ # @see https://www.fusemail.com/support/api-documentation/requests#removealias removealias API documentation
221
221
  # @param [Array] opts
222
222
  # @option opts [String] :user FuseMail user to delete alias from
223
223
  # @option opts [String] :alias alias to delete (e.g. user@example.com )
@@ -227,13 +227,13 @@ module Fusebox
227
227
  :user => '',
228
228
  :alias => ''
229
229
  }
230
-
230
+
231
231
  opts.reverse_merge! default_options
232
232
  post 'removealias', opts
233
233
  end
234
-
234
+
235
235
  # 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.
236
- # @see http://www.fusemail.com/support/administration-api/requests/removedomain removedomain API documentation
236
+ # @see https://www.fusemail.com/support/api-documentation/requests#removedomain removedomain API documentation
237
237
  # @param [Array] opts
238
238
  # @option opts [String] :domain The domain to delete
239
239
  # @option opts [Boolean] :confirm (true) This must be set to true to confirm that you understand all aliases, auto-responders, mailing lists & forwarders with this domain will be permanently deleted.
@@ -243,14 +243,14 @@ module Fusebox
243
243
  :domain => '',
244
244
  :confirm => true
245
245
  }
246
-
246
+
247
247
  opts.reverse_merge! default_options
248
248
  post 'removedomain', opts
249
249
  end
250
-
251
-
250
+
251
+
252
252
  # This request will remove an existing email forwarder
253
- # @see http://www.fusemail.com/support/administration-api/requests/removeforward removeforward API documentation
253
+ # @see https://www.fusemail.com/support/api-documentation/requests#removeforward removeforward API documentation
254
254
  # @param [Array] opts
255
255
  # @option opts [String] :user Username of FuseMail account to remove forwarder to
256
256
  # @option opts [String] :forward_what Email address of forwarder
@@ -262,13 +262,13 @@ module Fusebox
262
262
  :forward_what => '',
263
263
  :forward_to => ''
264
264
  }
265
-
265
+
266
266
  opts.reverse_merge! default_options
267
267
  post 'removeforward', opts
268
268
  end
269
-
269
+
270
270
  # This request will provide information about one or more accounts under your platform in CSV format
271
- # @see http://www.fusemail.com/support/administration-api/requests/report report API documentation
271
+ # @see https://www.fusemail.com/support/api-documentation/requests#report report API documentation
272
272
  # @param [Array] opts
273
273
  # @option opts [String] :user ('all') The username you wish to query for information; you may also enter the username "all" to get information about all users under your platform
274
274
  # @option opts [Boolean] :group_subaccount (true) Provide information not only for the Group Administration account but also for the group sub-accounts under the Group Administration account
@@ -280,13 +280,13 @@ module Fusebox
280
280
  :group_subaccount => true,
281
281
  :report_type => 'basic'
282
282
  }
283
-
283
+
284
284
  opts.reverse_merge! default_options
285
285
  post 'report', opts, "report_#{opts[:report_type]}".to_sym
286
286
  end
287
-
287
+
288
288
  # This request will provide information about mail aliases, forwarders, autoresponders, or mailing lists on one or more accounts under your platform in CSV format.
289
- # @see http://www.fusemail.com/support/administration-api/requests/reportmail reportmail API documentation
289
+ # @see https://www.fusemail.com/support/api-documentation/requests#reportmail reportmail API documentation
290
290
  # @param [Array] opts
291
291
  # @option opts [String] :user ('all') The username you wish to query for information; you may also enter the username "all" to get information about all users under your platform
292
292
  # @option opts [Boolean] :group_subaccount (true) Provide information not only for the Group Administration account but also for the group sub-accounts under the Group Administration account
@@ -303,13 +303,13 @@ module Fusebox
303
303
  :group_subaccount => true,
304
304
  :report_type => 'all'
305
305
  }
306
-
306
+
307
307
  opts.reverse_merge! default_options
308
308
  post 'reportmail', opts, :reportmail
309
309
  end
310
-
310
+
311
311
  # 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.
312
- # @see http://www.fusemail.com/support/administration-api/requests/suspend suspend API documentation
312
+ # @see https://www.fusemail.com/support/api-documentation/requests#suspend suspend API documentation
313
313
  # @param [Array] opts
314
314
  # @option opts [String] :user Username of FuseMail account to suspend
315
315
  # @return [Response]
@@ -317,13 +317,13 @@ module Fusebox
317
317
  default_options = {
318
318
  :user => ''
319
319
  }
320
-
320
+
321
321
  opts.reverse_merge! default_options
322
322
  post 'suspend', opts
323
323
  end
324
-
324
+
325
325
  protected
326
-
326
+
327
327
  # Load the platform authentication informaiton from a YAML file
328
328
  # @see Request.auth_yaml_paths
329
329
  def load_auth_from_yaml
@@ -333,10 +333,10 @@ protected
333
333
  @password = auth['password']
334
334
  return if @username && @password
335
335
  end
336
-
336
+
337
337
  raise "Could not locate a fusemail authentication file in locations: #{self.class.auth_yaml_paths.inspect}"
338
338
  end
339
-
339
+
340
340
  # @param [String] command
341
341
  # @param [Hash] post_vars
342
342
  # @param [Fusebox::Request::CSV_MAPS.keys, nil] result_map_type (nil) For commands that return CSV data, which column map to use
@@ -344,11 +344,11 @@ protected
344
344
  def post (command, post_vars, result_map_type = nil)
345
345
  post_vars.reverse_merge!(:PlatformUser => @username, :PlatformPassword => @password, :request => command)
346
346
  post_vars = self.class.convert_post_vars(post_vars)
347
-
347
+
348
348
  result = Net::HTTP.post_form_with_ssl(URI.parse(self.class.url), post_vars)
349
349
  Response.new(result, result_map_type)
350
350
  end
351
-
351
+
352
352
  # Convert non-string values in post vars to Fusemail's expected formatting
353
353
  # * Boolean => 'yes' or 'no'
354
354
  # * Array => Remove 'foo' and create 'foo[0]', 'foo[1]'
@@ -360,7 +360,7 @@ protected
360
360
  # Convert booleans to 'yes', 'no' strings
361
361
  if [TrueClass, FalseClass].include?(value.class)
362
362
  ret[key] = (value ? 'yes' : 'no')
363
-
363
+
364
364
  # Convert arrays into 'key[0]', 'key[1]', ...
365
365
  elsif value.class == Array
366
366
  value.each_with_index do |value, index|
@@ -370,9 +370,9 @@ protected
370
370
  ret[key] = value
371
371
  end
372
372
  end
373
-
373
+
374
374
  ret
375
375
  end
376
-
376
+
377
377
  end
378
- end
378
+ end