mobile_workflow 0.6.14 → 0.6.19

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: 799110824fce9c1897c4418e504215c23e19a29107dc3833d3b44ef633ffd695
4
- data.tar.gz: a8606dc9b5b382ffff495fb7eecd20b17b737f4c5234821318402222f677c419
3
+ metadata.gz: c7fe89a8c821aadb94b5652d399ff179273ccd0a335cb51625857d4955816e3c
4
+ data.tar.gz: e9b2776c45c386a21fa7c0e9629831bcda9430b7673dee9a809a186c9539954d
5
5
  SHA512:
6
- metadata.gz: 611d110892aa6a03b97c6aa7d0ce9ba3e7aaa810eaf05b313ca7db18b8260b76cadfb3ac64f9af972b8f12759eb10ce21cc65258b8047226155e2238da14cc3d
7
- data.tar.gz: fa196418587eae7166549b881cfea04b89b9539738c39c0f6c159e4de450c480d5a8d14c88530c0527ec4b135fd0c803622ae367a235299314d2826da084bddd
6
+ metadata.gz: f6765e6311ea22b67e4e545aed7521a5e36723f8d011816d0186f4556b7180359bc2fd4d7ed115314c92607062f7f24fe336dc52b4a2a6614b5c1757ca60ba38
7
+ data.tar.gz: 5a8f738acc4203116bc6f5ba6c5034e809c4e9f5a5988436ba068bebc85d90380e60a088482722c34ccb3dc645b1f6b92b6c5ecfb2b5214480aa3c57d4032abe
@@ -10,17 +10,27 @@ module MobileWorkflow
10
10
  when 'SubscriptionConfirmation'
11
11
  confirm_subscription ? (head :ok) : (head :bad_request)
12
12
  else
13
+ add_attachment
14
+ end
15
+ end
16
+
17
+ private
18
+ def add_attachment
19
+ begin
13
20
  @object = find_object
14
21
  @object.send("#{attribute_name}=",active_record_blob)
15
22
  if @object.save
16
23
  head :ok
17
24
  else
18
25
  Rails.logger.warn "Error saving object: #{@object} #{object.errors.full_messages}"
26
+ head :unprocessable_entity
19
27
  end
28
+ rescue NameError => e
29
+ Rails.logger.warn "Error attaching object: #{e.message}"
30
+ head :unprocessable_entity
20
31
  end
21
32
  end
22
-
23
- private
33
+
24
34
  def verify_request_authenticity
25
35
  head :unauthorized if raw_post.blank?
26
36
 
@@ -16,6 +16,10 @@ module MobileWorkflow
16
16
  def mw_map_item(id: self.id, text:, detail_text: nil, latitude:, longitude:)
17
17
  {id: id, text: text, detailText: detail_text, latitude: latitude, longitude: longitude}.compact
18
18
  end
19
+
20
+ def mw_pie_chart_item(id: self.id, label:, value:)
21
+ {id: id, label: label, value: value}.compact
22
+ end
19
23
 
20
24
  def mw_display_text(text:, label: nil)
21
25
  {type: :text, label: label, text: text.to_s}.compact
@@ -61,11 +65,11 @@ module MobileWorkflow
61
65
  {type: :button, label: label, url: url, method: method, style: style, onSuccess: on_success}
62
66
  end
63
67
 
64
- def mw_display_button_for_system_url(label:, apple_system_url:, method: :put, style: :primary, on_success: :none)
65
- validate_on_success!(on_success)
68
+ def mw_display_button_for_system_url(label:, apple_system_url: nil, android_deep_link: nil, style: :primary)
66
69
  validate_button_style!(style)
70
+ raise 'Invalid android_deep_link' unless android_deep_link.start_with?('http')
67
71
 
68
- {type: :button, label: label, appleSystemURL: apple_system_url, method: method, style: style, onSuccess: on_success}
72
+ {type: :button, label: label, appleSystemURL: apple_system_url, androidDeepLink: android_deep_link, style: style}.compact
69
73
  end
70
74
 
71
75
  def mw_display_button_for_modal_workflow(label:, modal_workflow_name:, style: :primary, on_success: :none)
@@ -0,0 +1,5 @@
1
+ class ApplicationRecord < ActiveRecord::Base
2
+ include MobileWorkflow::Displayable
3
+
4
+ self.abstract_class = true
5
+ 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 SKIP_SCHEMAS.include? model_name # Don't generate schemas for MW schemas
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/attachment"
61
+ return 'attachment' if property['$ref'] == "#/components/schemas/MWAttachment"
65
62
 
66
- raise 'Unknown property type'
63
+ raise "Unknown property type: #{property}"
67
64
  end
68
65
 
69
66
  def read_openapi_spec
@@ -1,5 +1,5 @@
1
1
  module MobileWorkflow
2
- VERSION = '0.6.14'
2
+ VERSION = '0.6.19'
3
3
  RUBY_VERSION = '2.7.2'
4
4
  RAILS_VERSION = '6.1.0'
5
5
  end
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.14
4
+ version: 0.6.19
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-03 00:00:00.000000000 Z
11
+ date: 2021-04-03 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