Module: MnoEnterprise

Defined in:
app/models/mno_enterprise/app.rb,
lib/mno_enterprise/core.rb,
lib/mno_enterprise/engine.rb,
lib/mno_enterprise/version.rb,
lib/mno_enterprise/concerns.rb,
app/models/mno_enterprise/team.rb,
app/models/mno_enterprise/user.rb,
lib/mno_enterprise/mail_client.rb,
lib/mno_enterprise/smtp_client.rb,
lib/mno_enterprise/impac_client.rb,
app/models/mno_enterprise/tenant.rb,
app/models/mno_enterprise/ability.rb,
app/models/mno_enterprise/invoice.rb,
app/models/mno_enterprise/identity.rb,
app/pdf/mno_enterprise/invoice_pdf.rb,
lib/mno_enterprise/concerns/models.rb,
app/models/mno_enterprise/impac/kpi.rb,
app/models/mno_enterprise/app_answer.rb,
app/models/mno_enterprise/app_review.rb,
app/models/mno_enterprise/org_invite.rb,
app/models/mno_enterprise/sub_tenant.rb,
app/models/mno_enterprise/app_comment.rb,
app/models/mno_enterprise/audit_event.rb,
app/models/mno_enterprise/credit_card.rb,
app/models/mno_enterprise/impac/alert.rb,
app/models/mno_enterprise/app_feedback.rb,
app/models/mno_enterprise/app_instance.rb,
app/models/mno_enterprise/app_question.rb,
app/models/mno_enterprise/impac/widget.rb,
app/models/mno_enterprise/organization.rb,
app/helpers/mno_enterprise/image_helper.rb,
app/models/mno_enterprise/base_resource.rb,
app/models/mno_enterprise/shared_entity.rb,
lib/mno_enterprise/concerns/controllers.rb,
app/models/mno_enterprise/tenant_invoice.rb,
lib/mno_enterprise/mail_adapters/adapter.rb,
app/models/mno_enterprise/impac/dashboard.rb,
app/models/mno_enterprise/deletion_request.rb,
app/models/mno_enterprise/arrears_situation.rb,
app/models/mno_enterprise/app_instances_sync.rb,
lib/mno_enterprise/concerns/controllers/auth.rb,
app/helpers/mno_enterprise/application_helper.rb,
app/helpers/mno_enterprise/impersonate_helper.rb,
lib/mno_enterprise/mail_adapters/smtp_adapter.rb,
lib/mno_enterprise/mail_adapters/test_adapter.rb,
lib/mno_enterprise/mail_adapters/mandrill_adapter.rb,
lib/mno_enterprise/mail_adapters/sparkpost_adapter.rb,
lib/generators/mno_enterprise/dummy/dummy_generator.rb,
app/controllers/mno_enterprise/application_controller.rb,
app/models/mno_enterprise/impac/dashboard_provisioner.rb,
lib/mno_enterprise/testing_support/user_action_shared.rb,
lib/generators/mno_enterprise/install/install_generator.rb,
lib/generators/mno_enterprise/puma_stack/puma_stack_generator.rb

Overview

Schema Information

Table name: deletion_requests

id             :integer         not null, primary key
token          :string(255)
status         :string(255)
created_at     :datetime        not null
updated_at     :datetime        not null

Defined Under Namespace

Modules: ApplicationHelper, Concerns, DatabaseExtendable, Generators, ImageHelper, ImpersonateHelper, MailAdapters Classes: Ability, App, AppAnswer, AppComment, AppFeedback, AppInstance, AppInstancesSync, AppQuestion, AppReview, ApplicationController, ArrearsSituation, AuditEvent, BaseResource, CreditCard, DatabaseExtensionGenerator, DeletionRequest, DummyGenerator, Engine, Identity, ImpacClient, Invoice, InvoicePdf, MailClient, OrgInvite, Organization, Router, SharedEntity, SmtpClient, SubTenant, Team, Tenant, TenantInvoice, User

Constant Summary collapse

VERSION =
'3.4.0'
@@tenant_name =
'Maestrano Enterprise'
@@app_country =
'US'
@@app_currency =
'USD'
@@tenant_id =
nil
@@tenant_key =
nil
@@impac_api_host =
'https://api-impac-uat.maestrano.io'
@@impac_api_root_path =
"/api/v1"
@@mno_api_host =
"https://api-enterprise.maestrano.com"
@@mno_api_private_host =
nil
@@mno_api_root_path =
"/api/mnoe/v1"
@@mnoe_api_v1 =
nil
@@router =
Router.new
@@mandrill_key =
nil
@@support_email =
"[email protected]"
@@default_sender_name =
nil
@@default_sender_email =
"[email protected]"
@@include_angular_csrf =
false
@@i18n_enabled =
false
@@google_tag_container =
nil
@@intercom_app_id =
nil
@@intercom_api_secret =
nil
@@intercom_api_key =
nil
@@intercom_token =
nil
@@styleguide =
nil
@@style =
nil
@@marketplace_listing =
nil
@@widgets_templates_listing =
nil

Class Method Summary collapse

Class Method Details

.configure {|_self| ... } ⇒ Object

Default way to setup MnoEnterprise. Run rails generate mno-enterprise:install to create a fresh initializer with all configuration values.

Yields:

  • (_self)

Yield Parameters:

  • _self (MnoEnterprise)

    the object that the method was called on



272
273
274
275
276
277
278
279
280
# File 'lib/mno_enterprise/core.rb', line 272

def self.configure
  yield self
  self.configure_styleguide
  self.configure_api

  # Mail config
  # We can't use the setter before MailClient is loaded
  self.mail_adapter = self.mail_adapter
end

.intercom_enabled?Boolean

Define if Intercom is enabled. Only if the gem intercom is present

Returns:

  • (Boolean)


229
230
231
# File 'lib/mno_enterprise/core.rb', line 229

def self.intercom_enabled?
  defined?(::Intercom) && ((intercom_app_id && intercom_api_key) || intercom_token)
end

.jwt(payload) ⇒ Object

Create a JSON web token with the provided payload E.g.: MnoEnterprise.jwt({ user_id: ‘usr-427431’ })



284
285
286
287
288
289
290
291
292
293
# File 'lib/mno_enterprise/core.rb', line 284

def self.jwt(payload)
  secret = "#{self.tenant_id}:#{self.tenant_key}"
  iat = Time.now.utc.to_i

  JWT.encode(payload.merge(
    iss: MnoEnterprise.tenant_id,
    iat: iat,
    jit: Digest::MD5.hexdigest("#{secret}:#{iat}")
  ), secret)
end

.mail_adapter=(adapter) ⇒ Object



182
183
184
185
# File 'lib/mno_enterprise/core.rb', line 182

def self.mail_adapter=(adapter)
  @@mail_adapter = adapter
  MnoEnterprise::MailClient.adapter = self.mail_adapter
end

.mandrill_keyObject

Emailing

@deprecated: Use ENV Mandrill Key for sending emails



169
170
171
172
# File 'lib/mno_enterprise/core.rb', line 169

def self.mandrill_key
  warn "[DEPRECATION] `mandrill_key` is deprecated. Use `ENV['MANDRILL_API_KEY']`."
  @@mandrill_key
end

.mandrill_key=(mandrill_key) ⇒ Object



173
174
175
176
# File 'lib/mno_enterprise/core.rb', line 173

def self.mandrill_key=(mandrill_key)
  warn "[DEPRECATION] `mandrill_key` is deprecated. Use `ENV['MANDRILL_API_KEY']`."
  @@mandrill_key = mandrill_key
end

.styleObject

Always reload style in development



263
264
265
266
# File 'lib/mno_enterprise/core.rb', line 263

def self.style
  self.configure_styleguide if Rails.env.development?
  @@style
end