mushy 0.2.4 → 0.2.5

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1dffff192ce9f7784515f5b4c73a1ac15720cc2e8cb5a6a5836b34dd5049eb52
4
- data.tar.gz: 247eeecec22765e28eb98e850982e8ef06ec3e969257da56e0923baadc237b9d
3
+ metadata.gz: 76db9c933d82210929659d12c7e003926a9e6616bffa13b3bf52a10748397a77
4
+ data.tar.gz: 619f6c29844f159327805bad1b5ab0a7c73b4292008bab772686af8caf90abb5
5
5
  SHA512:
6
- metadata.gz: 1a85f196c4c86ad29b3a96d90356cd74264a443cdfaf58a4662a407f4ef01bb2cb7cbd1098f3a20c57a2d3f901160b5ddbf309f6c6d03fcc8d1c691ba08ed9d7
7
- data.tar.gz: 386d48b9ba0aaa610dca7675f780ab186aedf15ae14b3a31e41c119d5e427b0bcd1f58b7f17d6395b6e6625cbdcd328861512507b14bbc3b5681648f1382ac4a
6
+ metadata.gz: edfffd82e02a0e3e1bca89e7b448f4648c57ed130ab09228b743b494d4f78dd3fb995c6cee7277033702206bd96c3a62a193879cc71fc7c6342844cc45c49bcf
7
+ data.tar.gz: ff241f80dbb70b03c7347895437f64e66765b94c99e3ec32a303e9dd6f36c43015c3d1b6935ccd7fc3f73719f4f726e68f2d4be0016ee5125e65e0c802fe6fff
@@ -0,0 +1,46 @@
1
+ module Mushy
2
+
3
+ class Pdf < Browser
4
+
5
+ def self.details
6
+ details = Browser.details
7
+ details['name'] = 'Pdf'
8
+ details['description'] = 'Turn a URL into a PDF.'
9
+
10
+ details[:config][:path] = {
11
+ description: 'The path of the PDF file to save.',
12
+ type: 'text',
13
+ value: 'picture.pdf',
14
+ }
15
+
16
+ details[:config][:landscape] = {
17
+ description: 'Build the PDF in landscape. Defaults to false.',
18
+ type: 'boolean',
19
+ shrink: true,
20
+ value: '',
21
+ }
22
+
23
+ details
24
+ end
25
+
26
+ def adjust input
27
+
28
+ the_browser = input[:browser]
29
+ the_result = input[:result]
30
+ the_config = input[:config]
31
+
32
+ options = {
33
+ path: the_config[:path],
34
+ }
35
+
36
+ options[:landscape] = true if the_config[:landscape].to_s == 'true'
37
+
38
+ the_browser.pdf options
39
+
40
+ options
41
+
42
+ end
43
+
44
+ end
45
+
46
+ end
@@ -0,0 +1,115 @@
1
+ require 'pony'
2
+
3
+ module Mushy
4
+
5
+ class Smtp < Flux
6
+
7
+ def self.details
8
+ {
9
+ name: 'Smtp',
10
+ description: 'Send email through SMTP.',
11
+ config: {
12
+ from: {
13
+ description: 'From whom the email will be sent.',
14
+ type: 'text',
15
+ shrink: true,
16
+ value: '',
17
+ },
18
+ to: {
19
+ description: 'To whom the email should be sent.',
20
+ type: 'text',
21
+ value: '',
22
+ },
23
+ subject: {
24
+ description: 'The subject of the email.',
25
+ type: 'text',
26
+ value: '',
27
+ },
28
+ body: {
29
+ description: 'The text body of the email.',
30
+ type: 'textarea',
31
+ value: '',
32
+ },
33
+ html_body: {
34
+ description: 'The HTML body of the email.',
35
+ type: 'textarea',
36
+ value: '',
37
+ },
38
+ attachment_file: {
39
+ description: 'The full path of a file to attach.',
40
+ type: 'text',
41
+ shrink: true,
42
+ value: '',
43
+ },
44
+ address: {
45
+ description: 'The address of the SMTP server.',
46
+ type: 'text',
47
+ value: 'smtp.gmail.com',
48
+ },
49
+ port: {
50
+ description: 'The SMTP server port.',
51
+ type: 'integer',
52
+ value: '587',
53
+ },
54
+ domain: {
55
+ description: 'The email domain.',
56
+ type: 'text',
57
+ value: 'gmail.com',
58
+ },
59
+ username: {
60
+ description: 'The username.',
61
+ type: 'text',
62
+ value: '',
63
+ },
64
+ password: {
65
+ description: 'The password.',
66
+ type: 'text',
67
+ value: '',
68
+ },
69
+ },
70
+ }
71
+ end
72
+
73
+ def process event, config
74
+ options = adjust(cleanup({
75
+ from: config[:from],
76
+ to: config[:to],
77
+ subject: config[:subject],
78
+ body: config[:body],
79
+ html_body: config[:html_body],
80
+ via_options: get_via_options_from(config)
81
+ }))
82
+
83
+ if (config[:attachment_file].to_s != '')
84
+ options[:attachments] = { config[:attachment_file].split("\/")[-1] => File.read(config[:attachment_file]) }
85
+ end
86
+
87
+ result = Pony.mail options
88
+ options.tap { |x| x.delete(:via_options) }
89
+ end
90
+
91
+ def adjust options
92
+ options.tap { |x| x[:via] = 'smtp' }
93
+ end
94
+
95
+ def cleanup options
96
+ options.tap do |hash|
97
+ hash.delete_if { |_, v| v.to_s == '' }
98
+ end
99
+ end
100
+
101
+ def get_via_options_from config
102
+ {
103
+ address: config[:address],
104
+ port: config[:port].to_s,
105
+ user_name: config[:username],
106
+ password: config[:password],
107
+ domain: config[:domain],
108
+ authentication: :plain,
109
+ enable_starttls_auto: true,
110
+ }
111
+ end
112
+
113
+ end
114
+
115
+ end
data/mushy.gemspec CHANGED
@@ -4,7 +4,7 @@ require 'mushy/version'
4
4
 
5
5
  Gem::Specification.new do |s|
6
6
  s.name = 'mushy'
7
- s.version = '0.2.4'
7
+ s.version = '0.2.5'
8
8
  s.date = '2020-11-23'
9
9
  s.summary = 'Process streams of work using common modules.'
10
10
  s.description = 'This tool assists in the creation and processing of workflows.'
@@ -24,4 +24,5 @@ Gem::Specification.new do |s|
24
24
  s.add_runtime_dependency 'ferrum'
25
25
  s.add_runtime_dependency 'nokogiri'
26
26
  s.add_runtime_dependency 'faraday'
27
+ s.add_runtime_dependency 'pony'
27
28
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mushy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Darren Cauthon
@@ -122,6 +122,20 @@ dependencies:
122
122
  - - ">="
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: pony
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :runtime
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
125
139
  description: This tool assists in the creation and processing of workflows.
126
140
  email: darren@cauthon.com
127
141
  executables:
@@ -149,9 +163,11 @@ files:
149
163
  - lib/mushy/fluxs/get.rb
150
164
  - lib/mushy/fluxs/ls.rb
151
165
  - lib/mushy/fluxs/parse_html.rb
166
+ - lib/mushy/fluxs/pdf.rb
152
167
  - lib/mushy/fluxs/read_csv.rb
153
168
  - lib/mushy/fluxs/read_file.rb
154
169
  - lib/mushy/fluxs/screenshot.rb
170
+ - lib/mushy/fluxs/smtp.rb
155
171
  - lib/mushy/fluxs/write_file.rb
156
172
  - lib/mushy/masher.rb
157
173
  - lib/mushy/run.rb