mobile_workflow 0.6.0 → 0.6.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 74a57b5231432fa5532bc2757c6785604c833bf0b637770c15ea34faa41b3b13
4
- data.tar.gz: 33a6f90850d5e6fb2522d76012336899b585ab1b8fd7db6dc768018c12eeca2b
3
+ metadata.gz: 23fe9da5a3fc84895ba68546c528efa7b9a0c4336c602961f1ac46b0a1daf90e
4
+ data.tar.gz: c290619f601148eb38e1ed67a0b82ead1fc0712210bfc1a78d4b5a31fde3711c
5
5
  SHA512:
6
- metadata.gz: 54c3c9504079480aaba63c9974a17eb2c428254503568230ca058ad52a71119a0a6d469d30142cd7a41843b8757e4d24fcf94fccffeefe8fe06b5ab14e88b6a5
7
- data.tar.gz: 62a5f5d474522fa2ade3fdccfb5a7f84b66f02d0c612a998cb235baee27e09cb33f0c12fc82019a010cfabd666fd614c5b98710d3a149914ac889048746cd2fe
6
+ metadata.gz: 2f470dfa2a726443953124e0302832da5f7e15fbaa82c92c1fa5d38d890684c24344154c76192ac0b4bfc69fd08c41ba51196c28e5182da0ae177de3a78edc10
7
+ data.tar.gz: 823f7de470e1671cfcb4347548407b8dde2ce6c2805a74e2cca98581fcdb4c9e606fef0c0f4e175b700b8cf7a720bc2af416221944778c2ccf8d6f9677bb81d3
@@ -9,6 +9,7 @@ module MobileWorkflow
9
9
  class_option :attributes, type: :array, default: [], banner: "field:type field:type"
10
10
  class_option :actions, type: :array, default: [], banner: "index create update destroy"
11
11
  class_option :doorkeeper_oauth, type: :boolean, default: false
12
+ class_option :s3_storage, type: :boolean, default: false
12
13
 
13
14
  def copy_controller_and_spec_files
14
15
  template "controller.rb.erb", File.join("app/controllers", controller_class_path, "#{controller_file_name}_controller.rb")
@@ -20,6 +21,10 @@ module MobileWorkflow
20
21
  options[:doorkeeper_oauth]
21
22
  end
22
23
 
24
+ def s3_storage?
25
+ options[:s3_storage]
26
+ end
27
+
23
28
  def attributes_names
24
29
  options[:attributes].map{ |attribute| attribute.split(":").first }
25
30
  end
@@ -9,6 +9,7 @@ module MobileWorkflow
9
9
 
10
10
  class_option :open_api_spec_path, type: :string, default: "config/open_api_spec.json"
11
11
  class_option :doorkeeper_oauth, type: :boolean, default: false
12
+ class_option :s3_storage, type: :boolean, default: false
12
13
  class_option :interactive, type: :boolean, default: false
13
14
 
14
15
  def create_api_controller
@@ -65,7 +66,7 @@ module MobileWorkflow
65
66
  generate_model(controller_name, model_properties)
66
67
  end
67
68
 
68
- generate "mobile_workflow:controller #{controller_name} --attributes #{model_properties}"
69
+ generate "mobile_workflow:controller #{controller_name} --attributes #{model_properties} #{s3_storage? ? '--s3-storage' : ''}".strip
69
70
  route "resources :#{plural_controller_name}, only: [:index, :show, :create]"
70
71
  end
71
72
  end
@@ -88,6 +89,10 @@ module MobileWorkflow
88
89
  @open_api_spec ||= ::MobileWorkflow::OpenApiSpec::Parser.new(File.read(open_api_spec_path))
89
90
  end
90
91
 
92
+ def s3_storage?
93
+ options[:s3_storage]
94
+ end
95
+
91
96
  def open_api_spec_path
92
97
  options[:open_api_spec_path]
93
98
  end
@@ -1,6 +1,6 @@
1
1
  <% module_namespacing do -%>
2
2
  class <%= controller_class_name %>Controller < ApiController
3
- # include MobileWorkflow::S3Storable
3
+ <%= s3_storage? ? "include MobileWorkflow::S3Storable" : "" %>
4
4
  before_action :rewrite_payload, only: :create
5
5
 
6
6
  load_and_authorize_resource
@@ -15,7 +15,11 @@ class <%= controller_class_name %>Controller < ApiController
15
15
 
16
16
  def create
17
17
  if @<%= singular_table_name %>.save
18
+ <% if s3_storage? -%>
18
19
  render json: { binary_urls: binary_urls(@<%= singular_table_name %>), response: @<%= singular_table_name %> }, status: :created
20
+ <% else -%>
21
+ render json: { response: @<%= singular_table_name %> }, status: :created
22
+ <% end %>
19
23
  else
20
24
  head :unprocessable_entity
21
25
  end
@@ -1,5 +1,5 @@
1
1
  module MobileWorkflow
2
- VERSION = '0.6.0'
2
+ VERSION = '0.6.1'
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.0
4
+ version: 0.6.1
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-01-24 00:00:00.000000000 Z
11
+ date: 2021-01-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails