samplar 0.0.1

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.
Files changed (112) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/Rakefile +26 -0
  4. data/app/assets/javascripts/samplar/application.js +13 -0
  5. data/app/assets/stylesheets/samplar/application.css +15 -0
  6. data/app/assets/stylesheets/scaffold.css +56 -0
  7. data/app/controllers/samplar/application_controller.rb +28 -0
  8. data/app/controllers/samplar/class_methods_controller.rb +31 -0
  9. data/app/controllers/samplar/instance_methods_controller.rb +27 -0
  10. data/app/controllers/samplar/samplar_controller.rb +9 -0
  11. data/app/helpers/samplar/application_helper.rb +7 -0
  12. data/app/views/layouts/samplar/_footer.html.erb +2 -0
  13. data/app/views/layouts/samplar/application.html.erb +15 -0
  14. data/app/views/samplar/class_methods/result.html.slim +1 -0
  15. data/app/views/samplar/class_methods/show.html.slim +9 -0
  16. data/app/views/samplar/instance_methods/result.html.slim +1 -0
  17. data/app/views/samplar/instance_methods/show.html.slim +9 -0
  18. data/app/views/samplar/samplar/index.html.slim +11 -0
  19. data/config/routes.rb +7 -0
  20. data/lib/samplar.rb +4 -0
  21. data/lib/samplar/engine.rb +9 -0
  22. data/lib/samplar/version.rb +3 -0
  23. data/lib/tasks/samplar_tasks.rake +4 -0
  24. data/spec/controllers/class_methods_controller_spec.rb +28 -0
  25. data/spec/controllers/instance_methods_controller_spec.rb +20 -0
  26. data/spec/controllers/samplar_controller_spec.rb +8 -0
  27. data/spec/dummy/Gemfile +7 -0
  28. data/spec/dummy/Gemfile.lock +13 -0
  29. data/spec/dummy/README.rdoc +28 -0
  30. data/spec/dummy/Rakefile +6 -0
  31. data/spec/dummy/app/assets/javascripts/application.js +13 -0
  32. data/spec/dummy/app/assets/stylesheets/application.css +15 -0
  33. data/spec/dummy/app/controllers/application_controller.rb +5 -0
  34. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  35. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  36. data/spec/dummy/bin/bundle +3 -0
  37. data/spec/dummy/bin/rails +4 -0
  38. data/spec/dummy/bin/rake +4 -0
  39. data/spec/dummy/bin/setup +29 -0
  40. data/spec/dummy/config.ru +4 -0
  41. data/spec/dummy/config/application.rb +32 -0
  42. data/spec/dummy/config/boot.rb +5 -0
  43. data/spec/dummy/config/database.yml +25 -0
  44. data/spec/dummy/config/environment.rb +5 -0
  45. data/spec/dummy/config/environments/development.rb +41 -0
  46. data/spec/dummy/config/environments/production.rb +79 -0
  47. data/spec/dummy/config/environments/test.rb +42 -0
  48. data/spec/dummy/config/initializers/assets.rb +11 -0
  49. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  50. data/spec/dummy/config/initializers/cookies_serializer.rb +3 -0
  51. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  52. data/spec/dummy/config/initializers/inflections.rb +16 -0
  53. data/spec/dummy/config/initializers/mime_types.rb +4 -0
  54. data/spec/dummy/config/initializers/samplar.rb +46 -0
  55. data/spec/dummy/config/initializers/session_store.rb +3 -0
  56. data/spec/dummy/config/initializers/to_time_preserves_timezone.rb +10 -0
  57. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  58. data/spec/dummy/config/locales/en.yml +23 -0
  59. data/spec/dummy/config/routes.rb +3 -0
  60. data/spec/dummy/config/samplar.yml +35 -0
  61. data/spec/dummy/config/secrets.yml +22 -0
  62. data/spec/dummy/db/development.sqlite3 +0 -0
  63. data/spec/dummy/db/schema.rb +22 -0
  64. data/spec/dummy/db/test.sqlite3 +0 -0
  65. data/spec/dummy/log/development.log +3765 -0
  66. data/spec/dummy/log/test.log +1159 -0
  67. data/spec/dummy/public/404.html +67 -0
  68. data/spec/dummy/public/422.html +67 -0
  69. data/spec/dummy/public/500.html +66 -0
  70. data/spec/dummy/public/favicon.ico +0 -0
  71. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/-_/-_DjItsVZLJkvrIKlzansE0HrPpkp-eyo5p_IeqkQaw.cache +0 -0
  72. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/4G/4Gp1O-UAmZvJmwbe_GfKxCjfCEq2an-d7nCIigOZa2Q.cache +0 -0
  73. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/5L/5Lly_CA8DZvPhQV2jDQx-Y6P_y3Ygra9t5jfSlGhHDA.cache +2 -0
  74. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/6f/6fbOrYZliRwSFm_4f5V0fKJjeerO9HgZcNZ77nok4_8.cache +1 -0
  75. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/6s/6sPUYb75YfmTy78kFMinESU7R9F-j7CKPwUB8unTAAE.cache +1 -0
  76. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/7u/7uQqOpwW2ddXsqQwD1-GZn1lKfca7dA-WkXUg2ELs4E.cache +0 -0
  77. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Be/Be2Bv2r0R8s14OjOlLl4hA1MfCnbETZwYCefBB7xOFI.cache +2 -0
  78. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Bw/BwyYyxSaRT2iww_66xPytHSZL_QQc_tY7w9uLnwgxvE.cache +2 -0
  79. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/CX/CXSOcPAqFDxwH5KDFtMC8Ud963a54zliaKlASkeutyY.cache +1 -0
  80. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/G0/G0sbX3dE2WM9SoTtteU8yB-ZrVOckI5YWA5kzcxdt3s.cache +1 -0
  81. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/JL/JLVV3OV-cFGoXKEJ_hvfpJuviVtBFLXylUPWGOJAf9I.cache +1 -0
  82. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Ks/Ks9CF3uNhRdfCyRg6dXI8pI1_UUXygeWOH6KxbdPo6U.cache +2 -0
  83. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/L8/L8tQar7ssERqMqwbjQ2fBOxdiB3mzFVVESqq4w52dVU.cache +0 -0
  84. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/NU/NUV6zYyYX_xGhtdPRIEHVRAu2S48pTxL7P5NMCg7EGM.cache +1 -0
  85. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/NU/NUo8_-zRWFo5gyCbuPNAV7xB7y7bE34vpHXxux4kEo4.cache +1 -0
  86. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/OI/OI6uxGcnsKavdWTtwDAasU3wPx8QXhzBgV0X2n1KjMQ.cache +2 -0
  87. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Q4/Q4QV1k7S7L-a1vmkj5gjcM3AvHkILDAagpVmlaEi3L4.cache +0 -0
  88. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/QH/QH4H7eJ1GtJditZ50ZxtblpuS8TGyhhDlcr3rAkDFO8.cache +1 -0
  89. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/QZ/QZEOprKoBvAPOs76wWA9G6BS2Ui7yz9oWlbJlmrGYpE.cache +1 -0
  90. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Rj/Rjg1i3lflFcvMvPZMSx0Q_hiZO6rw796nHjBkgWEPno.cache +0 -0
  91. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/U0/U02lH93GousBIJkiObU5yZngCc10boAR9liRozpZ4Nw.cache +2 -0
  92. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/WP/WPzIVLee3OX0Mm_Kd6bx1HOXcsGDxSVWJBY1CNZtXtM.cache +1 -0
  93. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/YB/YBMYKUA4RusABL6COUTiApSimXCmLHWOiv4huo0GajY.cache +0 -0
  94. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Yw/YwTJP2MFtP0WS9A8kBoXBMOaALQJwf6ZJ0CDsftLV00.cache +1 -0
  95. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/_5/_54q1LK3I3hDWxVOs9Fp4a65erKWplXglcOpSBLYB-I.cache +1 -0
  96. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/eY/eYt3hXIIll6b5pjPKLUfDlQIu1VRgaCfzUdci73UcRM.cache +0 -0
  97. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/fU/fUfUuFVVhmVyHoBTnHaYysET4vSGMreCUALh5zK7y4g.cache +1 -0
  98. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/hZ/hZi1k6tpxxCGYxRe7zY74ItcOI8gZrREOpGuA8JSpGg.cache +2 -0
  99. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/kN/kN02BTlVOHEAm9QNRjxSr7pH91sXLRYTowwC6eNeglk.cache +0 -0
  100. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/l3/l3rogHzVpVAlvQBynhhqLvWSn6BZN6qDS6ivjKXol5w.cache +1 -0
  101. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/pE/pEhaat2KBd5SrT7szC_8R1_6hK17FTpvoRFkmCRSD3M.cache +2 -0
  102. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/tf/tfNDoLzXSWIkDQhNm0hyb89rVYveBuPwnHjGVaBTenw.cache +2 -0
  103. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/uv/uvPkjTgjf7jxpjLd8fQjwnRTtlnFbN_YOjU-6pPU45E.cache +0 -0
  104. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/ux/uxsgryLhRIm5Ei6_BkmilblVtqjEeDUGVGeiI3Leot8.cache +1 -0
  105. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/v0/v0vCEObeuspVV449h-XnW2xxouluWFfJVbLWbA_XIYQ.cache +0 -0
  106. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/x5/x59xlgcUZhF2R7sm0xR6ae-BibjaZvDiaQcWO7e-PhY.cache +1 -0
  107. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/xO/xOgkjzWpSNvG50F4Ff3qstjjLz2QU92rIobnVu0U4H4.cache +2 -0
  108. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/xz/xz3QrJn-9tuKUWaN1UGX3C0z1FMAzxZWlLn1Rzm2x18.cache +0 -0
  109. data/spec/dummy/tmp/pids/server.pid +1 -0
  110. data/spec/rails_helper.rb +15 -0
  111. data/spec/spec_helper.rb +17 -0
  112. metadata +298 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 78bf81dbc4ce925365675645c5050b708db6c05dc8da34e4a1d4a525dfae54dd
4
+ data.tar.gz: e3c362fc4b04f8e5c726a6e70dd8b86508d58ce8e41e78f573c393ba1c0eb3db
5
+ SHA512:
6
+ metadata.gz: a16db6064fb48acdabea208d3df33775f88c456038b2f84f20d1cb6a579b844fc76d348ac457597e45eea3d69c345d1a940464cbe43f9f8a5753e1b6995acb2f
7
+ data.tar.gz: 7673d81cb05f8856d7895f54e68fceaf4383bbe61f61ed48c2fed0cb72c474b3c612ac585ef2cddfa65b0c67f2df4276d12236824c7f2cc523dac6d3c40be98b
@@ -0,0 +1,20 @@
1
+ Copyright 2019 Nakamura Kosuke
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,26 @@
1
+ begin
2
+ require 'bundler/setup'
3
+ rescue LoadError
4
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5
+ end
6
+
7
+ require 'rdoc/task'
8
+
9
+ RDoc::Task.new(:rdoc) do |rdoc|
10
+ rdoc.rdoc_dir = 'rdoc'
11
+ rdoc.title = 'Samplar'
12
+ rdoc.options << '--line-numbers'
13
+ rdoc.rdoc_files.include('README.rdoc')
14
+ rdoc.rdoc_files.include('lib/**/*.rb')
15
+ end
16
+
17
+ APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)
18
+ load 'rails/tasks/engine.rake'
19
+
20
+
21
+ load 'rails/tasks/statistics.rake'
22
+
23
+
24
+
25
+ Bundler::GemHelper.install_tasks
26
+
@@ -0,0 +1,13 @@
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_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,56 @@
1
+ body { background-color: #fff; color: #333; }
2
+
3
+ body, p, ol, ul, td {
4
+ font-family: verdana, arial, helvetica, sans-serif;
5
+ font-size: 13px;
6
+ line-height: 18px;
7
+ }
8
+
9
+ pre {
10
+ background-color: #eee;
11
+ padding: 10px;
12
+ font-size: 11px;
13
+ }
14
+
15
+ a { color: #000; }
16
+ a:visited { color: #666; }
17
+ a:hover { color: #fff; background-color:#000; }
18
+
19
+ div.field, div.actions {
20
+ margin-bottom: 10px;
21
+ }
22
+
23
+ #notice {
24
+ color: green;
25
+ }
26
+
27
+ .field_with_errors {
28
+ padding: 2px;
29
+ background-color: red;
30
+ display: table;
31
+ }
32
+
33
+ #error_explanation {
34
+ width: 450px;
35
+ border: 2px solid red;
36
+ padding: 7px;
37
+ padding-bottom: 0;
38
+ margin-bottom: 20px;
39
+ background-color: #f0f0f0;
40
+ }
41
+
42
+ #error_explanation h2 {
43
+ text-align: left;
44
+ font-weight: bold;
45
+ padding: 5px 5px 5px 15px;
46
+ font-size: 12px;
47
+ margin: -7px;
48
+ margin-bottom: 0px;
49
+ background-color: #c00;
50
+ color: #fff;
51
+ }
52
+
53
+ #error_explanation ul li {
54
+ font-size: 12px;
55
+ list-style: square;
56
+ }
@@ -0,0 +1,28 @@
1
+ module Samplar
2
+ class ApplicationController < ActionController::Base
3
+ protect_from_forgery with: :exception
4
+
5
+ private
6
+
7
+ def yaml
8
+ YAML.load_file("#{Rails.root}/config/samplar.yml")
9
+ end
10
+
11
+ def passing_args
12
+ yaml[params[:client]][params[:method].to_s]
13
+ end
14
+
15
+ def client_class
16
+ case
17
+ when params[:client].include?('-')
18
+ params[:client].split('-').map(&:classify).join('::').constantize
19
+ else
20
+ params[:client].classify.constantize
21
+ end
22
+ end
23
+
24
+ def array_params
25
+ passing_args.map{|arg| create_params[arg.to_sym]}
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,31 @@
1
+ require_dependency "samplar/application_controller"
2
+
3
+ module Samplar
4
+ class ClassMethodsController < ApplicationController
5
+ def show
6
+ @pass_args = passing_args
7
+ @client_name = params[:client]
8
+ @method_name = params[:method]
9
+ end
10
+
11
+ def create
12
+ if passing_args
13
+ @result = client_class.send(params[:method].to_sym, *array_params)
14
+ else
15
+ @result = client_class.send(params[:method].to_sym)
16
+ end
17
+
18
+ render :result
19
+ end
20
+
21
+ private
22
+
23
+ def passing_args
24
+ yaml[params[:client]]['self'][params[:method].to_s]
25
+ end
26
+
27
+ def create_params
28
+ params.require(:args)
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,27 @@
1
+ require_dependency "samplar/application_controller"
2
+
3
+ module Samplar
4
+ class InstanceMethodsController < ApplicationController
5
+ def show
6
+ @pass_args = passing_args
7
+ @client_name = params[:client]
8
+ @method_name = params[:method]
9
+ end
10
+
11
+ def create
12
+ if passing_args
13
+ @result = client_class.new.send(params[:method].to_sym, *array_params)
14
+ else
15
+ @result = client_class.new.send(params[:method].to_sym)
16
+ end
17
+
18
+ render :result
19
+ end
20
+
21
+ private
22
+
23
+ def create_params
24
+ params.require(:args)
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,9 @@
1
+ require_dependency "samplar/application_controller"
2
+
3
+ module Samplar
4
+ class SamplarController < ApplicationController
5
+ def index
6
+ @clients = yaml
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,7 @@
1
+ module Samplar
2
+ module ApplicationHelper
3
+ def classified_name(name)
4
+ name.split('-').map(&:classify).join('::')
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,2 @@
1
+ <br>
2
+ <%= link_to 'back to top', '/samplar' %>
@@ -0,0 +1,15 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Samplar</title>
5
+ <%= stylesheet_link_tag "samplar/application", media: "all" %>
6
+ <%= javascript_include_tag "samplar/application" %>
7
+ <%= csrf_meta_tags %>
8
+ </head>
9
+ <body>
10
+
11
+ <%= yield %>
12
+ <%= render 'layouts/samplar/footer' %>
13
+
14
+ </body>
15
+ </html>
@@ -0,0 +1,9 @@
1
+ h3 SamplarKlass
2
+ h3 #{classified_name(@client_name)}.#{@method_name}
3
+ = form_tag "/samplar/#{@client_name}/self/#{@method_name}" do
4
+ - if @pass_args
5
+ - @pass_args.each do |arg|
6
+ = label :args, arg
7
+ = text_field :args, arg
8
+ br
9
+ = submit_tag 'execute'
@@ -0,0 +1,9 @@
1
+ h3 Samplar
2
+ h3 #{classified_name(@client_name)}##{@method_name}
3
+ = form_tag "/samplar/#{@client_name}/#{@method_name}" do
4
+ - if @pass_args
5
+ - @pass_args.each do |arg|
6
+ = label :args, arg
7
+ = text_field :args, arg
8
+ br
9
+ = submit_tag 'execute'
@@ -0,0 +1,11 @@
1
+ - @clients.keys.each do |client|
2
+ h3 #{classified_name(client)}
3
+
4
+ - @clients[client].keys.each do |method|
5
+ - if method == 'self'
6
+ - @clients[client]['self'].keys.each do |class_method|
7
+ = link_to "#{classified_name(client)}.#{class_method}", "/samplar/#{client}/self/#{class_method}"
8
+ br
9
+ - else
10
+ = link_to "#{classified_name(client)}##{method}", "/samplar/#{client}/#{method}"
11
+ br
@@ -0,0 +1,7 @@
1
+ Samplar::Engine.routes.draw do
2
+ get '/', to: 'samplar#index'
3
+ get '/:client/:method', to: 'instance_methods#show'
4
+ post '/:client/:method', to: 'instance_methods#create'
5
+ get '/:client/self/:method', to: 'class_methods#show'
6
+ post '/:client/self/:method/', to: 'class_methods#create'
7
+ end
@@ -0,0 +1,4 @@
1
+ require "samplar/engine"
2
+
3
+ module Samplar
4
+ end
@@ -0,0 +1,9 @@
1
+ module Samplar
2
+ class Engine < ::Rails::Engine
3
+ isolate_namespace Samplar
4
+
5
+ config.generators do |g|
6
+ g.test_framework :rspec
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,3 @@
1
+ module Samplar
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :samplar do
3
+ # # Task goes here
4
+ # end
@@ -0,0 +1,28 @@
1
+ describe Samplar::ClassMethodsController, type: :controller do
2
+ routes { Samplar::Engine.routes }
3
+
4
+ describe "POST /samplar/:client/self/:method" do
5
+ context 'when call no args method' do
6
+ before { post :create, { client: 'client', method: 'foo' } }
7
+
8
+ it { expect(response).to have_http_status(200) }
9
+ it { expect(assigns(:result)).to eq Client.foo }
10
+ end
11
+
12
+ context 'when call 2 args method' do
13
+ before do
14
+ post :create, {
15
+ client: 'client',
16
+ method: 'bar',
17
+ args: {
18
+ arg1: 'hello',
19
+ arg2: 'world'
20
+ }
21
+ }
22
+ end
23
+
24
+ it { expect(response).to have_http_status(200) }
25
+ it { expect(assigns(:result)).to eq Client.bar('hello', 'world') }
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,20 @@
1
+ describe Samplar::InstanceMethodsController, type: :controller do
2
+ routes { Samplar::Engine.routes }
3
+
4
+ describe "GET /samplar/:client/:method" do
5
+ before do
6
+ get :show, { client: 'client', method: 'foo' }
7
+ end
8
+
9
+ it { expect(response).to have_http_status(200) }
10
+ end
11
+
12
+ describe "POST /samplar/:client/:method" do
13
+ before do
14
+ post :create, { client: 'client', method: 'foo' }
15
+ end
16
+
17
+ it { expect(response).to have_http_status(200) }
18
+ it { expect(assigns(:result)).to eq Client.new.foo }
19
+ end
20
+ end
@@ -0,0 +1,8 @@
1
+ describe Samplar::SamplarController, type: :controller do
2
+ routes { Samplar::Engine.routes }
3
+
4
+ describe "GET /samplar" do
5
+ before { get :index }
6
+ it { expect(response).to have_http_status(200) }
7
+ end
8
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
6
+
7
+ gem "sqlite3"
@@ -0,0 +1,13 @@
1
+ GEM
2
+ remote: https://rubygems.org/
3
+ specs:
4
+ sqlite3 (1.4.0)
5
+
6
+ PLATFORMS
7
+ ruby
8
+
9
+ DEPENDENCIES
10
+ sqlite3
11
+
12
+ BUNDLED WITH
13
+ 1.17.2
@@ -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>.