mushy 0.15.1 → 0.18.0

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.
@@ -5,7 +5,7 @@ module Mushy
5
5
  def self.details
6
6
  details = Browser.details
7
7
  details[:name] = 'Screenshot'
8
- details[:description] = 'Take a screenshot of the browser.'
8
+ details[:description] = 'Take a screenshot of the browser. This works the same as the Browser, but with a screenshot at the end.'
9
9
 
10
10
  details[:config].merge!(Mushy::WriteFile.file_saving_config.tap do |x|
11
11
  x[x.keys.first][:value] = 'file.jpg'
@@ -23,7 +23,76 @@ module Mushy
23
23
  shrink: true,
24
24
  value: '',
25
25
  }
26
- details
26
+ details.tap do |config|
27
+ config[:examples] = {
28
+ "Screenshot of google.com" => {
29
+ description: 'This will open https://www.google.com and take a screenshot.',
30
+ config: {
31
+ url: "https://www.google.com",
32
+ file: 'file.jpg'
33
+ },
34
+ result: {
35
+ url: "https://www.google.com/",
36
+ status: 200,
37
+ title: "Google",
38
+ cookies: [
39
+ {
40
+ name: "1P_JAR",
41
+ value: "2021-10-07-21",
42
+ domain: ".google.com",
43
+ path: "/",
44
+ expires: 1636232420.005369,
45
+ size: 19,
46
+ httpOnly: false,
47
+ secure: true,
48
+ session: false,
49
+ sameSite: "None",
50
+ priority: "Medium"
51
+ }
52
+ ],
53
+ headers: {},
54
+ time: 1.520785498,
55
+ body: "...",
56
+ options: {
57
+ path: "file.jpg",
58
+ full: true,
59
+ quality: 100
60
+ },
61
+ file: {
62
+ inode: "439545",
63
+ hard_links: 1,
64
+ owner: "pi",
65
+ group: "pi",
66
+ size: 54269,
67
+ date: {
68
+ year: 2021,
69
+ month: 10,
70
+ day: 7,
71
+ hour: 16,
72
+ minute: 0,
73
+ second: 20,
74
+ nanosecond: 444437482,
75
+ utc_offset: -18000,
76
+ weekday: 4,
77
+ day_of_month: 7,
78
+ day_of_year: 280,
79
+ string: "2021-10-07 16:00:20 -0500",
80
+ epoch_integer: 1633640420,
81
+ epoch_float: 1633640420.4444375,
82
+ seconds_ago: 0.016297478
83
+ },
84
+ name: "file.jpg",
85
+ type: "-",
86
+ owner_permission: "rw-",
87
+ group_permission: "r--",
88
+ other_permission: "r--",
89
+ directory: "/home/pi/Desktop/mushy",
90
+ path: "/home/pi/Desktop/mushy/file.jpg"
91
+ }
92
+ }
93
+ },
94
+ }
95
+ end
27
96
  end
28
97
 
29
98
  def adjust input
@@ -0,0 +1,27 @@
1
+ module Mushy
2
+
3
+ class Stdout < Flux
4
+
5
+ def self.details
6
+ {
7
+ name: 'Stdout',
8
+ title: 'Stdout / Print',
9
+ description: 'Standard Out',
10
+ config: {
11
+ message: {
12
+ description: 'The message to display.',
13
+ type: 'text',
14
+ value: '{{message}}',
15
+ },
16
+ },
17
+ }
18
+ end
19
+
20
+ def process event, config
21
+ puts config[:message]
22
+ nil
23
+ end
24
+
25
+ end
26
+
27
+ end
@@ -12,6 +12,13 @@ module Mushy
12
12
  type: 'integer',
13
13
  value: '1',
14
14
  },
15
+ },
16
+ examples: {
17
+ "Basic Example" => {
18
+ input: {name: "Elephant"},
19
+ config: {times: 2},
20
+ result: [ { name: "Elephant", index: 0 }, { name: "Elephant", index: 1 } ],
21
+ }
15
22
  }
16
23
  }
17
24
  end
@@ -0,0 +1,112 @@
1
+ module Mushy
2
+
3
+ class TwilioMessage < Bash
4
+
5
+ def self.details
6
+ {
7
+ name: 'TwilioMessage',
8
+ title: 'Twilio Message',
9
+ description: 'Send a Twilio Message.',
10
+ config: {
11
+ account_sid: {
12
+ description: 'Your Twilio Account SID.',
13
+ type: 'text',
14
+ value: '{{twilio_account_sid}}',
15
+ },
16
+ auth_token: {
17
+ description: 'Your Twilio Auth Token.',
18
+ type: 'text',
19
+ value: '{{twilio_auth_token}}',
20
+ },
21
+ from: {
22
+ description: 'The phone number from which the message will be sent.',
23
+ type: 'text',
24
+ value: '+1{{from}}',
25
+ },
26
+ to: {
27
+ description: 'The phone number to which the message will be sent.',
28
+ type: 'text',
29
+ value: '+1{{to}}',
30
+ },
31
+ body: {
32
+ description: 'The content of the message.',
33
+ type: 'text',
34
+ value: '{{body}}',
35
+ },
36
+ media_url: {
37
+ description: 'A URL to a file that can be included with the text message, like https://.../your_file.png.',
38
+ type: 'text',
39
+ value: '',
40
+ shrink: true,
41
+ },
42
+ },
43
+ examples: {
44
+ "Basic Example" => {
45
+ description: "This is what a basic text message.",
46
+ input: { message: "Hello World!" },
47
+ config: {
48
+ account_sid: 'Your Twilio Account SID',
49
+ auth_token: 'Your Twilio Auth Token',
50
+ from: '+15555555555',
51
+ to: '+14444444444',
52
+ body: '{{message}}',
53
+ },
54
+ result: {
55
+ sid: "the sid",
56
+ date_created: "Sun, 10 Oct 2021 20:16:48 +0000",
57
+ date_updated: "Sun, 10 Oct 2021 20:16:48 +0000",
58
+ date_sent: nil,
59
+ account_sid: "account sid",
60
+ to: "+15555555555",
61
+ from: "+14444444444",
62
+ messaging_service_sid: nil,
63
+ body: "Hello World!",
64
+ status: "queued",
65
+ num_segments: "1",
66
+ num_media: "0",
67
+ direction: "outbound-api",
68
+ api_version: "2010-04-01",
69
+ price: nil,
70
+ price_unit: "USD",
71
+ error_code: nil,
72
+ error_message: nil,
73
+ uri: "/2010-04-01/Accounts/ABC/Messages/DEF.json",
74
+ subresource_uris: {
75
+ media: "/2010-04-01/Accounts/ABC/Messages/DEF/Media.json"
76
+ }
77
+ }
78
+ },
79
+ "A Failed Call" => {
80
+ description: "This is what a failed call may look like.",
81
+ result: {
82
+ code: 20003,
83
+ detail: "Your AccountSid or AuthToken was incorrect.",
84
+ message: "Authentication Error - invalid username",
85
+ more_info: "https://www.twilio.com/docs/errors/20003",
86
+ status: 401
87
+ }
88
+ },
89
+ },
90
+ }
91
+ end
92
+
93
+ def process event, config
94
+ arguments = {
95
+ from: "From",
96
+ to: "To",
97
+ body: "Body",
98
+ media_url: "MediaUrl",
99
+ }.select { |x| config[x].to_s != "" }
100
+ .map { |x| [x[1], config[x[0]].to_s.gsub('"', '\\"')] }
101
+ .reduce("") { |t, i| "#{t} --data-urlencode \"#{i[0]}=#{i[1]}\"" }
102
+
103
+ config[:command] = "curl -X POST https://api.twilio.com/2010-04-01/Accounts/#{config[:account_sid]}/Messages.json -u #{config[:account_sid]}:#{config[:auth_token]} #{arguments}"
104
+
105
+ result = super event, config
106
+
107
+ JSON.parse result[:text]
108
+ end
109
+
110
+ end
111
+
112
+ end
@@ -5,6 +5,7 @@ module Mushy
5
5
  def self.details
6
6
  {
7
7
  name: 'WriteFile',
8
+ title: 'Write File',
8
9
  description: 'Write a file.',
9
10
  config: file_saving_config.merge({
10
11
  data: {
@@ -13,6 +14,52 @@ module Mushy
13
14
  value: '{{data}}',
14
15
  },
15
16
  }),
17
+ examples: {
18
+ "Example" => {
19
+ description: 'Using this Flux to write the contents of a text file. Details about the file are returned.',
20
+ input: {
21
+ file: "data.csv",
22
+ content: "a,b,c\nd,e,f",
23
+ },
24
+ config: {
25
+ file: '{{file}}',
26
+ data: '{{content}}'
27
+ },
28
+ result: {
29
+ file: {
30
+ inode: "439540",
31
+ hard_links: 1,
32
+ owner: "pi",
33
+ group: "pi",
34
+ size: 3,
35
+ date: {
36
+ year: 2021,
37
+ month: 10,
38
+ day: 7,
39
+ hour: 15,
40
+ minute: 41,
41
+ second: 14,
42
+ nanosecond: 163590058,
43
+ utc_offset: -18000,
44
+ weekday: 4,
45
+ day_of_month: 7,
46
+ day_of_year: 280,
47
+ string: "2021-10-07 15:41:14 -0500",
48
+ epoch_integer: 1633639274,
49
+ epoch_float: 1633639274.1635902,
50
+ seconds_ago: 0.018665617
51
+ },
52
+ name: "file.csv",
53
+ type: "-",
54
+ owner_permission: "rw-",
55
+ group_permission: "r--",
56
+ other_permission: "r--",
57
+ directory: "/home/pi/Desktop/mushy",
58
+ path: "/home/pi/Desktop/mushy/file.csv"
59
+ }
60
+ }
61
+ },
62
+ }
16
63
  }
17
64
  end
18
65
 
@@ -7,6 +7,7 @@ module Mushy
7
7
  def self.details
8
8
  {
9
9
  name: 'WriteJson',
10
+ title: 'Serialize as JSON',
10
11
  description: 'Write the incoming event as JSON.',
11
12
  config: {
12
13
  key: {
@@ -15,6 +16,20 @@ module Mushy
15
16
  value: 'json',
16
17
  },
17
18
  },
19
+ examples: {
20
+ "Example" => {
21
+ description: 'Using this Flux to convert input to a JSON string.',
22
+ input: {
23
+ people: [ { name: "John" }, { name: "Jane" } ]
24
+ },
25
+ config: {
26
+ key: 'apple'
27
+ },
28
+ result: {
29
+ apple: "{\"people\":[{\"name\":\"John\"},{\"name\":\"Jane\"}]}"
30
+ }
31
+ },
32
+ }
18
33
  }
19
34
  end
20
35
 
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.15.1'
7
+ s.version = '0.18.0'
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.'
metadata CHANGED
@@ -1,11 +1,11 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mushy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.15.1
4
+ version: 0.18.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Darren Cauthon
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
  date: 2020-11-23 00:00:00.000000000 Z
@@ -177,6 +177,7 @@ files:
177
177
  - lib/mushy/builder/axios.rb
178
178
  - lib/mushy/builder/bulma.rb
179
179
  - lib/mushy/builder/dark.rb
180
+ - lib/mushy/builder/documentation.rb
180
181
  - lib/mushy/builder/index.rb
181
182
  - lib/mushy/builder/vue.rb
182
183
  - lib/mushy/date_parts.rb
@@ -200,7 +201,6 @@ files:
200
201
  - lib/mushy/fluxs/ls.rb
201
202
  - lib/mushy/fluxs/parse_html.rb
202
203
  - lib/mushy/fluxs/pdf.rb
203
- - lib/mushy/fluxs/print.rb
204
204
  - lib/mushy/fluxs/pwd.rb
205
205
  - lib/mushy/fluxs/read_csv.rb
206
206
  - lib/mushy/fluxs/read_file.rb
@@ -210,7 +210,9 @@ files:
210
210
  - lib/mushy/fluxs/sense_hat_led_matrix.rb
211
211
  - lib/mushy/fluxs/simple_python_program.rb
212
212
  - lib/mushy/fluxs/smtp.rb
213
+ - lib/mushy/fluxs/stdout.rb
213
214
  - lib/mushy/fluxs/times.rb
215
+ - lib/mushy/fluxs/twilio_message.rb
214
216
  - lib/mushy/fluxs/write_file.rb
215
217
  - lib/mushy/fluxs/write_json.rb
216
218
  - lib/mushy/masher.rb
@@ -224,7 +226,7 @@ homepage: https://cauthon.com
224
226
  licenses:
225
227
  - MIT
226
228
  metadata: {}
227
- post_install_message:
229
+ post_install_message:
228
230
  rdoc_options: []
229
231
  require_paths:
230
232
  - lib
@@ -239,9 +241,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
239
241
  - !ruby/object:Gem::Version
240
242
  version: '0'
241
243
  requirements: []
242
- rubyforge_project:
243
- rubygems_version: 2.7.6.2
244
- signing_key:
244
+ rubygems_version: 3.2.15
245
+ signing_key:
245
246
  specification_version: 4
246
247
  summary: Process streams of work using common modules.
247
248
  test_files: []
@@ -1,26 +0,0 @@
1
- module Mushy
2
-
3
- class Print < Flux
4
-
5
- def self.details
6
- {
7
- name: 'Print',
8
- description: 'Print output to the screen.',
9
- config: {
10
- message: {
11
- description: 'The message to display',
12
- type: 'text',
13
- value: '',
14
- },
15
- }
16
- }
17
- end
18
-
19
- def process event, config
20
- puts config[:message]
21
- {}
22
- end
23
-
24
- end
25
-
26
- end