mobile_workflow 0.6.12 → 0.6.17

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: d81b93d982663b4a2f4a23451a3010c2bdc76abdb79e02bf210aa72489b06542
4
- data.tar.gz: 26a83f5aaeb30b261fde054b1af5977bc7a8049766f87ded7c6abf53fea4f8a2
3
+ metadata.gz: 31e280831f1a511a194d86dfa927db46e17bdfe4a1e65a29bd00cb5bbf5375da
4
+ data.tar.gz: f567c600beb891c8724ab74ec90b0881ee60d64721027be8cd36ad9cf14d578a
5
5
  SHA512:
6
- metadata.gz: e6dcddb47aa4cc55eeb777c695fd72a333ec5646774fa94cb1fe1ea882c7ee0d883ee7cf3e5a966eb9a1eb8827ec8fca1fa6ae1894fb282c108e83c67879e431
7
- data.tar.gz: 966dd8a57b803f7db1a105fd431bbd9217168b649b02f88fdb49b762dc725c6bc65cfeeb4a1c44a68b8c9516d37c9329a4a605f730cdef194093d7d192bf9e88
6
+ metadata.gz: 8453ccea1d993b80ec890756959dc37563c2b581faea17cf4defdd340c1a29e517c5cef4dab653dc76db79732aa016655e62db51d26c5d7a4f158f79faa2b3ce
7
+ data.tar.gz: 53fb66340e2950b05da034509186cfc7ac52683f753ed2d566afe4645310d636a6e5ea1e3620e6d1be214d5dc8dc21c66144f32b0af20b5dac6cbf33479bae0c
@@ -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
- {type: :image, previewURL: preview_url(attachment, options: options), url: attachment_url(attachment)}
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,6 +65,13 @@ module MobileWorkflow
58
65
  {type: :button, label: label, url: url, method: method, style: style, onSuccess: on_success}
59
66
  end
60
67
 
68
+ def mw_display_button_for_system_url(label:, apple_system_url:, method: :put, style: :primary, on_success: :none)
69
+ validate_on_success!(on_success)
70
+ validate_button_style!(style)
71
+
72
+ {type: :button, label: label, appleSystemURL: apple_system_url, method: method, style: style, onSuccess: on_success}
73
+ end
74
+
61
75
  def mw_display_button_for_modal_workflow(label:, modal_workflow_name:, style: :primary, on_success: :none)
62
76
  validate_on_success!(on_success)
63
77
  validate_button_style!(style)
@@ -70,6 +84,10 @@ module MobileWorkflow
70
84
  raise 'Unknown on_success action' unless ON_SUCCESS_OPTIONS.include?(on_success)
71
85
  end
72
86
 
87
+ def validate_content_mode!(on_success)
88
+ raise 'Unknown content_mode' unless CONTENT_MODE_OPTIONS.include?(on_success)
89
+ end
90
+
73
91
  def validate_button_style!(style)
74
92
  raise 'Unknown style' unless BUTTON_STYLES.include?(style)
75
93
  end
@@ -24,6 +24,10 @@ module MobileWorkflow
24
24
  route "mount MobileWorkflow::Engine => '/'"
25
25
  end
26
26
 
27
+ def copy_rake_tasks
28
+ copy_file("lib/tasks/mobile_workflow_doorkeeper.rake") if options[:doorkeeper_oauth]
29
+ end
30
+
27
31
  def generate_doorkeeper
28
32
  return unless options[:doorkeeper_oauth]
29
33
  say "Generating Doorkeeper OAuth"
@@ -0,0 +1,5 @@
1
+ desc "Log the first Doorkeeper App details"
2
+ task print_oauth_app: :environment do
3
+ puts Doorkeeper::Application.first.uid
4
+ puts Doorkeeper::Application.first.secret
5
+ end
@@ -1,6 +1,6 @@
1
1
  FactoryBot.define do
2
2
  factory :user do
3
- email { 'jo@example.com' }
3
+ sequence(:email) { |n| "person#{n}@example.com" }
4
4
  password { 'Password123' }
5
5
  end
6
6
  end
@@ -8,7 +8,7 @@ RSpec.describe <%= controller_class_name %>Controller do
8
8
  let(:json_response) { JSON.parse(response.body, symbolize_names: true) }
9
9
  <% if doorkeeper_oauth? -%>
10
10
  let(:user) { create(:user) }
11
- let(:token) { instance_double('Doorkeeper::AccessToken', :accessible? => true, :acceptable? => true, resource_owner_id: user.id) }
11
+ let(:token) { instance_double(Doorkeeper::AccessToken, accessible?: true, acceptable?: true, resource_owner_id: user.id) }
12
12
  <% end -%>
13
13
 
14
14
  <% if index_action? -%>
@@ -5,7 +5,7 @@ module MobileWorkflow::Cli
5
5
 
6
6
  attr_accessor :access_id, :secret_key, :region, :bucket_name
7
7
 
8
- def initialize(app_name:, region:)
8
+ def initialize(app_name:, region: 'us-east-1')
9
9
  @app_name = app_name
10
10
  @aws_name = @app_name.gsub("_", "-")
11
11
  @region = region
@@ -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.12'
2
+ VERSION = '0.6.17'
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.12
4
+ version: 0.6.17
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-02-17 00:00:00.000000000 Z
11
+ date: 2021-03-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -115,6 +115,7 @@ files:
115
115
  - lib/generators/mobile_workflow/install/templates/app/views/layouts/application.html.erb
116
116
  - lib/generators/mobile_workflow/install/templates/app/views/sessions/new.html.erb
117
117
  - lib/generators/mobile_workflow/install/templates/create_users.rb
118
+ - lib/generators/mobile_workflow/install/templates/lib/tasks/mobile_workflow_doorkeeper.rake
118
119
  - lib/generators/mobile_workflow/install/templates/seeds.rb.erb
119
120
  - lib/generators/mobile_workflow/install/templates/sessions_controller.rb.erb
120
121
  - lib/generators/mobile_workflow/install/templates/spec/factories/users.rb