Module: ZuoraConnect

Defined in:
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,
app/models/zuora_connect/app_instance.rb,
lib/zuora_connect/controllers/helpers.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

Defined Under Namespace

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

Constant Summary collapse

VERSION =
"3.0.1"

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.configurationObject

Returns the value of attribute configuration.



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

def configuration
  @configuration
end

.loggerObject



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

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



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

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:



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

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



62
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
# File 'lib/zuora_connect.rb', line 62

def self.elastic_apm_defaults
  defaults = {}
  case Rails.env.to_s
  when 'production'
    defaults = {
      server_url: "http://apm-server.logging:8200",
      transaction_sample_rate: 0.20,
      capture_body: 'errors'
    }
  when 'staging'
    defaults = {
      server_url: "http://apm-server.logging:8200",
      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,
    transaction_ignore_urls: ['^\/admin\/resque.*', '^\/admin\/redis.*', '^\/admin\/peek.*', '^\/peek.*'],
    verify_server_cert: false,
    log_level: Logger::INFO,
    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



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

def self.reset
  @configuration = Configuration.new
end