mobile_workflow 0.6.13 → 0.6.18
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 +4 -4
- data/app/models/concerns/mobile_workflow/displayable.rb +16 -5
- data/lib/generators/mobile_workflow/install/templates/app/models/application_record.rb +5 -0
- data/lib/generators/mobile_workflow/install/templates/lib/tasks/mobile_workflow_s3.rake +9 -0
- data/lib/generators/mobile_workflow/templates/model.rb.erb +0 -2
- data/lib/mobile_workflow/open_api_spec/parser.rb +3 -6
- data/lib/mobile_workflow/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 69f4d60c4068a0db15965d051763cb213bc13e38356ee3f21c35eed0d2838040
|
4
|
+
data.tar.gz: 02cbe2239db1f6239cf5f4271aade224bd1ce69eabf27f9fffd65bf0faa41102
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4f07e17e68915f0f1e1c598ff540850763f3c6871283da49e306002c8a02381ab35cf622747e82e48b5f71ed0151cbbf03816b92cc84540275c83ae3b85d4911
|
7
|
+
data.tar.gz: e64d1632de882fcbde5d8f2ff6b94729d251453892001d39a0de9a7f1d9a96c7c169bcb36a8939b4f39002e5d5fd8f629c5ab3bf6af535ea50228984173ad2c2
|
@@ -5,6 +5,7 @@ module MobileWorkflow
|
|
5
5
|
|
6
6
|
ON_SUCCESS_OPTIONS = [:none, :reload, :backward, :forward]
|
7
7
|
BUTTON_STYLES = [:primary, :outline, :danger]
|
8
|
+
CONTENT_MODE_OPTIONS = [:scale_aspect_fill, :scale_aspect_fit]
|
8
9
|
|
9
10
|
def mw_list_item(id: self.id, text:, detail_text: nil, sf_symbol_name: nil, image_attachment: nil)
|
10
11
|
mw_list_item = {id: id, text: text, detailText: detail_text, sfSymbolName: sf_symbol_name}
|
@@ -15,13 +16,19 @@ module MobileWorkflow
|
|
15
16
|
def mw_map_item(id: self.id, text:, detail_text: nil, latitude:, longitude:)
|
16
17
|
{id: id, text: text, detailText: detail_text, latitude: latitude, longitude: longitude}.compact
|
17
18
|
end
|
19
|
+
|
20
|
+
def mw_pie_chart_item(id: self.id, label:, value:)
|
21
|
+
{id: id, label: label, value: value}.compact
|
22
|
+
end
|
18
23
|
|
19
24
|
def mw_display_text(text:, label: nil)
|
20
25
|
{type: :text, label: label, text: text.to_s}.compact
|
21
26
|
end
|
22
27
|
|
23
|
-
def mw_display_image(attachment, options: { resize_to_fill: [600, 1200] })
|
24
|
-
|
28
|
+
def mw_display_image(attachment, content_mode: :scale_aspect_fill, options: { resize_to_fill: [600, 1200] })
|
29
|
+
validate_content_mode!(content_mode)
|
30
|
+
|
31
|
+
{type: :image, contentMode: content_mode.to_s.camelize(:lower), previewURL: preview_url(attachment, options: options), url: attachment_url(attachment)}
|
25
32
|
end
|
26
33
|
|
27
34
|
def mw_display_unsplash_image(image_url)
|
@@ -58,11 +65,11 @@ module MobileWorkflow
|
|
58
65
|
{type: :button, label: label, url: url, method: method, style: style, onSuccess: on_success}
|
59
66
|
end
|
60
67
|
|
61
|
-
def mw_display_button_for_system_url(label:, apple_system_url
|
62
|
-
validate_on_success!(on_success)
|
68
|
+
def mw_display_button_for_system_url(label:, apple_system_url: nil, android_deep_link: nil, style: :primary)
|
63
69
|
validate_button_style!(style)
|
70
|
+
raise 'Invalid android_deep_link' unless android_deep_link.start_with?('http')
|
64
71
|
|
65
|
-
{type: :button, label: label, appleSystemURL: apple_system_url,
|
72
|
+
{type: :button, label: label, appleSystemURL: apple_system_url, androidDeepLink: android_deep_link, style: style}.compact
|
66
73
|
end
|
67
74
|
|
68
75
|
def mw_display_button_for_modal_workflow(label:, modal_workflow_name:, style: :primary, on_success: :none)
|
@@ -77,6 +84,10 @@ module MobileWorkflow
|
|
77
84
|
raise 'Unknown on_success action' unless ON_SUCCESS_OPTIONS.include?(on_success)
|
78
85
|
end
|
79
86
|
|
87
|
+
def validate_content_mode!(on_success)
|
88
|
+
raise 'Unknown content_mode' unless CONTENT_MODE_OPTIONS.include?(on_success)
|
89
|
+
end
|
90
|
+
|
80
91
|
def validate_button_style!(style)
|
81
92
|
raise 'Unknown style' unless BUTTON_STYLES.include?(style)
|
82
93
|
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
desc "Add S3 storage to your environment"
|
2
|
+
task add_heroku_s3_storage: :environment do
|
3
|
+
require 'mobile_workflow/cli'
|
4
|
+
app_name = ENV['APP_NAME']
|
5
|
+
aws = MobileWorkflow::Cli::AwsBackend.new(app_name: app_name)
|
6
|
+
heroku = MobileWorkflow::Cli::HerokuBackend(app_name: app_name)
|
7
|
+
aws.create
|
8
|
+
aws.create_topic_subscription(heroku.notifications_endpoint)
|
9
|
+
end
|
@@ -1,7 +1,5 @@
|
|
1
1
|
<% module_namespacing do -%>
|
2
2
|
class <%= class_name %> < <%= parent_class_name.classify %>
|
3
|
-
include MobileWorkflow::Displayable
|
4
|
-
|
5
3
|
<% attributes.select(&:reference?).each do |attribute| -%>
|
6
4
|
belongs_to :<%= attribute.name %><%= ', polymorphic: true' if attribute.polymorphic? %>
|
7
5
|
<% end -%>
|
@@ -2,9 +2,6 @@ module MobileWorkflow
|
|
2
2
|
module OpenApiSpec
|
3
3
|
class Parser
|
4
4
|
|
5
|
-
# Schemas to avoid generating models for (static items from MW)
|
6
|
-
SKIP_SCHEMAS = ["attachment", "ListItem", "DisplayItem", "DisplayText", "DisplayButton", "DisplayImage", "DisplayVideo"]
|
7
|
-
|
8
5
|
def initialize(open_api_spec_string)
|
9
6
|
@open_api_spec_string = open_api_spec_string
|
10
7
|
end
|
@@ -12,7 +9,7 @@ module MobileWorkflow
|
|
12
9
|
def model_name_to_properties
|
13
10
|
@model_properties = {}
|
14
11
|
schemas.each_pair do |model_name, schema|
|
15
|
-
next if
|
12
|
+
next if model_name.start_with?("MW")
|
16
13
|
|
17
14
|
model_name = model_name.underscore
|
18
15
|
model_properties = schema_model_properties(model_name, schema)
|
@@ -61,9 +58,9 @@ module MobileWorkflow
|
|
61
58
|
|
62
59
|
def model_property_type(property)
|
63
60
|
return property["type"] unless property["type"].blank?
|
64
|
-
return 'attachment' if property['$ref'] == "#/components/schemas/
|
61
|
+
return 'attachment' if property['$ref'] == "#/components/schemas/MWAttachment"
|
65
62
|
|
66
|
-
raise
|
63
|
+
raise "Unknown property type: #{property}"
|
67
64
|
end
|
68
65
|
|
69
66
|
def read_openapi_spec
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mobile_workflow
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.18
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Brooke-Smith
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-03-
|
11
|
+
date: 2021-03-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -112,10 +112,12 @@ files:
|
|
112
112
|
- lib/generators/mobile_workflow/install/templates/ability.rb
|
113
113
|
- lib/generators/mobile_workflow/install/templates/api_controller.rb.erb
|
114
114
|
- lib/generators/mobile_workflow/install/templates/app/helpers/application_helper.rb
|
115
|
+
- lib/generators/mobile_workflow/install/templates/app/models/application_record.rb
|
115
116
|
- lib/generators/mobile_workflow/install/templates/app/views/layouts/application.html.erb
|
116
117
|
- lib/generators/mobile_workflow/install/templates/app/views/sessions/new.html.erb
|
117
118
|
- lib/generators/mobile_workflow/install/templates/create_users.rb
|
118
119
|
- lib/generators/mobile_workflow/install/templates/lib/tasks/mobile_workflow_doorkeeper.rake
|
120
|
+
- lib/generators/mobile_workflow/install/templates/lib/tasks/mobile_workflow_s3.rake
|
119
121
|
- lib/generators/mobile_workflow/install/templates/seeds.rb.erb
|
120
122
|
- lib/generators/mobile_workflow/install/templates/sessions_controller.rb.erb
|
121
123
|
- lib/generators/mobile_workflow/install/templates/spec/factories/users.rb
|