backupii 0.1.0.pre.alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (135) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +19 -0
  3. data/README.md +37 -0
  4. data/bin/backupii +5 -0
  5. data/bin/docker_test +24 -0
  6. data/lib/backup/archive.rb +171 -0
  7. data/lib/backup/binder.rb +23 -0
  8. data/lib/backup/cleaner.rb +114 -0
  9. data/lib/backup/cli.rb +376 -0
  10. data/lib/backup/cloud_io/base.rb +40 -0
  11. data/lib/backup/cloud_io/cloud_files.rb +301 -0
  12. data/lib/backup/cloud_io/s3.rb +256 -0
  13. data/lib/backup/compressor/base.rb +34 -0
  14. data/lib/backup/compressor/bzip2.rb +37 -0
  15. data/lib/backup/compressor/custom.rb +51 -0
  16. data/lib/backup/compressor/gzip.rb +76 -0
  17. data/lib/backup/config/dsl.rb +103 -0
  18. data/lib/backup/config/helpers.rb +139 -0
  19. data/lib/backup/config.rb +122 -0
  20. data/lib/backup/database/base.rb +89 -0
  21. data/lib/backup/database/mongodb.rb +189 -0
  22. data/lib/backup/database/mysql.rb +194 -0
  23. data/lib/backup/database/openldap.rb +97 -0
  24. data/lib/backup/database/postgresql.rb +134 -0
  25. data/lib/backup/database/redis.rb +179 -0
  26. data/lib/backup/database/riak.rb +82 -0
  27. data/lib/backup/database/sqlite.rb +57 -0
  28. data/lib/backup/encryptor/base.rb +29 -0
  29. data/lib/backup/encryptor/gpg.rb +745 -0
  30. data/lib/backup/encryptor/open_ssl.rb +76 -0
  31. data/lib/backup/errors.rb +55 -0
  32. data/lib/backup/logger/console.rb +50 -0
  33. data/lib/backup/logger/fog_adapter.rb +27 -0
  34. data/lib/backup/logger/logfile.rb +134 -0
  35. data/lib/backup/logger/syslog.rb +116 -0
  36. data/lib/backup/logger.rb +199 -0
  37. data/lib/backup/model.rb +478 -0
  38. data/lib/backup/notifier/base.rb +128 -0
  39. data/lib/backup/notifier/campfire.rb +63 -0
  40. data/lib/backup/notifier/command.rb +101 -0
  41. data/lib/backup/notifier/datadog.rb +107 -0
  42. data/lib/backup/notifier/flowdock.rb +101 -0
  43. data/lib/backup/notifier/hipchat.rb +118 -0
  44. data/lib/backup/notifier/http_post.rb +116 -0
  45. data/lib/backup/notifier/mail.rb +235 -0
  46. data/lib/backup/notifier/nagios.rb +67 -0
  47. data/lib/backup/notifier/pagerduty.rb +82 -0
  48. data/lib/backup/notifier/prowl.rb +70 -0
  49. data/lib/backup/notifier/pushover.rb +73 -0
  50. data/lib/backup/notifier/ses.rb +126 -0
  51. data/lib/backup/notifier/slack.rb +149 -0
  52. data/lib/backup/notifier/twitter.rb +57 -0
  53. data/lib/backup/notifier/zabbix.rb +62 -0
  54. data/lib/backup/package.rb +53 -0
  55. data/lib/backup/packager.rb +108 -0
  56. data/lib/backup/pipeline.rb +122 -0
  57. data/lib/backup/splitter.rb +75 -0
  58. data/lib/backup/storage/base.rb +72 -0
  59. data/lib/backup/storage/cloud_files.rb +158 -0
  60. data/lib/backup/storage/cycler.rb +73 -0
  61. data/lib/backup/storage/dropbox.rb +208 -0
  62. data/lib/backup/storage/ftp.rb +118 -0
  63. data/lib/backup/storage/local.rb +63 -0
  64. data/lib/backup/storage/qiniu.rb +68 -0
  65. data/lib/backup/storage/rsync.rb +251 -0
  66. data/lib/backup/storage/s3.rb +157 -0
  67. data/lib/backup/storage/scp.rb +67 -0
  68. data/lib/backup/storage/sftp.rb +82 -0
  69. data/lib/backup/syncer/base.rb +70 -0
  70. data/lib/backup/syncer/cloud/base.rb +180 -0
  71. data/lib/backup/syncer/cloud/cloud_files.rb +83 -0
  72. data/lib/backup/syncer/cloud/local_file.rb +99 -0
  73. data/lib/backup/syncer/cloud/s3.rb +118 -0
  74. data/lib/backup/syncer/rsync/base.rb +55 -0
  75. data/lib/backup/syncer/rsync/local.rb +29 -0
  76. data/lib/backup/syncer/rsync/pull.rb +49 -0
  77. data/lib/backup/syncer/rsync/push.rb +206 -0
  78. data/lib/backup/template.rb +45 -0
  79. data/lib/backup/utilities.rb +235 -0
  80. data/lib/backup/version.rb +5 -0
  81. data/lib/backup.rb +141 -0
  82. data/templates/cli/archive +28 -0
  83. data/templates/cli/compressor/bzip2 +4 -0
  84. data/templates/cli/compressor/custom +7 -0
  85. data/templates/cli/compressor/gzip +4 -0
  86. data/templates/cli/config +123 -0
  87. data/templates/cli/databases/mongodb +15 -0
  88. data/templates/cli/databases/mysql +18 -0
  89. data/templates/cli/databases/openldap +24 -0
  90. data/templates/cli/databases/postgresql +16 -0
  91. data/templates/cli/databases/redis +16 -0
  92. data/templates/cli/databases/riak +17 -0
  93. data/templates/cli/databases/sqlite +11 -0
  94. data/templates/cli/encryptor/gpg +27 -0
  95. data/templates/cli/encryptor/openssl +9 -0
  96. data/templates/cli/model +26 -0
  97. data/templates/cli/notifier/zabbix +15 -0
  98. data/templates/cli/notifiers/campfire +12 -0
  99. data/templates/cli/notifiers/command +32 -0
  100. data/templates/cli/notifiers/datadog +57 -0
  101. data/templates/cli/notifiers/flowdock +16 -0
  102. data/templates/cli/notifiers/hipchat +16 -0
  103. data/templates/cli/notifiers/http_post +32 -0
  104. data/templates/cli/notifiers/mail +24 -0
  105. data/templates/cli/notifiers/nagios +13 -0
  106. data/templates/cli/notifiers/pagerduty +12 -0
  107. data/templates/cli/notifiers/prowl +11 -0
  108. data/templates/cli/notifiers/pushover +11 -0
  109. data/templates/cli/notifiers/ses +15 -0
  110. data/templates/cli/notifiers/slack +22 -0
  111. data/templates/cli/notifiers/twitter +13 -0
  112. data/templates/cli/splitter +7 -0
  113. data/templates/cli/storages/cloud_files +11 -0
  114. data/templates/cli/storages/dropbox +20 -0
  115. data/templates/cli/storages/ftp +13 -0
  116. data/templates/cli/storages/local +8 -0
  117. data/templates/cli/storages/qiniu +12 -0
  118. data/templates/cli/storages/rsync +17 -0
  119. data/templates/cli/storages/s3 +16 -0
  120. data/templates/cli/storages/scp +15 -0
  121. data/templates/cli/storages/sftp +15 -0
  122. data/templates/cli/syncers/cloud_files +22 -0
  123. data/templates/cli/syncers/rsync_local +20 -0
  124. data/templates/cli/syncers/rsync_pull +28 -0
  125. data/templates/cli/syncers/rsync_push +28 -0
  126. data/templates/cli/syncers/s3 +27 -0
  127. data/templates/general/links +3 -0
  128. data/templates/general/version.erb +2 -0
  129. data/templates/notifier/mail/failure.erb +16 -0
  130. data/templates/notifier/mail/success.erb +16 -0
  131. data/templates/notifier/mail/warning.erb +16 -0
  132. data/templates/storage/dropbox/authorization_url.erb +6 -0
  133. data/templates/storage/dropbox/authorized.erb +4 -0
  134. data/templates/storage/dropbox/cache_file_written.erb +10 -0
  135. metadata +507 -0
@@ -0,0 +1,101 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Backup
4
+ module Notifier
5
+ class Command < Base
6
+ ##
7
+ # Command to execute.
8
+ #
9
+ # Make sure it is accessible from your $PATH, or provide
10
+ # the absolute path to the command.
11
+ attr_accessor :command
12
+
13
+ ##
14
+ # Arguments to pass to the command.
15
+ #
16
+ # Must be an array of strings or callable objects.
17
+ #
18
+ # Callables will be invoked with #call(model, status),
19
+ # and the return value used as the argument.
20
+ #
21
+ # In strings you can use the following placeholders:
22
+ #
23
+ # %l - Model label
24
+ # %t - Model trigger
25
+ # %d - Backup duration (HH:MM:SS)
26
+ # %s - Status (success/failure/warning)
27
+ # %v - Status verb (succeeded/failed/succeeded with warnings)
28
+ #
29
+ # All placeholders can be used with uppercase letters to capitalize
30
+ # the value.
31
+ #
32
+ # Defaults to ["%L %v"]
33
+ attr_accessor :args
34
+
35
+ def initialize(model, &block)
36
+ super
37
+ instance_eval(&block) if block_given?
38
+
39
+ @args ||= ["%L %v"]
40
+ end
41
+
42
+ private
43
+
44
+ ##
45
+ # Notify the user of the backup operation results.
46
+ #
47
+ # `status` indicates one of the following:
48
+ #
49
+ # `:success`
50
+ # : The backup completed successfully.
51
+ # : Notification will be sent if `on_success` is `true`.
52
+ #
53
+ # `:warning`
54
+ # : The backup completed successfully, but warnings were logged.
55
+ # : Notification will be sent if `on_warning` or `on_success` is `true`.
56
+ #
57
+ # `:failure`
58
+ # : The backup operation failed.
59
+ # : Notification will be sent if `on_warning` or `on_success` is `true`.
60
+ #
61
+ def notify!(status)
62
+ IO.popen([@command] + args.map { |arg| format_arg(arg, status) })
63
+ end
64
+
65
+ def format_arg(arg, status)
66
+ if arg.respond_to?(:call)
67
+ arg.call(model, status)
68
+ else
69
+ arg.gsub(%r{%(\w)}) do |match|
70
+ ph = match[1]
71
+ val = case ph.downcase
72
+ when "l"
73
+ model.label
74
+ when "t"
75
+ model.trigger.to_s
76
+ when "d"
77
+ model.duration
78
+ when "v"
79
+ status_verb(status)
80
+ when "s"
81
+ status.to_s
82
+ end
83
+ val = val.capitalize if ph == ph.upcase
84
+ val
85
+ end
86
+ end
87
+ end
88
+
89
+ def status_verb(status)
90
+ case status
91
+ when :success
92
+ "succeeded"
93
+ when :failure
94
+ "failed"
95
+ when :warning
96
+ "succeeded with warnings"
97
+ end
98
+ end
99
+ end
100
+ end
101
+ end
@@ -0,0 +1,107 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "dogapi"
4
+
5
+ module Backup
6
+ module Notifier
7
+ class DataDog < Base
8
+ ##
9
+ # The DataDog API key
10
+ attr_accessor :api_key
11
+
12
+ ##
13
+ # The title of the event
14
+ attr_accessor :title
15
+
16
+ attr_deprecate :text,
17
+ version: "4.2",
18
+ message: "Please use the `message` attribute. For more information "\
19
+ "see https://github.com/backup/backup/pull/698"
20
+
21
+ ##
22
+ # The timestamp for the event
23
+ attr_accessor :date_happened
24
+
25
+ ##
26
+ # The priority of the event (low/normal)
27
+ attr_accessor :priority
28
+
29
+ ##
30
+ # The host that generated the event
31
+ attr_accessor :host
32
+
33
+ ##
34
+ # The tags for this host (should be an array)
35
+ attr_accessor :tags
36
+
37
+ ##
38
+ # The alert_type of the event (error/warning/info/success)
39
+ attr_accessor :alert_type
40
+
41
+ ##
42
+ # The aggregation_key for the event
43
+ attr_accessor :aggregation_key
44
+
45
+ ##
46
+ # The source_type for the event (nagios, hudson, jenkins, user, my apps,
47
+ # feed, chef, puppet, git, bitbucket, fabric, capistrano)
48
+ attr_accessor :source_type_name
49
+
50
+ def initialize(model, &block)
51
+ super
52
+ instance_eval(&block) if block_given?
53
+ @title ||= "Backup #{model.label}"
54
+ end
55
+
56
+ private
57
+
58
+ ##
59
+ # Notify the user of the backup operation results.
60
+ #
61
+ # `status` indicates one of the following:
62
+ #
63
+ # `:success`
64
+ # : The backup completed successfully.
65
+ # : Notification will be sent if `on_success` is `true`.
66
+ #
67
+ # `:warning`
68
+ # : The backup completed successfully, but warnings were logged.
69
+ # : Notification will be sent if `on_warning` or `on_success` is `true`.
70
+ #
71
+ # `:failure`
72
+ # : The backup operation failed.
73
+ # : Notification will be sent if `on_warning` or `on_success` is `true`.
74
+ #
75
+ def notify!(status)
76
+ msg = message.call(model, status: status_data_for(status))
77
+
78
+ hash = { alert_type: default_alert_type(status) }
79
+ hash.store(:msg_title, @title)
80
+ hash.store(:date_happened, @date_happened) if @date_happened
81
+ hash.store(:priority, @priority) if @priority
82
+ hash.store(:host, @host) if @host
83
+ hash.store(:tags, @tags) if @tags
84
+ hash.store(:aggregation_key, @aggregation_key) if @aggregation_key
85
+ hash.store(:source_type_name, @source_type_name) if @source_type_name
86
+ hash.store(:alert_type, @alert_type) if @alert_type
87
+ send_event(msg, hash)
88
+ end
89
+
90
+ # Dogapi::Client will raise an error if unsuccessful.
91
+ def send_event(msg, hash)
92
+ client = Dogapi::Client.new(@api_key)
93
+ event = Dogapi::Event.new(msg, hash)
94
+ client.emit_event(event)
95
+ end
96
+
97
+ # set alert type
98
+ def default_alert_type(status)
99
+ case status
100
+ when :success then "success"
101
+ when :warning then "warning"
102
+ when :failure then "error"
103
+ end
104
+ end
105
+ end
106
+ end
107
+ end
@@ -0,0 +1,101 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "flowdock"
4
+
5
+ module Backup
6
+ module Notifier
7
+ class FlowDock < Base
8
+ ##
9
+ # The Flowdock API token
10
+ attr_accessor :token
11
+
12
+ ##
13
+ # Who the notification should appear from
14
+ attr_accessor :from_name
15
+
16
+ # Which email the notification should appear from
17
+ attr_accessor :from_email
18
+
19
+ ##
20
+ # source for message
21
+ attr_accessor :source
22
+
23
+ ##
24
+ # Subject for message
25
+ attr_accessor :subject
26
+
27
+ ##
28
+ # tag message in inbox
29
+ attr_accessor :tags
30
+
31
+ ##
32
+ # link for message
33
+ attr_accessor :link
34
+
35
+ def initialize(model, &block)
36
+ super
37
+ instance_eval(&block) if block_given?
38
+
39
+ @subject ||= default_subject
40
+ @source ||= default_source
41
+ @tags ||= []
42
+ end
43
+
44
+ private
45
+
46
+ ##
47
+ # Notify the user of the backup operation results.
48
+ #
49
+ # `status` indicates one of the following:
50
+ #
51
+ # `:success`
52
+ # : The backup completed successfully.
53
+ # : Notification will be sent if `on_success` is `true`.
54
+ #
55
+ # `:warning`
56
+ # : The backup completed successfully, but warnings were logged.
57
+ # : Notification will be sent if `on_warning` or `on_success` is `true`.
58
+ #
59
+ # `:failure`
60
+ # : The backup operation failed.
61
+ # : Notification will be sent if `on_warning` or `on_success` is `true`.
62
+ #
63
+ def notify!(status)
64
+ @tags += default_tags(status)
65
+ send_message(message.call(model, status: status_data_for(status)))
66
+ end
67
+
68
+ # Flowdock::Client will raise an error if unsuccessful.
69
+ def send_message(msg)
70
+ client = Flowdock::Flow.new(
71
+ api_token: token, source: source,
72
+ from: { name: from_name, address: from_email }
73
+ )
74
+
75
+ client.push_to_team_inbox(subject: subject,
76
+ content: msg,
77
+ tags: tags,
78
+ link: link)
79
+ end
80
+
81
+ # set related tags
82
+ def default_tags(status)
83
+ case status
84
+ when :success then ["#BackupSuccess"]
85
+ when :warning then ["#BackupWarning"]
86
+ when :failure then ["#BackupFailure"]
87
+ end
88
+ end
89
+
90
+ # set default source
91
+ def default_source
92
+ "Backup #{model.label}"
93
+ end
94
+
95
+ # set default subject
96
+ def default_subject
97
+ "Backup Notification"
98
+ end
99
+ end
100
+ end
101
+ end
@@ -0,0 +1,118 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "hipchat"
4
+
5
+ module Backup
6
+ module Notifier
7
+ class Hipchat < Base
8
+ ##
9
+ # The Hipchat API token
10
+ attr_accessor :token
11
+
12
+ ##
13
+ # The Hipchat API version
14
+ # Either 'v1' or 'v2' (default is 'v1')
15
+ attr_accessor :api_version
16
+
17
+ ##
18
+ # Who the notification should appear from
19
+ attr_accessor :from
20
+
21
+ ##
22
+ # Custom server URL
23
+ attr_accessor :server_url
24
+
25
+ ##
26
+ # The rooms that should be notified
27
+ attr_accessor :rooms_notified
28
+
29
+ ##
30
+ # Notify users in the room
31
+ attr_accessor :notify_users
32
+
33
+ ##
34
+ # The background color of a success message.
35
+ # One of :yellow, :red, :green, :purple, or :random. (default: yellow)
36
+ attr_accessor :success_color
37
+
38
+ ##
39
+ # The background color of a warning message.
40
+ # One of :yellow, :red, :green, :purple, or :random. (default: yellow)
41
+ attr_accessor :warning_color
42
+
43
+ ##
44
+ # The background color of an error message.
45
+ # One of :yellow, :red, :green, :purple, or :random. (default: yellow)
46
+ attr_accessor :failure_color
47
+
48
+ def initialize(model, &block)
49
+ super
50
+ instance_eval(&block) if block_given?
51
+
52
+ @notify_users ||= false
53
+ @rooms_notified ||= []
54
+ @success_color ||= "yellow"
55
+ @warning_color ||= "yellow"
56
+ @failure_color ||= "yellow"
57
+ @api_version ||= "v1"
58
+ end
59
+
60
+ private
61
+
62
+ ##
63
+ # Notify the user of the backup operation results.
64
+ #
65
+ # `status` indicates one of the following:
66
+ #
67
+ # `:success`
68
+ # : The backup completed successfully.
69
+ # : Notification will be sent if `on_success` is `true`.
70
+ #
71
+ # `:warning`
72
+ # : The backup completed successfully, but warnings were logged.
73
+ # : Notification will be sent if `on_warning` or `on_success` is `true`.
74
+ #
75
+ # `:failure`
76
+ # : The backup operation failed.
77
+ # : Notification will be sent if `on_warning` or `on_success` is `true`.
78
+ #
79
+ def notify!(status)
80
+ status_data = status_data_for(status)
81
+ msg = message.call(model, status: status_data)
82
+ send_message(msg, status_data[:color])
83
+ end
84
+
85
+ def client_options
86
+ { api_version: @api_version }.tap do |h|
87
+ h[:server_url] = server_url if server_url
88
+ end
89
+ end
90
+
91
+ # Hipchat::Client will raise an error if unsuccessful.
92
+ def send_message(msg, color)
93
+ client = HipChat::Client.new(token, client_options)
94
+ rooms_to_notify.each do |room|
95
+ client[room].send(from, msg, color: color, notify: notify_users)
96
+ end
97
+ end
98
+
99
+ def rooms_to_notify
100
+ Array(rooms_notified).map { |r| r.split(",").map(&:strip) }.flatten
101
+ end
102
+
103
+ def status_data_for(status)
104
+ data = super(status)
105
+ data[:color] = status_color_for(status)
106
+ data
107
+ end
108
+
109
+ def status_color_for(status)
110
+ {
111
+ success: success_color,
112
+ warning: warning_color,
113
+ failure: failure_color
114
+ }[status]
115
+ end
116
+ end
117
+ end
118
+ end
@@ -0,0 +1,116 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "uri"
4
+
5
+ module Backup
6
+ module Notifier
7
+ class HttpPost < Base
8
+ ##
9
+ # URI to post notification to.
10
+ #
11
+ # URI scheme may be `http` or `https`.
12
+ #
13
+ # If Basic Authentication is needed, supply the `user:password` in the
14
+ # URI. e.g. 'https://user:pass@www.example.com/path'
15
+ #
16
+ # Port may also be supplied.
17
+ # e.g. 'http://www.example.com:8080/path'
18
+ attr_accessor :uri
19
+
20
+ ##
21
+ # Hash of additional HTTP headers to send.
22
+ #
23
+ # This notifier sets the following headers:
24
+ # { 'User-Agent' => "Backup/#{ Backup::VERSION }",
25
+ # 'Content-Type' => 'x-www-form-urlencoded' }
26
+ #
27
+ # 'Content-Type' may not be changed.
28
+ # 'User-Agent' may be overridden or omitted by setting it to +nil+.
29
+ # e.g. { 'Authorization' => 'my_auth_info', 'User-Agent' => nil }
30
+ attr_accessor :headers
31
+
32
+ ##
33
+ # Hash of additional POST parameters to send.
34
+ #
35
+ # This notifier will set two parameters:
36
+ # { 'status' => 'success|warning|failure',
37
+ # 'message' => '[Backup::(Success|Warning|Failure)] label (trigger)' }
38
+ #
39
+ # 'status' may not be changed.
40
+ # 'message' may be overridden or omitted by setting a +nil+ value.
41
+ # e.g. { 'auth_token' => 'my_token', 'message' => nil }
42
+ attr_accessor :params
43
+
44
+ ##
45
+ # Successful HTTP Status Code(s) that should be returned.
46
+ #
47
+ # This may be a single code or an Array of acceptable codes.
48
+ # e.g. [200, 201, 204]
49
+ #
50
+ # If any other response code is returned, the request will be retried
51
+ # using `max_retries` and `retry_waitsec`.
52
+ #
53
+ # Default: 200
54
+ attr_accessor :success_codes
55
+
56
+ ##
57
+ # Verify the server's certificate when using SSL.
58
+ #
59
+ # This will default to +true+ for most systems. It may be forced by
60
+ # setting to +true+, or disabled by setting to +false+.
61
+ attr_accessor :ssl_verify_peer
62
+
63
+ ##
64
+ # Path to a +cacert.pem+ file to use for +ssl_verify_peer+.
65
+ #
66
+ # This is provided (via Excon), but may be specified if needed.
67
+ attr_accessor :ssl_ca_file
68
+
69
+ def initialize(model, &block)
70
+ super
71
+ instance_eval(&block) if block_given?
72
+
73
+ @headers ||= {}
74
+ @params ||= {}
75
+ @success_codes ||= 200
76
+ end
77
+
78
+ private
79
+
80
+ ##
81
+ # Notify the user of the backup operation results.
82
+ #
83
+ # `status` indicates one of the following:
84
+ #
85
+ # `:success`
86
+ # : The backup completed successfully.
87
+ # : Notification will be sent if `on_success` is `true`.
88
+ #
89
+ # `:warning`
90
+ # : The backup completed successfully, but warnings were logged.
91
+ # : Notification will be sent if `on_warning` or `on_success` is `true`.
92
+ #
93
+ # `:failure`
94
+ # : The backup operation failed.
95
+ # : Notification will be sent if `on_warning` or `on_success` is `true`.
96
+ #
97
+ def notify!(status)
98
+ msg = message.call(model, status: status_data_for(status))
99
+
100
+ opts = {
101
+ headers: { "User-Agent" => "Backup/#{VERSION}" }
102
+ .merge(headers).reject { |_, value| value.nil? }
103
+ .merge("Content-Type" => "application/x-www-form-urlencoded"),
104
+ body: URI.encode_www_form({ "message" => msg }
105
+ .merge(params).reject { |_, value| value.nil? }
106
+ .merge("status" => status.to_s)),
107
+ expects: success_codes # raise error if unsuccessful
108
+ }
109
+ opts[:ssl_verify_peer] = ssl_verify_peer unless ssl_verify_peer.nil?
110
+ opts[:ssl_ca_file] = ssl_ca_file if ssl_ca_file
111
+
112
+ Excon.post(uri, opts)
113
+ end
114
+ end
115
+ end
116
+ end