zuora_connect 3.0.0.pre.g → 3.0.0.pre.n

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +1 -1
  3. data/app/models/zuora_connect/app_instance_base.rb +19 -6
  4. data/app/models/zuora_connect/telegraf.rb +73 -0
  5. data/config/initializers/postgresql_adapter.rb +1 -1
  6. data/config/initializers/prometheus.rb +0 -23
  7. data/config/initializers/resque.rb +0 -14
  8. data/config/initializers/unicorn.rb +1 -1
  9. data/lib/metrics/influx/point_value.rb +79 -0
  10. data/lib/metrics/net.rb +7 -7
  11. data/lib/middleware/metrics_middleware.rb +35 -1
  12. data/lib/resque/plugins/app_instance_job.rb +9 -5
  13. data/lib/zuora_connect.rb +1 -0
  14. data/lib/zuora_connect/controllers/helpers.rb +6 -2
  15. data/lib/zuora_connect/railtie.rb +3 -0
  16. data/lib/zuora_connect/version.rb +1 -1
  17. metadata +44 -96
  18. data/test/controllers/zuora_connect/api/v1/app_instance_controller_test.rb +0 -13
  19. data/test/dummy/README.rdoc +0 -28
  20. data/test/dummy/Rakefile +0 -6
  21. data/test/dummy/app/assets/javascripts/application.js +0 -13
  22. data/test/dummy/app/assets/stylesheets/application.css +0 -15
  23. data/test/dummy/app/controllers/application_controller.rb +0 -5
  24. data/test/dummy/app/helpers/application_helper.rb +0 -2
  25. data/test/dummy/app/views/layouts/application.html.erb +0 -14
  26. data/test/dummy/bin/bundle +0 -3
  27. data/test/dummy/bin/rails +0 -4
  28. data/test/dummy/bin/rake +0 -4
  29. data/test/dummy/bin/setup +0 -29
  30. data/test/dummy/config.ru +0 -4
  31. data/test/dummy/config/application.rb +0 -26
  32. data/test/dummy/config/boot.rb +0 -5
  33. data/test/dummy/config/database.yml +0 -25
  34. data/test/dummy/config/environment.rb +0 -5
  35. data/test/dummy/config/environments/development.rb +0 -41
  36. data/test/dummy/config/environments/production.rb +0 -79
  37. data/test/dummy/config/environments/test.rb +0 -42
  38. data/test/dummy/config/initializers/assets.rb +0 -11
  39. data/test/dummy/config/initializers/backtrace_silencers.rb +0 -7
  40. data/test/dummy/config/initializers/cookies_serializer.rb +0 -3
  41. data/test/dummy/config/initializers/filter_parameter_logging.rb +0 -4
  42. data/test/dummy/config/initializers/inflections.rb +0 -16
  43. data/test/dummy/config/initializers/mime_types.rb +0 -4
  44. data/test/dummy/config/initializers/session_store.rb +0 -3
  45. data/test/dummy/config/initializers/wrap_parameters.rb +0 -14
  46. data/test/dummy/config/locales/en.yml +0 -23
  47. data/test/dummy/config/routes.rb +0 -4
  48. data/test/dummy/config/secrets.yml +0 -22
  49. data/test/dummy/public/404.html +0 -67
  50. data/test/dummy/public/422.html +0 -67
  51. data/test/dummy/public/500.html +0 -66
  52. data/test/dummy/public/favicon.ico +0 -0
  53. data/test/fixtures/zuora_connect/app_instances.yml +0 -11
  54. data/test/integration/navigation_test.rb +0 -8
  55. data/test/lib/generators/zuora_connect/datatable_generator_test.rb +0 -16
  56. data/test/models/zuora_connect/app_instance_test.rb +0 -9
  57. data/test/test_helper.rb +0 -21
  58. data/test/zuora_connect_test.rb +0 -7
@@ -9,6 +9,7 @@ require 'resque/silence_done'
9
9
  require 'resque/self_lookup'
10
10
  require 'resque/plugins/custom_logger'
11
11
  require 'resque/plugins/app_instance_job'
12
+ require 'metrics/influx/point_value'
12
13
  require 'metrics/net'
13
14
  require 'mono_logger'
14
15
  require 'zuora_connect/zuora_audit'
@@ -280,6 +280,7 @@ module ZuoraConnect
280
280
  next_instance_id,
281
281
  zuora_entity_id,
282
282
  rest_domain,
283
+ tenant_id: request.headers['zuora-tenant-id'],
283
284
  retry_count: retry_count
284
285
  )
285
286
  rescue ActiveRecord::RecordNotUnique
@@ -302,7 +303,8 @@ module ZuoraConnect
302
303
  private
303
304
  def setup_instance_via_prod_mode
304
305
  zuora_entity_id = request.headers['ZuoraCurrentEntity'] || cookies['ZuoraCurrentEntity']
305
-
306
+ ZuoraConnect::ZuoraUser.current_user_id = nil
307
+
306
308
  if zuora_entity_id.present?
307
309
  zuora_tenant_id = cookies['Zuora-Tenant-Id']
308
310
  zuora_user_id = cookies['Zuora-User-Id']
@@ -636,7 +638,7 @@ module ZuoraConnect
636
638
  (ZuoraConnect::AppInstance.all.where("id > #{min_instance_id}").order(id: :desc).limit(1).pluck(:id).first || min_instance_id) + 1
637
639
  end
638
640
 
639
- def new_instance(id, zuora_entity_id, rest_domain, task_data: nil, retry_count: 0)
641
+ def new_instance(id, zuora_entity_id, rest_domain, tenant_id: nil, task_data: nil, retry_count: 0)
640
642
  app_instance = ZuoraConnect::AppInstance.new(
641
643
  :id => id,
642
644
  :api_token => generate_token,
@@ -646,6 +648,8 @@ module ZuoraConnect
646
648
  :zuora_entity_ids => [zuora_entity_id]
647
649
  )
648
650
 
651
+ app_instance[:zuora_tenant_ids] = [tenant_id.to_s] if tenant_id.present?
652
+
649
653
  if task_data.nil?
650
654
  # no encryption
651
655
  app_instance['zuora_logins'] = task_data
@@ -32,5 +32,8 @@ module ZuoraConnect
32
32
  app.config.middleware.use Rack::Deflater, if: ->(env, *) { env['PATH_INFO'] == '/connect/internal/metrics' }
33
33
  end
34
34
  end
35
+
36
+ # hook to process_action
37
+ ActiveSupport::Notifications.subscribe('process_action.action_controller', ZuoraConnect::PageRequest.new)
35
38
  end
36
39
  end
@@ -1,3 +1,3 @@
1
1
  module ZuoraConnect
2
- VERSION = "3.0.0-g"
2
+ VERSION = "3.0.0-n"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zuora_connect
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0.pre.g
4
+ version: 3.0.0.pre.n
5
5
  platform: ruby
6
6
  authors:
7
7
  - Connect Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-12-04 00:00:00.000000000 Z
11
+ date: 2021-01-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: apartment
@@ -56,40 +56,40 @@ dependencies:
56
56
  name: zuora_api
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ">="
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
61
  version: 1.7.00
62
- - - "~>"
62
+ - - ">="
63
63
  - !ruby/object:Gem::Version
64
64
  version: 1.7.00
65
65
  type: :runtime
66
66
  prerelease: false
67
67
  version_requirements: !ruby/object:Gem::Requirement
68
68
  requirements:
69
- - - ">="
69
+ - - "~>"
70
70
  - !ruby/object:Gem::Version
71
71
  version: 1.7.00
72
- - - "~>"
72
+ - - ">="
73
73
  - !ruby/object:Gem::Version
74
74
  version: 1.7.00
75
75
  - !ruby/object:Gem::Dependency
76
76
  name: httparty
77
77
  requirement: !ruby/object:Gem::Requirement
78
78
  requirements:
79
- - - ">="
79
+ - - "~>"
80
80
  - !ruby/object:Gem::Version
81
81
  version: 0.16.4
82
- - - "~>"
82
+ - - ">="
83
83
  - !ruby/object:Gem::Version
84
84
  version: 0.16.4
85
85
  type: :runtime
86
86
  prerelease: false
87
87
  version_requirements: !ruby/object:Gem::Requirement
88
88
  requirements:
89
- - - ">="
89
+ - - "~>"
90
90
  - !ruby/object:Gem::Version
91
91
  version: 0.16.4
92
- - - "~>"
92
+ - - ">="
93
93
  - !ruby/object:Gem::Version
94
94
  version: 0.16.4
95
95
  - !ruby/object:Gem::Dependency
@@ -210,6 +210,20 @@ dependencies:
210
210
  - - "~>"
211
211
  - !ruby/object:Gem::Version
212
212
  version: '3.0'
213
+ - !ruby/object:Gem::Dependency
214
+ name: rspec_junit_formatter
215
+ requirement: !ruby/object:Gem::Requirement
216
+ requirements:
217
+ - - ">="
218
+ - !ruby/object:Gem::Version
219
+ version: '0'
220
+ type: :development
221
+ prerelease: false
222
+ version_requirements: !ruby/object:Gem::Requirement
223
+ requirements:
224
+ - - ">="
225
+ - !ruby/object:Gem::Version
226
+ version: '0'
213
227
  - !ruby/object:Gem::Dependency
214
228
  name: rspec-rails
215
229
  requirement: !ruby/object:Gem::Requirement
@@ -239,7 +253,21 @@ dependencies:
239
253
  - !ruby/object:Gem::Version
240
254
  version: '0'
241
255
  - !ruby/object:Gem::Dependency
242
- name: factory_bot
256
+ name: simplecov
257
+ requirement: !ruby/object:Gem::Requirement
258
+ requirements:
259
+ - - ">="
260
+ - !ruby/object:Gem::Version
261
+ version: '0'
262
+ type: :development
263
+ prerelease: false
264
+ version_requirements: !ruby/object:Gem::Requirement
265
+ requirements:
266
+ - - ">="
267
+ - !ruby/object:Gem::Version
268
+ version: '0'
269
+ - !ruby/object:Gem::Dependency
270
+ name: simplecov-cobertura
243
271
  requirement: !ruby/object:Gem::Requirement
244
272
  requirements:
245
273
  - - ">="
@@ -253,7 +281,7 @@ dependencies:
253
281
  - !ruby/object:Gem::Version
254
282
  version: '0'
255
283
  - !ruby/object:Gem::Dependency
256
- name: derailed
284
+ name: factory_bot
257
285
  requirement: !ruby/object:Gem::Requirement
258
286
  requirements:
259
287
  - - ">="
@@ -332,6 +360,7 @@ files:
332
360
  - app/models/zuora_connect/app_instance.rb
333
361
  - app/models/zuora_connect/app_instance_base.rb
334
362
  - app/models/zuora_connect/login.rb
363
+ - app/models/zuora_connect/telegraf.rb
335
364
  - app/models/zuora_connect/zuora_user.rb
336
365
  - app/views/layouts/zuora_connect/application.html.erb
337
366
  - app/views/sql/refresh_aggregate_table.txt
@@ -366,6 +395,7 @@ files:
366
395
  - db/migrate/20190520232222_add_unique_index.rb
367
396
  - db/migrate/20190520232223_add_provisioning_fields.rb
368
397
  - db/migrate/20190520232224_add_environment_fields.rb
398
+ - lib/metrics/influx/point_value.rb
369
399
  - lib/metrics/net.rb
370
400
  - lib/middleware/bad_multipart_form_data_sanitizer.rb
371
401
  - lib/middleware/json_parse_errors.rb
@@ -386,47 +416,6 @@ files:
386
416
  - lib/zuora_connect/railtie.rb
387
417
  - lib/zuora_connect/version.rb
388
418
  - lib/zuora_connect/zuora_audit.rb
389
- - test/controllers/zuora_connect/api/v1/app_instance_controller_test.rb
390
- - test/dummy/README.rdoc
391
- - test/dummy/Rakefile
392
- - test/dummy/app/assets/javascripts/application.js
393
- - test/dummy/app/assets/stylesheets/application.css
394
- - test/dummy/app/controllers/application_controller.rb
395
- - test/dummy/app/helpers/application_helper.rb
396
- - test/dummy/app/views/layouts/application.html.erb
397
- - test/dummy/bin/bundle
398
- - test/dummy/bin/rails
399
- - test/dummy/bin/rake
400
- - test/dummy/bin/setup
401
- - test/dummy/config.ru
402
- - test/dummy/config/application.rb
403
- - test/dummy/config/boot.rb
404
- - test/dummy/config/database.yml
405
- - test/dummy/config/environment.rb
406
- - test/dummy/config/environments/development.rb
407
- - test/dummy/config/environments/production.rb
408
- - test/dummy/config/environments/test.rb
409
- - test/dummy/config/initializers/assets.rb
410
- - test/dummy/config/initializers/backtrace_silencers.rb
411
- - test/dummy/config/initializers/cookies_serializer.rb
412
- - test/dummy/config/initializers/filter_parameter_logging.rb
413
- - test/dummy/config/initializers/inflections.rb
414
- - test/dummy/config/initializers/mime_types.rb
415
- - test/dummy/config/initializers/session_store.rb
416
- - test/dummy/config/initializers/wrap_parameters.rb
417
- - test/dummy/config/locales/en.yml
418
- - test/dummy/config/routes.rb
419
- - test/dummy/config/secrets.yml
420
- - test/dummy/public/404.html
421
- - test/dummy/public/422.html
422
- - test/dummy/public/500.html
423
- - test/dummy/public/favicon.ico
424
- - test/fixtures/zuora_connect/app_instances.yml
425
- - test/integration/navigation_test.rb
426
- - test/lib/generators/zuora_connect/datatable_generator_test.rb
427
- - test/models/zuora_connect/app_instance_test.rb
428
- - test/test_helper.rb
429
- - test/zuora_connect_test.rb
430
419
  homepage:
431
420
  licenses: []
432
421
  metadata: {}
@@ -445,49 +434,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
445
434
  - !ruby/object:Gem::Version
446
435
  version: 1.3.1
447
436
  requirements: []
448
- rubygems_version: 3.0.3
437
+ rubygems_version: 3.1.4
449
438
  signing_key:
450
439
  specification_version: 4
451
440
  summary: Summary of Connect.
452
- test_files:
453
- - test/fixtures/zuora_connect/app_instances.yml
454
- - test/models/zuora_connect/app_instance_test.rb
455
- - test/integration/navigation_test.rb
456
- - test/controllers/zuora_connect/api/v1/app_instance_controller_test.rb
457
- - test/zuora_connect_test.rb
458
- - test/lib/generators/zuora_connect/datatable_generator_test.rb
459
- - test/dummy/public/500.html
460
- - test/dummy/public/404.html
461
- - test/dummy/public/favicon.ico
462
- - test/dummy/public/422.html
463
- - test/dummy/Rakefile
464
- - test/dummy/config.ru
465
- - test/dummy/config/secrets.yml
466
- - test/dummy/config/boot.rb
467
- - test/dummy/config/application.rb
468
- - test/dummy/config/initializers/session_store.rb
469
- - test/dummy/config/initializers/assets.rb
470
- - test/dummy/config/initializers/wrap_parameters.rb
471
- - test/dummy/config/initializers/filter_parameter_logging.rb
472
- - test/dummy/config/initializers/backtrace_silencers.rb
473
- - test/dummy/config/initializers/mime_types.rb
474
- - test/dummy/config/initializers/inflections.rb
475
- - test/dummy/config/initializers/cookies_serializer.rb
476
- - test/dummy/config/routes.rb
477
- - test/dummy/config/database.yml
478
- - test/dummy/config/environments/test.rb
479
- - test/dummy/config/environments/production.rb
480
- - test/dummy/config/environments/development.rb
481
- - test/dummy/config/environment.rb
482
- - test/dummy/config/locales/en.yml
483
- - test/dummy/README.rdoc
484
- - test/dummy/bin/rake
485
- - test/dummy/bin/setup
486
- - test/dummy/bin/rails
487
- - test/dummy/bin/bundle
488
- - test/dummy/app/views/layouts/application.html.erb
489
- - test/dummy/app/assets/javascripts/application.js
490
- - test/dummy/app/assets/stylesheets/application.css
491
- - test/dummy/app/helpers/application_helper.rb
492
- - test/dummy/app/controllers/application_controller.rb
493
- - test/test_helper.rb
441
+ test_files: []
@@ -1,13 +0,0 @@
1
- require 'test_helper'
2
-
3
- module ZuoraConnect
4
- class Api::V1::AppInstanceControllerTest < ActionController::TestCase
5
- setup do
6
- @routes = Engine.routes
7
- end
8
-
9
- # test "the truth" do
10
- # assert true
11
- # end
12
- end
13
- end
@@ -1,28 +0,0 @@
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>.
@@ -1,6 +0,0 @@
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
@@ -1,13 +0,0 @@
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 .
@@ -1,15 +0,0 @@
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
- */
@@ -1,5 +0,0 @@
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
- end
@@ -1,2 +0,0 @@
1
- module ApplicationHelper
2
- end
@@ -1,14 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>Dummy</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>
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env ruby
2
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
3
- load Gem.bin_path('bundler', 'bundle')
@@ -1,4 +0,0 @@
1
- #!/usr/bin/env ruby
2
- APP_PATH = File.expand_path('../../config/application', __FILE__)
3
- require_relative '../config/boot'
4
- require 'rails/commands'
@@ -1,4 +0,0 @@
1
- #!/usr/bin/env ruby
2
- require_relative '../config/boot'
3
- require 'rake'
4
- Rake.application.run
@@ -1,29 +0,0 @@
1
- #!/usr/bin/env ruby
2
- require 'pathname'
3
-
4
- # path to your application root.
5
- APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
6
-
7
- Dir.chdir APP_ROOT do
8
- # This script is a starting point to setup your application.
9
- # Add necessary setup steps to this file:
10
-
11
- puts "== Installing dependencies =="
12
- system "gem install bundler --conservative"
13
- system "bundle check || bundle install"
14
-
15
- # puts "\n== Copying sample files =="
16
- # unless File.exist?("config/database.yml")
17
- # system "cp config/database.yml.sample config/database.yml"
18
- # end
19
-
20
- puts "\n== Preparing database =="
21
- system "bin/rake db:setup"
22
-
23
- puts "\n== Removing old logs and tempfiles =="
24
- system "rm -f log/*"
25
- system "rm -rf tmp/cache"
26
-
27
- puts "\n== Restarting application server =="
28
- system "touch tmp/restart.txt"
29
- end