zuora_connectD 1.7.09

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 (102) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/Rakefile +38 -0
  4. data/app/assets/javascripts/zuora_connect/api/v1/app_instance.js +2 -0
  5. data/app/assets/javascripts/zuora_connect/application.js +13 -0
  6. data/app/assets/stylesheets/zuora_connect/api/v1/app_instance.css +4 -0
  7. data/app/assets/stylesheets/zuora_connect/application.css +15 -0
  8. data/app/controllers/zuora_connect/admin/tenant_controller.rb +11 -0
  9. data/app/controllers/zuora_connect/api/v1/app_instance_controller.rb +45 -0
  10. data/app/controllers/zuora_connect/application_controller.rb +8 -0
  11. data/app/controllers/zuora_connect/static_controller.rb +32 -0
  12. data/app/helpers/zuora_connect/api/v1/app_instance_helper.rb +4 -0
  13. data/app/helpers/zuora_connect/application_helper.rb +5 -0
  14. data/app/models/zuora_connect/app_instance.rb +5 -0
  15. data/app/models/zuora_connect/app_instance_base.rb +811 -0
  16. data/app/models/zuora_connect/login.rb +36 -0
  17. data/app/models/zuora_connect/telegraf.rb +88 -0
  18. data/app/views/layouts/zuora_connect/application.html.erb +14 -0
  19. data/app/views/sql/refresh_aggregate_table.txt +84 -0
  20. data/app/views/zuora_connect/static/invalid_app_instance_error.html.erb +65 -0
  21. data/app/views/zuora_connect/static/session_error.html.erb +63 -0
  22. data/config/initializers/apartment.rb +95 -0
  23. data/config/initializers/object_method_hooks.rb +27 -0
  24. data/config/initializers/postgresql_adapter.rb +32 -0
  25. data/config/initializers/prometheus.rb +41 -0
  26. data/config/initializers/redis.rb +10 -0
  27. data/config/initializers/resque.rb +6 -0
  28. data/config/initializers/to_bool.rb +24 -0
  29. data/config/initializers/unicorn.rb +9 -0
  30. data/config/routes.rb +13 -0
  31. data/db/migrate/20100718151733_create_connect_app_instances.rb +9 -0
  32. data/db/migrate/20101024162319_add_tokens_to_app_instance.rb +6 -0
  33. data/db/migrate/20101024220705_add_token_to_app_instance.rb +5 -0
  34. data/db/migrate/20110131211919_add_sessions_table.rb +13 -0
  35. data/db/migrate/20110411200303_add_expiration_to_app_instance.rb +5 -0
  36. data/db/migrate/20110413191512_add_new_api_token.rb +5 -0
  37. data/db/migrate/20110503003602_add_catalog_data_to_app_instance.rb +6 -0
  38. data/db/migrate/20110503003603_add_catalog_mappings_to_app_instance.rb +5 -0
  39. data/db/migrate/20110503003604_catalog_default.rb +5 -0
  40. data/db/migrate/20180301052853_add_catalog_attempted_at.rb +5 -0
  41. data/lib/metrics/influx/point_value.rb +79 -0
  42. data/lib/metrics/net.rb +218 -0
  43. data/lib/middleware/metrics_middleware.rb +110 -0
  44. data/lib/resque/additions.rb +53 -0
  45. data/lib/resque/dynamic_queues.rb +142 -0
  46. data/lib/resque/self_lookup.rb +19 -0
  47. data/lib/resque/silence_done.rb +71 -0
  48. data/lib/tasks/zuora_connect_tasks.rake +24 -0
  49. data/lib/zuora_connectD.rb +41 -0
  50. data/lib/zuora_connectD/configuration.rb +52 -0
  51. data/lib/zuora_connectD/controllers/helpers.rb +165 -0
  52. data/lib/zuora_connectD/engine.rb +30 -0
  53. data/lib/zuora_connectD/exceptions.rb +67 -0
  54. data/lib/zuora_connectD/railtie.rb +59 -0
  55. data/lib/zuora_connectD/version.rb +3 -0
  56. data/lib/zuora_connectD/views/helpers.rb +9 -0
  57. data/test/controllers/zuora_connect/api/v1/app_instance_controller_test.rb +13 -0
  58. data/test/dummy/README.rdoc +28 -0
  59. data/test/dummy/Rakefile +6 -0
  60. data/test/dummy/app/assets/javascripts/application.js +13 -0
  61. data/test/dummy/app/assets/stylesheets/application.css +15 -0
  62. data/test/dummy/app/controllers/application_controller.rb +5 -0
  63. data/test/dummy/app/helpers/application_helper.rb +2 -0
  64. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  65. data/test/dummy/bin/bundle +3 -0
  66. data/test/dummy/bin/rails +4 -0
  67. data/test/dummy/bin/rake +4 -0
  68. data/test/dummy/bin/setup +29 -0
  69. data/test/dummy/config.ru +4 -0
  70. data/test/dummy/config/application.rb +26 -0
  71. data/test/dummy/config/boot.rb +5 -0
  72. data/test/dummy/config/database.yml +25 -0
  73. data/test/dummy/config/environment.rb +5 -0
  74. data/test/dummy/config/environments/development.rb +41 -0
  75. data/test/dummy/config/environments/production.rb +79 -0
  76. data/test/dummy/config/environments/test.rb +42 -0
  77. data/test/dummy/config/initializers/assets.rb +11 -0
  78. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  79. data/test/dummy/config/initializers/cookies_serializer.rb +3 -0
  80. data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  81. data/test/dummy/config/initializers/inflections.rb +16 -0
  82. data/test/dummy/config/initializers/mime_types.rb +4 -0
  83. data/test/dummy/config/initializers/session_store.rb +3 -0
  84. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  85. data/test/dummy/config/locales/en.yml +23 -0
  86. data/test/dummy/config/routes.rb +4 -0
  87. data/test/dummy/config/secrets.yml +22 -0
  88. data/test/dummy/db/development.sqlite3 +0 -0
  89. data/test/dummy/db/test.sqlite3 +0 -0
  90. data/test/dummy/log/development.log +2 -0
  91. data/test/dummy/log/test.log +0 -0
  92. data/test/dummy/public/404.html +67 -0
  93. data/test/dummy/public/422.html +67 -0
  94. data/test/dummy/public/500.html +66 -0
  95. data/test/dummy/public/favicon.ico +0 -0
  96. data/test/fixtures/zuora_connect/app_instances.yml +11 -0
  97. data/test/integration/navigation_test.rb +8 -0
  98. data/test/lib/generators/zuora_connect/datatable_generator_test.rb +16 -0
  99. data/test/models/zuora_connect/app_instance_test.rb +9 -0
  100. data/test/test_helper.rb +21 -0
  101. data/test/zuora_connect_test.rb +7 -0
  102. metadata +416 -0
@@ -0,0 +1,110 @@
1
+ module Middleware
2
+ require 'uri'
3
+
4
+ # Object of this class is passed to the ActiveSupport::Notification hook
5
+ class PageRequest
6
+
7
+ # This method is triggered when a non error page is loaded (not 404)
8
+ def call(name, started, finished, unique_id, payload)
9
+ # If the url contains any css or JavaScript files then do not collect metrics for them
10
+ return nil if ["css", "assets", "jpg", "png", "jpeg", "ico"].any? { |word| payload[:path].include?(word) }
11
+
12
+ # Getting the endpoint and the content_type
13
+ content_hash = {:html => "text/html", :js => "application/javascript", :json => "application/json"}
14
+ content_type = content_hash.key?(payload[:format]) ? content_hash[payload[:format]] : payload[:format]
15
+ content_type = content_type.gsub('text/javascript', 'application/javascript')
16
+
17
+ # payloads with 500 requests do not have status as it is not set by the controller
18
+ # https://github.com/rails/rails/issues/33335
19
+ #status_code = payload[:status] ? payload[:status] : payload[:exception_object].present? ? 500 : ""
20
+ if payload[:exception].present?
21
+ status_code, exception = [500, payload[:exception].first]
22
+ else
23
+ status_code, exception = [payload[:status], nil]
24
+ end
25
+
26
+ tags = {method: payload[:method], status: status_code, error_type: exception, content_type: content_type, controller: payload[:controller], action: payload[:action]}.compact
27
+
28
+ values = {view_time: payload[:view_runtime], db_time: payload[:db_runtime], response_time: ((finished-started)*1000)}.compact
29
+ values = values.map{ |k,v| [k,v.round(2)]}.to_h
30
+
31
+ ZuoraConnect::AppInstanceBase.write_to_telegraf(direction: :inbound, tags: tags, values: values)
32
+ end
33
+ end
34
+
35
+ class MetricsMiddleware
36
+
37
+ require "zuora_connectD/version"
38
+ require "zuora_apiD/version"
39
+
40
+ def initialize(app)
41
+ @app = app
42
+ end
43
+
44
+ def call(env)
45
+ start_time = Time.now
46
+ @status, @headers, @response = @app.call(env)
47
+
48
+ # If the url contains any CSS or JavaScript files then do not collect metrics for them
49
+ if ["css", "assets", "jpg", "png", "jpeg", "ico"].any? { |word| env['PATH_INFO'].include?(word) } || /.*\.js$/.match(env['PATH_INFO'])
50
+ tags = {status: @status, controller: 'ActionController', action: 'Assets', app_instance: 0}
51
+ values = {response_time: ((Time.now - start_time)*1000).round(2) }
52
+ ZuoraConnect::AppInstanceBase.write_to_telegraf(direction: 'request-inbound-assets', tags: tags, values: values)
53
+ end
54
+
55
+ if defined? Prometheus
56
+ #Prometheus Stuff
57
+ if env['PATH_INFO'] == '/connect/internal/metrics'
58
+
59
+ #Do something before each scrape
60
+ if defined? Resque.redis
61
+
62
+ app_name = ENV['DEIS_APP'].present? ? "#{ENV['DEIS_APP']}" : "#{Rails.application.class.parent_name}"
63
+ begin
64
+
65
+ Resque.redis.ping
66
+
67
+ Prometheus::REDIS_CONNECTION.set({connection:'redis',name:app_name},1)
68
+ Prometheus::FINISHED_JOBS.set({type:'resque',name:app_name},Resque.info[:processed])
69
+ Prometheus::PENDING_JOBS.set({type:'resque',name:app_name},Resque.info[:pending])
70
+ Prometheus::ACTIVE_WORKERS.set({type:'resque',name:app_name},Resque.info[:working])
71
+ Prometheus::WORKERS.set({type:'resque',name:app_name},Resque.info[:workers])
72
+ Prometheus::FAILED_JOBS.set({type:'resque',name:app_name},Resque.info[:failed])
73
+
74
+ rescue Redis::CannotConnectError
75
+ Prometheus::REDIS_CONNECTION.set({connection:'redis',name:app_name},0)
76
+ end
77
+
78
+ if ZuoraConnect.configuration.custom_prometheus_update_block != nil
79
+ ZuoraConnect.configuration.custom_prometheus_update_block.call()
80
+ end
81
+ end
82
+
83
+ end
84
+ end
85
+
86
+ # Uncomment following block of code for handling engine requests/requests without controller
87
+ # else
88
+ # # Handling requests which do not have controllers (engines)
89
+ if env["SCRIPT_NAME"].present?
90
+ controller_path = "#{env['SCRIPT_NAME'][1..-1]}"
91
+ controller_path = controller_path.sub("/", "::")
92
+ request_path = "#{controller_path}#UnknownAction"
93
+ else
94
+ # Writing to telegraf: Handle 404
95
+ if [404].include?(@status)
96
+ content_type = @headers['Content-Type'].split(';')[0] if @headers['Content-Type']
97
+ content_type = content_type.gsub('text/javascript', 'application/javascript')
98
+ tags = {status: @status, content_type: content_type}
99
+
100
+ tags = tags.merge({controller: 'ActionController', action: 'RoutingError' })
101
+
102
+ values = {response_time: ((Time.now - start_time)*1000).round(2) }
103
+
104
+ ZuoraConnect::AppInstanceBase.write_to_telegraf(direction: :inbound, tags: tags, values: values)
105
+ end
106
+ end
107
+ [@status, @headers, @response]
108
+ end
109
+ end
110
+ end
@@ -0,0 +1,53 @@
1
+ module Resque
2
+ module Additions
3
+ def dequeue_from(queue, klass, *args)
4
+ ####### ------ Resque Job --------
5
+ # Perform before_dequeue hooks. Don't perform dequeue if any hook returns false
6
+ before_hooks = Plugin.before_dequeue_hooks(klass).collect do |hook|
7
+ klass.send(hook, *args)
8
+ end
9
+ return if before_hooks.any? { |result| result == false }
10
+
11
+ destroyed = Job.destroy(queue, klass, *args)
12
+
13
+ Plugin.after_dequeue_hooks(klass).each do |hook|
14
+ klass.send(hook, *args)
15
+ end
16
+
17
+ destroyed
18
+ end
19
+
20
+ ####### ------ Resque Delayed Job --------
21
+ # Returns delayed jobs schedule timestamp for +klass+, +args+.
22
+ def scheduled_at_with_queue(queue, klass, *args)
23
+ search = encode(job_to_hash_with_queue(queue,klass, args))
24
+ redis.smembers("timestamps:#{search}").map do |key|
25
+ key.tr('delayed:', '').to_i
26
+ end
27
+ end
28
+
29
+ # Given an encoded item, remove it from the delayed_queue
30
+ def remove_delayed_with_queue(queue, klass, *args)
31
+ search = encode(job_to_hash_with_queue(queue,klass, args))
32
+ remove_delayed_job(search)
33
+ end
34
+
35
+ #Given a timestamp and job (klass + args) it removes all instances and
36
+ # returns the count of jobs removed.
37
+ #
38
+ # O(N) where N is the number of jobs scheduled to fire at the given
39
+ # timestamp
40
+ def remove_delayed_job_with_queue_from_timestamp(timestamp, queue, klass, *args)
41
+ return 0 if Resque.inline?
42
+
43
+ key = "delayed:#{timestamp.to_i}"
44
+ encoded_job = encode(job_to_hash_with_queue(queue, klass, args))
45
+
46
+ redis.srem("timestamps:#{encoded_job}", key)
47
+ count = redis.lrem(key, 0, encoded_job)
48
+ clean_up_timestamp(key, timestamp)
49
+
50
+ count
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,142 @@
1
+ module Resque
2
+ module DynamicQueues
3
+ def filter_busy_queues qs
4
+ busy_queues = Resque::Worker.working.map { |worker| worker.job["queue"] }.compact
5
+ Array(qs.dup).compact - busy_queues
6
+ end
7
+
8
+ def rotated_queues
9
+ @n ||= 0
10
+ @n += 1
11
+ rot_queues = queues # since we rely on the resque-dynamic-queues plugin, this is all the queues, expanded out
12
+ if rot_queues.size > 0
13
+ @n = @n % rot_queues.size
14
+ rot_queues.rotate(@n)
15
+ else
16
+ rot_queues
17
+ end
18
+ end
19
+
20
+ def queue_depth queuename
21
+ busy_queues = Resque::Worker.working.map { |worker| worker.job["queue"] }.compact
22
+ # find the queuename, count it.
23
+ busy_queues.select {|q| q == queuename }.size
24
+ end
25
+
26
+ DEFAULT_QUEUE_DEPTH = 0
27
+ def should_work_on_queue? queuename
28
+ return true if @queues.include? '*' # workers with QUEUES=* are special and are not subject to queue depth setting
29
+ max = DEFAULT_QUEUE_DEPTH
30
+ unless ENV["RESQUE_QUEUE_DEPTH"].nil? || ENV["RESQUE_QUEUE_DEPTH"] == ""
31
+ max = ENV["RESQUE_QUEUE_DEPTH"].to_i
32
+ end
33
+ return true if max == 0 # 0 means no limiting
34
+ cur_depth = queue_depth(queuename)
35
+ log! "queue #{queuename} depth = #{cur_depth} max = #{max}"
36
+ return true if cur_depth < max
37
+ false
38
+ end
39
+
40
+ def reserve_with_round_robin
41
+ grouped_queues = queues.sort.group_by{|u| /(\d{1,20})_.*/.match(u) ? /(\d{1,20})_.*/.match(u).captures.first : nil}
42
+
43
+ #Instance queue grouping
44
+ if !grouped_queues.keys.include?(nil) && grouped_queues.keys.size > 0
45
+ @n ||= 0
46
+ @n += 1
47
+ @n = @n % grouped_queues.keys.size
48
+
49
+ grouped_queues.keys.rotate(@n).each do |key|
50
+ grouped_queues[key].each do |queue|
51
+ log! "Checking #{queue}"
52
+ if should_work_on_queue?(queue) && @job_in_progress = Resque::Job.reserve(queue)
53
+ log! "Found job on #{queue}"
54
+ return @job_in_progress
55
+ end
56
+ end
57
+ @n += 1 # Start the next search at the queue after the one from which we pick a job.
58
+ end
59
+ nil
60
+ else
61
+ return reserve_without_round_robin
62
+ end
63
+
64
+ rescue Exception => e
65
+ log "Error reserving job: #{e.inspect}"
66
+ log e.backtrace.join("\n")
67
+ raise e
68
+ end
69
+
70
+ # Returns a list of queues to use when searching for a job.
71
+ #
72
+ # A splat ("*") means you want every queue (in alpha order) - this
73
+ # can be useful for dynamically adding new queues.
74
+ #
75
+ # The splat can also be used as a wildcard within a queue name,
76
+ # e.g. "*high*", and negation can be indicated with a prefix of "!"
77
+ #
78
+ # An @key can be used to dynamically look up the queue list for key from redis.
79
+ # If no key is supplied, it defaults to the worker's hostname, and wildcards
80
+ # and negations can be used inside this dynamic queue list. Set the queue
81
+ # list for a key with Resque.set_dynamic_queue(key, ["q1", "q2"]
82
+ #
83
+ def queues_with_dynamic
84
+ queue_names = @queues.dup
85
+
86
+ return queues_without_dynamic if queue_names.grep(/(^!)|(^@)|(\*)/).size == 0
87
+
88
+ real_queues = Resque.queues
89
+ matched_queues = []
90
+
91
+ #Remove Queues under Api Limits
92
+ api_limit_instances = Redis.current.keys('APILimits:*').map {|key| key.split('APILimits:').last.to_i}
93
+ real_queues = real_queues.select {|key| key if !api_limit_instances.include?((key.match(/^(\d*)_.*/) || [])[1].to_i)} ## 2
94
+
95
+ #Queue Pausing
96
+ paused_instances = Redis.current.keys('resque:PauseQueue:*').map {|key| key.split('resque:PauseQueue:').last.to_i}
97
+ real_queues = real_queues.select {|key| key if !paused_instances.include?((key.match(/^(\d*)_.*/) || [])[1].to_i)}
98
+
99
+ while q = queue_names.shift
100
+ q = q.to_s
101
+
102
+ if q =~ /^(!)?@(.*)/
103
+ key = $2.strip
104
+ key = hostname if key.size == 0
105
+
106
+ add_queues = Resque.get_dynamic_queue(key)
107
+ add_queues.map! { |q| q.gsub!(/^!/, '') || q.gsub!(/^/, '!') } if $1
108
+
109
+ queue_names.concat(add_queues)
110
+ next
111
+ end
112
+
113
+ if q =~ /^!/
114
+ negated = true
115
+ q = q[1..-1]
116
+ end
117
+
118
+ patstr = q.gsub(/\*/, '.*')
119
+ pattern = /^#{patstr}$/
120
+ if negated
121
+ matched_queues -= matched_queues.grep(pattern)
122
+ else
123
+ matches = real_queues.grep(/^#{pattern}$/)
124
+ matches = [q] if matches.size == 0 && q == patstr
125
+ matched_queues.concat(matches.sort)
126
+ end
127
+ end
128
+
129
+ return matched_queues.uniq
130
+ end
131
+
132
+
133
+ def self.included(receiver)
134
+ receiver.class_eval do
135
+ alias queues_without_dynamic queues
136
+ alias queues queues_with_dynamic
137
+ alias reserve_without_round_robin reserve
138
+ alias reserve reserve_with_round_robin
139
+ end
140
+ end
141
+ end
142
+ end
@@ -0,0 +1,19 @@
1
+ module Resque
2
+ module SelfLookup
3
+ def payload_class_enhanced
4
+ @payload_class ||= constantize(@payload['class'])
5
+ @payload_class.instance_eval { class << self; self end }.send(:attr_accessor, :worker)
6
+ @payload_class.instance_eval { class << self; self end }.send(:attr_accessor, :job)
7
+ @payload_class.worker = self.worker
8
+ @payload_class.job = self
9
+ return @payload_class
10
+ end
11
+
12
+ def self.included(receiver)
13
+ receiver.class_eval do
14
+ alias payload_class_old payload_class
15
+ alias payload_class payload_class_enhanced
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,71 @@
1
+ module Resque
2
+ module SilenceDone
3
+ def perform_no_log(job)
4
+ begin
5
+ if fork_per_job?
6
+ reconnect
7
+ run_hook :after_fork, job
8
+ end
9
+ job.perform
10
+ rescue Object => e
11
+ report_failed_job(job,e)
12
+ else
13
+ # log_with_severity :info, "done: #{job.inspect}"
14
+ ensure
15
+ yield job if block_given?
16
+ end
17
+ end
18
+
19
+ # def work(interval = 5.0, &block)
20
+ # interval = Float(interval)
21
+ # startup
22
+
23
+ # loop do
24
+ # break if shutdown?
25
+
26
+ # unless work_one_job(&block)
27
+ # break if interval.zero?
28
+ # log_with_severity :debug, "Sleeping for #{interval} seconds"
29
+ # procline paused? ? "Paused" : "Waiting for #{queues.join(',')}"
30
+ # sleep interval
31
+ # end
32
+ # end
33
+
34
+ # unregister_worker
35
+ # rescue Exception => exception
36
+ # return if exception.class == SystemExit && !@child && run_at_exit_hooks
37
+ # log_with_severity :error, "Failed to start worker : #{exception.inspect}"
38
+ # unregister_worker(exception)
39
+ # end
40
+
41
+ def work_one_job_no_log(job = nil, &block)
42
+ return false if paused?
43
+ return false unless job ||= reserve
44
+
45
+ working_on job
46
+ procline "Processing #{job.queue} since #{Time.now.to_i} [#{job.payload_class_name}]"
47
+
48
+ #log_with_severity :info, "got: #{job.inspect}"
49
+ job.worker = self
50
+
51
+ if fork_per_job?
52
+ perform_with_fork(job, &block)
53
+ else
54
+ perform(job, &block)
55
+ end
56
+
57
+ done_working
58
+ true
59
+ end
60
+
61
+ def self.included(receiver)
62
+ receiver.class_eval do
63
+ alias work_one_job_with_log work_one_job
64
+ alias work_one_job work_one_job_no_log
65
+
66
+ alias perform_with_log perform
67
+ alias perform perform_no_log
68
+ end
69
+ end
70
+ end
71
+ end
@@ -0,0 +1,24 @@
1
+ # desc "Explaining what the task does"
2
+ # task :connect do
3
+ # # Task goes here
4
+ # end
5
+
6
+ namespace :db do
7
+ desc 'Also create shared_extensions Schema'
8
+ task :extensions => :environment do
9
+ # Create Schema
10
+ ActiveRecord::Base.connection.execute 'CREATE SCHEMA IF NOT EXISTS shared_extensions;'
11
+ # Enable Hstore
12
+ ActiveRecord::Base.connection.execute 'CREATE EXTENSION IF NOT EXISTS HSTORE SCHEMA shared_extensions;'
13
+ # Enable UUID-OSSP
14
+ ActiveRecord::Base.connection.execute 'CREATE EXTENSION IF NOT EXISTS "uuid-ossp" SCHEMA shared_extensions;'
15
+ end
16
+ end
17
+
18
+ Rake::Task["db:create"].enhance do
19
+ Rake::Task["db:extensions"].invoke
20
+ end
21
+
22
+ Rake::Task["db:test:purge"].enhance do
23
+ Rake::Task["db:extensions"].invoke
24
+ end
@@ -0,0 +1,41 @@
1
+ require 'zuora_connectD/configuration'
2
+ require "zuora_connectD/engine"
3
+ require 'zuora_connectD/exceptions'
4
+ require 'zuora_connectD/controllers/helpers'
5
+ require 'zuora_connectD/views/helpers'
6
+ require 'zuora_connectD/railtie'
7
+ require 'resque/additions'
8
+ require 'resque/dynamic_queues'
9
+ require 'resque/silence_done'
10
+ require 'resque/self_lookup'
11
+ require 'metrics/influx/point_value'
12
+ require 'metrics/net'
13
+
14
+ module ZuoraConnect
15
+ class << self
16
+ attr_accessor :configuration
17
+ end
18
+ module Controllers
19
+ autoload :Helpers, 'zuora_connect/controllers/helpers'
20
+ end
21
+
22
+ module Views
23
+ ActionView::Base.send(:include, Helpers)
24
+ end
25
+
26
+ def self.configuration
27
+ @configuration ||= Configuration.new
28
+ end
29
+
30
+ def self.reset
31
+ @configuration = Configuration.new
32
+ end
33
+
34
+ def self.configure
35
+ yield(configuration)
36
+ ::Apartment.excluded_models << "Delayed::Job" if configuration.delayed_job
37
+ ::Apartment.excluded_models.concat(configuration.additional_apartment_models) if configuration.additional_apartment_models.class == Array
38
+
39
+ return configuration
40
+ end
41
+ end