Module: ZuoraConnect

Defined in:
app/helpers/zuora_connect/LDAP/connection.rb,
lib/zuora_connect.rb,
lib/zuora_connect/engine.rb,
lib/zuora_connect/railtie.rb,
lib/zuora_connect/version.rb,
lib/zuora_connect/exceptions.rb,
app/models/zuora_connect/login.rb,
lib/zuora_connect/configuration.rb,
lib/middleware/json_parse_errors.rb,
app/models/zuora_connect/telegraf.rb,
lib/middleware/metrics_middleware.rb,
app/models/zuora_connect/zuora_user.rb,
lib/middleware/request_id_middleware.rb,
lib/zuora_connect/middleware/hallway.rb,
app/models/zuora_connect/app_instance.rb,
lib/zuora_connect/controllers/helpers.rb,
app/helpers/zuora_connect/LDAP/adapter.rb,
app/models/zuora_connect/app_instance_base.rb,
app/models/concerns/zuora_connect/auditable.rb,
app/helpers/zuora_connect/application_helper.rb,
app/controllers/zuora_connect/static_controller.rb,
app/controllers/concerns/zuora_connect/authenticate.rb,
app/controllers/zuora_connect/application_controller.rb,
app/helpers/zuora_connect/api/v1/app_instance_helper.rb,
app/controllers/zuora_connect/admin/tenant_controller.rb,
app/controllers/zuora_connect/api/v1/app_instance_controller.rb

Overview

Copied from devise lib and deleted not useful functionality

Defined Under Namespace

Modules: ApplicationHelper, Auditable, Authenticate, Controllers, Exceptions, LDAP, Middleware Classes: AppInstance, AppInstanceBase, ApplicationController, Configuration, Engine, JsonParseErrors, Login, MetricsMiddleware, PageRequest, Railtie, RequestIdMiddleware, StaticController, Telegraf, ZuoraUser

Constant Summary collapse

VERSION =
"3.2.11"

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.configurationObject

Returns the value of attribute configuration.



20
21
22
# File 'lib/zuora_connect.rb', line 20

def configuration
  @configuration
end

.loggerObject



23
24
25
26
27
28
29
30
31
32
# File 'lib/zuora_connect.rb', line 23

def logger
  case Rails.env.to_s
  when 'development'
    Rails.logger
   when 'test'
    Rails.logger
  else
    @logger ||= ZuoraObservability::Logger.custom_logger(name: "Connect", level: Rails.logger.level)
  end
end

Class Method Details

.app_nameObject



34
35
36
37
38
39
40
# File 'lib/zuora_connect.rb', line 34

def app_name
  if Rails::VERSION::MAJOR >= 6
    Rails.application.class.module_parent_name
  else
    Rails.application.class.parent_name
  end
end

.configure {|configuration| ... } ⇒ Object

Yields:



55
56
57
58
59
60
61
# File 'lib/zuora_connect.rb', line 55

def self.configure
  yield(configuration)
  ::Apartment.excluded_models << "Delayed::Job" if configuration.delayed_job
  ::Apartment.excluded_models.concat(configuration.additional_apartment_models) if configuration.additional_apartment_models.class == Array

  return configuration
end

.elastic_apm_defaultsObject



63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# File 'lib/zuora_connect.rb', line 63

def self.elastic_apm_defaults
  defaults = {}
  case Rails.env.to_s
  when 'production'
    defaults = {
      server_url: "https://apm-server.logging.svc.cluster.local:8200",
      secret_token:'afhfkulsahgcanriu2c7n8638w59cb67572YCAFAF38839095253',
      transaction_sample_rate: 0.20,
      capture_body: 'errors'
    }
  when 'staging'
    defaults = {
      server_url: "https://apm-server.logging.svc.cluster.local:8200",
      secret_token:'afhfkulsahgcanriu2c7n8638w59cb67572YCAFAF38839095253',
      transaction_sample_rate: 1.0
    }
  when 'development'
    defaults = {
      server_url: "http://logging.0.ecc.auw2.zuora:8200",
      transaction_sample_rate: 1.0
    }
  when 'test'
    defaults = {
      enabled: false,
      disable_send: true
    }
  end

  defaults.merge!({
    disable_start_message: true,
    pool_size: 1,
    transaction_max_spans: 500,
    ignore_url_patterns: ['^\/admin\/resque.*', '^\/admin\/redis.*', '^\/admin\/peek.*', '^\/peek.*'],
    verify_server_cert: false,
    log_level: Logger::WARN,
    service_version: ENV['Z_APPLICATION_VERSION'].present? ? ENV['Z_APPLICATION_VERSION'] : '0.0.0',
    service_name: ENV['DEIS_APP'].present? ? ENV['DEIS_APP'] : ZuoraConnect.app_name,
    logger: ZuoraObservability::Logger.custom_logger(name: "ElasticAPM", level: Logger::WARN)
  })
  defaults.merge!({disable_send: true}) if defined?(Rails::Console)

  return defaults
end

.resetObject



51
52
53
# File 'lib/zuora_connect.rb', line 51

def self.reset
  @configuration = Configuration.new
end