washout_builder 0.16.3 → 0.16.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (68) hide show
  1. checksums.yaml +4 -4
  2. data/app/helpers/washout_builder_method_list_helper.rb +1 -1
  3. data/app/helpers/washout_builder_method_return_type_helper.rb +1 -1
  4. data/app/views/wash_with_html/_public_method.builder +1 -1
  5. data/example/test_app/.gitignore +17 -0
  6. data/example/test_app/Gemfile +53 -0
  7. data/example/test_app/README.rdoc +28 -0
  8. data/example/test_app/Rakefile +6 -0
  9. data/example/test_app/app/assets/images/.keep +0 -0
  10. data/example/test_app/app/assets/javascripts/application.js +16 -0
  11. data/example/test_app/app/assets/stylesheets/application.css +15 -0
  12. data/example/test_app/app/controllers/api/core.rb +20 -0
  13. data/example/test_app/app/controllers/api/project_service_controller.rb +28 -0
  14. data/example/test_app/app/controllers/api/rumbas_controller.rb +83 -0
  15. data/example/test_app/app/controllers/application_controller.rb +20 -0
  16. data/example/test_app/app/controllers/concerns/.keep +0 -0
  17. data/example/test_app/app/helpers/application_helper.rb +2 -0
  18. data/example/test_app/app/mailers/.keep +0 -0
  19. data/example/test_app/app/models/.keep +0 -0
  20. data/example/test_app/app/models/api/fluffy.rb +6 -0
  21. data/example/test_app/app/models/api/fluffy_container.rb +5 -0
  22. data/example/test_app/app/models/api/project_type.rb +14 -0
  23. data/example/test_app/app/models/api/test_namespace/test_type.rb +13 -0
  24. data/example/test_app/app/models/concerns/.keep +0 -0
  25. data/example/test_app/app/models/user.rb +2 -0
  26. data/example/test_app/app/views/layouts/application.html.erb +14 -0
  27. data/example/test_app/bin/bundle +3 -0
  28. data/example/test_app/bin/rails +8 -0
  29. data/example/test_app/bin/rake +8 -0
  30. data/example/test_app/bin/setup +29 -0
  31. data/example/test_app/bin/spring +15 -0
  32. data/example/test_app/config.ru +4 -0
  33. data/example/test_app/config/application.rb +39 -0
  34. data/example/test_app/config/boot.rb +3 -0
  35. data/example/test_app/config/database.yml +25 -0
  36. data/example/test_app/config/environment.rb +5 -0
  37. data/example/test_app/config/environments/development.rb +43 -0
  38. data/example/test_app/config/environments/production.rb +79 -0
  39. data/example/test_app/config/environments/test.rb +42 -0
  40. data/example/test_app/config/initializers/api_token.rb +2 -0
  41. data/example/test_app/config/initializers/assets.rb +11 -0
  42. data/example/test_app/config/initializers/backtrace_silencers.rb +7 -0
  43. data/example/test_app/config/initializers/cookies_serializer.rb +3 -0
  44. data/example/test_app/config/initializers/filter_parameter_logging.rb +4 -0
  45. data/example/test_app/config/initializers/inflections.rb +16 -0
  46. data/example/test_app/config/initializers/mime_types.rb +4 -0
  47. data/example/test_app/config/initializers/session_store.rb +6 -0
  48. data/example/test_app/config/initializers/wrap_parameters.rb +14 -0
  49. data/example/test_app/config/locales/en.yml +23 -0
  50. data/example/test_app/config/routes.rb +62 -0
  51. data/example/test_app/config/secrets.yml +22 -0
  52. data/example/test_app/db/migrate/20150826095420_create_users.rb +34 -0
  53. data/example/test_app/db/schema.rb +34 -0
  54. data/example/test_app/db/seeds.rb +7 -0
  55. data/example/test_app/lib/assets/.keep +0 -0
  56. data/example/test_app/lib/tasks/.keep +0 -0
  57. data/example/test_app/log/.keep +0 -0
  58. data/example/test_app/public/404.html +67 -0
  59. data/example/test_app/public/422.html +67 -0
  60. data/example/test_app/public/500.html +66 -0
  61. data/example/test_app/public/favicon.ico +0 -0
  62. data/example/test_app/public/robots.txt +5 -0
  63. data/example/test_app/vendor/assets/javascripts/.keep +0 -0
  64. data/example/test_app/vendor/assets/stylesheets/.keep +0 -0
  65. data/lib/washout_builder/document/complex_type.rb +1 -1
  66. data/lib/washout_builder/version.rb +1 -1
  67. data/washout_builder.gemspec +1 -1
  68. metadata +66 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c0ce939f0588bf2f8ce5fad5fe947c8aed31f422
4
- data.tar.gz: feb5fdb4da58fbc71ccdf8358f2130b4e9a32b5a
3
+ metadata.gz: 43e83e0edb7d4949ee51ce2e81ce046cd56c3fe0
4
+ data.tar.gz: 54b316fadb23c7f03eb7ea48d7ff92ea59cbf9fe
5
5
  SHA512:
6
- metadata.gz: bd67c1605a0f59ea7c482baacba7b604db080aef2b7b156a75c7b03aaf3d5927270134b6333ef6df7f861b256537dd1b3a8deb872689b4e1dae1a6bc0e2b34a3
7
- data.tar.gz: 949b598cb18381697314d41c48f244c88e1b5bf2c9cc09d8162846de0e556d55c71c4bf7f426f7cabbaab40213551c17a0ccb2ae57cda02c95817c97a394cbdb
6
+ metadata.gz: db3f828270ebe965afb3f4db0db59eda59dc27cba1f517c51edac8ef5542923d37fe01559c7d186793775ef0e3cd76f384af70c71969ca993cbe46efac3217e2
7
+ data.tar.gz: 000637b4606ec221796d1efd7f976cdabaa1c43ca8d4ced6a6e5561c47d9ee75523e59506f1b1c20424545e9ba07a6fc3867fdb16dfb0819e92f6221eb4e15b6
@@ -32,7 +32,7 @@ module WashoutBuilderMethodListHelper
32
32
  #
33
33
  # @api public
34
34
  def create_return_type_list_html(xml, output)
35
- if output.nil?
35
+ if output.nil? || output[0].blank?
36
36
  xml.span('class' => 'pre') { |sp| sp << 'void' }
37
37
  else
38
38
  complex_class = output[0].find_complex_class_name
@@ -13,7 +13,7 @@ module WashoutBuilderMethodReturnTypeHelper
13
13
  #
14
14
  # @api public
15
15
  def create_html_public_method_return_type(xml, pre, output)
16
- if !output.nil?
16
+ if !output.nil? && !output[0].blank?
17
17
  complex_class = output[0].find_complex_class_name
18
18
  if WashoutBuilder::Type::BASIC_TYPES.include?(output[0].type)
19
19
  xml.span('class' => 'blue') { |y| y << "#{output[0].type}" }
@@ -21,7 +21,7 @@ xml.p "#{description}" unless description.blank?
21
21
  xml.p "Return value:"
22
22
  xml.ul {
23
23
  xml.li {
24
-
24
+
25
25
  create_return_type_list_html(xml,output)
26
26
  }
27
27
  }
@@ -0,0 +1,17 @@
1
+ # See https://help.github.com/articles/ignoring-files for more about ignoring files.
2
+ #
3
+ # If you find yourself ignoring temporary files generated by your text editor
4
+ # or operating system, you probably want to add a global ignore instead:
5
+ # git config --global core.excludesfile '~/.gitignore_global'
6
+
7
+ # Ignore bundler config.
8
+ /.bundle
9
+
10
+ # Ignore the default SQLite database.
11
+ /db/*.sqlite3
12
+ /db/*.sqlite3-journal
13
+
14
+ # Ignore all logfiles and tempfiles.
15
+ /log/*
16
+ !/log/.keep
17
+ /tmp
@@ -0,0 +1,53 @@
1
+ source 'https://rubygems.org'
2
+
3
+
4
+ # Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
5
+ gem 'rails', '4.2.4'
6
+ # Use sqlite3 as the database for Active Record
7
+ gem 'sqlite3'
8
+ # Use SCSS for stylesheets
9
+ gem 'sass-rails', '~> 5.0'
10
+ # Use Uglifier as compressor for JavaScript assets
11
+ gem 'uglifier', '>= 1.3.0'
12
+ # Use CoffeeScript for .coffee assets and views
13
+ gem 'coffee-rails', '~> 4.1.0'
14
+ # See https://github.com/rails/execjs#readme for more supported runtimes
15
+ # gem 'therubyracer', platforms: :ruby
16
+
17
+ # Use jquery as the JavaScript library
18
+ gem 'jquery-rails'
19
+ # Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
20
+ gem 'turbolinks'
21
+
22
+
23
+ gem 'wash_out', git: 'git://github.com/inossidabile/wash_out.git'
24
+ # Gems used only for assets and not required in production environments by
25
+ # default.
26
+ gem 'washout_builder', :path => '../../../washout_builder'
27
+
28
+
29
+
30
+
31
+ # Use ActiveModel has_secure_password
32
+ # gem 'bcrypt', '~> 3.1.7'
33
+
34
+ # Use Unicorn as the app server
35
+ # gem 'unicorn'
36
+
37
+ # Use Capistrano for deployment
38
+ # gem 'capistrano-rails', group: :development
39
+
40
+ group :development, :test do
41
+ gem 'better_errors'
42
+ gem 'binding_of_caller'
43
+ #codesmell and speed tests
44
+ gem 'rack-mini-profiler'
45
+ gem 'rails-footnotes'
46
+ # Call 'byebug' anywhere in the code to stop execution and get a debugger console
47
+ gem 'byebug'
48
+ # Access an IRB console on exception pages or by using <%= console %> in views
49
+ gem 'web-console', '~> 2.0'
50
+
51
+ # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
52
+ gem 'spring'
53
+ end
@@ -0,0 +1,28 @@
1
+ == README
2
+
3
+ This README would normally document whatever steps are necessary to get the
4
+ application up and running.
5
+
6
+ Things you may want to cover:
7
+
8
+ * Ruby version
9
+
10
+ * System dependencies
11
+
12
+ * Configuration
13
+
14
+ * Database creation
15
+
16
+ * Database initialization
17
+
18
+ * How to run the test suite
19
+
20
+ * Services (job queues, cache servers, search engines, etc.)
21
+
22
+ * Deployment instructions
23
+
24
+ * ...
25
+
26
+
27
+ Please feel free to use a different markup language if you do not plan to run
28
+ <tt>rake doc:app</tt>.
@@ -0,0 +1,6 @@
1
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
2
+ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
+
4
+ require File.expand_path('../config/application', __FILE__)
5
+
6
+ Rails.application.load_tasks
File without changes
@@ -0,0 +1,16 @@
1
+ // This is a manifest file that'll be compiled into application.js, which will include all the files
2
+ // listed below.
3
+ //
4
+ // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
+ // or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
6
+ //
7
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
+ // compiled file.
9
+ //
10
+ // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
11
+ // about supported directives.
12
+ //
13
+ //= require jquery
14
+ //= require jquery_ujs
15
+ //= require turbolinks
16
+ //= require_tree .
@@ -0,0 +1,15 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
+ * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the bottom of the
9
+ * compiled file so the styles you add here take precedence over styles defined in any styles
10
+ * defined in the other CSS/SCSS files in this directory. It is generally better to create a new
11
+ * file per style scope.
12
+ *
13
+ *= require_tree .
14
+ *= require_self
15
+ */
@@ -0,0 +1,20 @@
1
+
2
+ class Api::Core < ApplicationController
3
+
4
+ before_filter :dump_parameters
5
+
6
+
7
+ def require_api_authorization
8
+ unless Rails.env.development?
9
+ if request.parameters['Envelope'].present? && request.parameters['Envelope']['Header'].present? && request.parameters['Envelope']['Header']['authToken'].present? && request.parameters['Envelope']['Header']['authToken']== TestApp::Application.config.api__auth_token
10
+ return true
11
+ else
12
+ head :forbidden
13
+ end
14
+ end
15
+ end
16
+
17
+ def dump_parameters
18
+ Rails.logger.debug params.inspect if Rails.env.development?
19
+ end
20
+ end
@@ -0,0 +1,28 @@
1
+ class Api::ProjectServiceController < Api::Core
2
+ before_filter :require_api_authorization
3
+
4
+ soap_service namespace: "#{Rails.configuration.api_namespace}project_service/wsdl"
5
+
6
+ # Simple case
7
+ soap_action "create_or_update", :args => Api::ProjectType , :return => :boolean, :to => :create_or_update
8
+
9
+
10
+ def create_or_update
11
+ render :soap => true
12
+ end
13
+
14
+ soap_action "delete_member", :args => {:mail => :string, 'redmine_projectid' => :integer, "project_type"=> Api::TestNamespace::TestType } , :return => :boolean, :to => :set_inactive_project_assignment
15
+
16
+ def set_inactive_project_assignment
17
+ render :soap => true
18
+ end
19
+
20
+
21
+
22
+ soap_action "add_members", :args => {:members => [{:mail => :string }] , 'redmine_projectid' => :integer, 'project_type' => :string} , :return => :boolean, :to => :create_or_set_active_project_assignment
23
+
24
+ def create_or_set_active_project_assignment
25
+ render :soap => true
26
+ end
27
+
28
+ end
@@ -0,0 +1,83 @@
1
+ class Api::RumbasController < Api::Core
2
+ soap_service namespace: 'urn:WashOut'
3
+
4
+ # Simple case
5
+ soap_action "integer_to_string",
6
+ :args => :integer,
7
+ :return => :string
8
+ def integer_to_string
9
+ render :soap => params[:value].to_s
10
+ end
11
+
12
+ soap_action "concat",
13
+ :args => { :a => :string, :b => :string },
14
+ :return => :string
15
+ def concat
16
+ render :soap => (params[:a] + params[:b])
17
+ end
18
+
19
+ # Complex structures
20
+ soap_action "AddCircle",
21
+ :args => { :circle => { :center => { :x => :integer,
22
+ :y => :integer },
23
+ :radius => :double } },
24
+ :return => nil, # [] for wash_out below 0.3.0
25
+ :to => :add_circle
26
+ def add_circle
27
+ circle = params[:circle]
28
+
29
+ raise SOAPError, "radius is too small" if circle[:radius] < 3.0
30
+
31
+ Circle.new(circle[:center][:x], circle[:center][:y], circle[:radius])
32
+
33
+ render :soap => nil
34
+ end
35
+
36
+ # Arrays
37
+ soap_action "integers_to_boolean",
38
+ :args => { :data => [:integer] },
39
+ :return => [:boolean]
40
+ def integers_to_boolean
41
+ render :soap => params[:data].map{|x| x ? 1 : 0}
42
+ end
43
+
44
+ # Params from XML attributes;
45
+ # e.g. for a request to the 'AddCircle' action:
46
+ # <soapenv:Envelope>
47
+ # <soapenv:Body>
48
+ # <AddCircle>
49
+ # <Circle radius="5.0">
50
+ # <Center x="10" y="12" />
51
+ # </Circle>
52
+ # </AddCircle>
53
+ # </soapenv:Body>
54
+ # </soapenv:Envelope>
55
+ soap_action "AddCircle",
56
+ :args => { :circle => { :center => { :@x => :integer,
57
+ :@y => :integer },
58
+ :@radius => :double } },
59
+ :return => nil, # [] for wash_out below 0.3.0
60
+ :to => :add_circle
61
+ def add_circle
62
+ circle = params[:circle]
63
+ Circle.new(circle[:center][:x], circle[:center][:y], circle[:radius])
64
+
65
+ render :soap => nil
66
+ end
67
+
68
+ # With a customised input tag name, in case params are wrapped;
69
+ # e.g. for a request to the 'IntegersToBoolean' action:
70
+ # <soapenv:Envelope>
71
+ # <soapenv:Body>
72
+ # <MyRequest> <!-- not <IntegersToBoolean> -->
73
+ # <Data>...</Data>
74
+ # </MyRequest>
75
+ # </soapenv:Body>
76
+ # </soapenv:Envelope>
77
+ soap_action "integers_to_boolean",
78
+ :args => { :my_request => { :data => [:integer] } },
79
+ :as => 'MyRequest',
80
+ :return => [:boolean]
81
+
82
+
83
+ end
@@ -0,0 +1,20 @@
1
+ class ApplicationController < ActionController::Base
2
+ # Prevent CSRF attacks by raising an exception.
3
+ # For APIs, you may want to use :null_session instead.
4
+ protect_from_forgery with: :exception
5
+
6
+
7
+
8
+ def test_soap
9
+ require 'savon'
10
+
11
+ client = Savon::Client.new(wsdl: "http://localhost:3000/api/rumbas/wsdl")
12
+
13
+ client.operations # => [:integer_to_string, :concat, :add_circle]
14
+
15
+ result = client.call(:concat, message: { :a => "123", :b => "abc" })
16
+
17
+
18
+ render :json => result.to_hash # => {:value=>"123abc"}
19
+ end
20
+ end
File without changes
@@ -0,0 +1,2 @@
1
+ module ApplicationHelper
2
+ end
File without changes
File without changes
@@ -0,0 +1,6 @@
1
+ class Api::Fluffy < WashOut::Type
2
+ map universe: {
3
+ name: :string,
4
+ age: :int
5
+ }
6
+ end
@@ -0,0 +1,5 @@
1
+ require_relative './fluffy'
2
+ class Api::FluffyContainer < WashOut::Type
3
+ type_name 'fluffy_con'
4
+ map fluffy: Fluffy
5
+ end
@@ -0,0 +1,14 @@
1
+ class Api::ProjectType < WashOut::Type
2
+ map :project => {
3
+ :name => :string,
4
+ :description => :string,
5
+ 'project_tag_list' => :string,
6
+ 'project_code' => :string,
7
+ 'redmine_project_id' => :integer,
8
+ 'pm_mail' => :string,
9
+ :users_info => [{:mail_info => :string }],
10
+ 'redmine_project_type' => :string,
11
+ 'redmine_project_parent_id' => :integer,
12
+ 'customer_department' => :string
13
+ }
14
+ end
@@ -0,0 +1,13 @@
1
+ module Api
2
+ module TestNamespace
3
+ class TestType < WashOut::Type
4
+ map project: {
5
+ name: :string,
6
+ description: :string,
7
+ users: [{ mail: :string }],
8
+ 'dada' => [User],
9
+ # 'data2' => [Api::ProjectType]
10
+ }
11
+ end
12
+ end
13
+ end
File without changes
@@ -0,0 +1,2 @@
1
+ class User < ActiveRecord::Base
2
+ end
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>TestApp</title>
5
+ <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
6
+ <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
7
+ <%= csrf_meta_tags %>
8
+ </head>
9
+ <body>
10
+
11
+ <%= yield %>
12
+
13
+ </body>
14
+ </html>
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
3
+ load Gem.bin_path('bundler', 'bundle')
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env ruby
2
+ begin
3
+ load File.expand_path("../spring", __FILE__)
4
+ rescue LoadError
5
+ end
6
+ APP_PATH = File.expand_path('../../config/application', __FILE__)
7
+ require_relative '../config/boot'
8
+ require 'rails/commands'