<commit_before>require 'prawn'
require 'prawn/table'
require 'money'
require 'deepstruct'
require 'less-rails'
require 'jwt'
require 'jquery-rails'
require 'haml'
require 'countries'
require 'jbuilder'
require 'cancancan'
require 'devise'
require 'devise/strategies/remote_authenticatable'
require "her"
require "her_extension/her_orm_adapter"
require "her_extension/model/orm"
require "her_extension/model/relation"
require "her_extension/model/attributes"
require "her_extension/model/parse"
require "her_extension/model/associations/association"
require "her_extension/model/associations/association_proxy"
require "her_extension/model/associations/has_many_association"
require "her_extension/middleware/mnoe_api_v1_parse_json"
require "mno_enterprise/engine"

require 'mno_enterprise/database_extendable'

require 'mandrill'
require "mandrill_client"

require 'accountingjs_serializer'

module MnoEnterprise

  #==================================================================
  # MnoEnterprise Router
  # Centralizes all URLs available on the Maestrano Enterprise side
  #==================================================================
  class Router
    attr_accessor :terms_url

    def launch_url(id,opts = {})
      host_url("/launch/#{id}",opts)
    end

    def authorize_oauth_url(id,opts = {})
      host_url("/oauth/#{id}/authorize",opts)
    end

    def disconnect_oauth_url(id,opts = {})
      host_url("/oauth/#{id}/disconnect",opts)
    end

    def sync_oauth_url(id,opts = {})
      host_url("/oauth/#{id}/sync",opts)
    end

    def impac_root_url
      URI.join(MnoEnterprise.impac_api_host,MnoEnterprise.impac_api_root_path)
    end

    private
      def base_path
        MnoEnterprise.mno_api_root_path
      end

      def host
        MnoEnterprise.mno_api_host
      end

      def host_url(path,opts = {})
        url = URI.join(host,"#{base_path}#{path}").to_s
        url += "?#{opts.to_query}" if opts.any?
        url
      end
  end

  #==================================================================
  # Module definition
  #==================================================================

  #====================================
  # Tenant
  #====================================
  # Maestrano Enterprise Tenant name
  mattr_accessor :app_name
  @@tenant_name = 'Maestrano Enterprise'

  # Maestrano Enterprise Default Country
  mattr_accessor :app_country
  @@app_country = 'US'

  # Maestrano Enterprise Default Currency
  mattr_accessor :app_currency
  @@app_currency = 'USD'

  # Maestrano Enterprise Tenant ID
  mattr_accessor :tenant_id
  @@tenant_id = nil

  # Maestrano Enterprise Tenant Key
  mattr_accessor :tenant_key
  @@tenant_key = nil

  #====================================
  # Impac
  #====================================
  mattr_accessor :impac_api_host
  @@impac_api_host = 'https://api-impac-uat.maestrano.io'

  mattr_accessor :impac_api_root_path
  @@impac_api_root_path = "/api/v1"

  #====================================
  # Enterprise API
  #====================================
  # The Maestrano Enterprise API Host
  mattr_accessor :mno_api_host
  @@mno_api_host = "https://api-enterprise.maestrano.com"

  # The Maestrano Enterprise API Private Host
  # Used within VPCs for making calls to mno_api using
  # private DNS
  mattr_accessor :mno_api_private_host
  @@mno_api_private_host = nil

  # The Maestrano Enterprise API base path
  mattr_accessor :mno_api_root_path
  @@mno_api_root_path = "/v1"

  # Hold the Her API configuration (see configure_api method)
  mattr_reader :mnoe_api_v1
  @@mnoe_api_v1 = nil

  # Hold the Maestrano enterprise router (redirection to central enterprise platform)
  mattr_reader :router
  @@router = Router.new


  #====================================
  # Emailing
  #====================================
  # Mandrill Key for sending emails
  # Points to the default maestrano enterprise account
  mattr_accessor :mandrill_key
  @@mandrill_key = '<KEY>'

  # The support email address
  mattr_accessor :support_email
  @@support_email = "<EMAIL>"

  # Default sender name
  mattr_accessor :default_sender_name
  @@default_sender_name = nil

  # Default sender email
  mattr_accessor :default_sender_email
  @@default_sender_email = "<EMAIL>"

  #====================================
  # Third Party Plugins
  #====================================
  mattr_accessor :google_tag_container
  @@google_tag_container = nil

  #====================================
  # Layout & Styling
  #====================================
  # Nested structure defining the general style of the application
  mattr_accessor :styleguide
  mattr_accessor :style
  @@styleguide = nil
  @@style = nil

  #====================================
  # Marketplace
  #====================================
  # List of applications that should be offered on
  # the marketplace
  mattr_accessor :marketplace_listing
  @@marketplace_listing = [
    "allocpsa",
    "bugzilla",
    "collabtive",
    "dolibarr",
    "drupal",
    "egroupware",
    "eventbrite",
    "feng-office",
    "front-accounting",
    "group-office",
    "hummingbirdshare",
    "interleave",
    "jenkins",
    "joomla",
    "limesurvey",
    "mantisbt",
    "megaventory",
    "moodle",
    "myob",
    "office-365",
    "opendocman",
    "openerp",
    "openx",
    "orangehrm",
    "pentaho-bi",
    "phreedom",
    "plandora",
    "prestashop",
    "processmaker",
    "projectpier",
    "quickbooks",
    "receipt-bank",
    "signmee",
    "simpleinvoices",
    "so-planning",
    "spotlight-reporting",
    "sugarcrm",
    "timetrex",
    "vtiger6",
    "wordpress"
  ]

  #====================================
  # Module Methods<commit_msg>Add magento<commit_after>require 'prawn'
require 'prawn/table'
require 'money'
require 'deepstruct'
require 'less-rails'
require 'jwt'
require 'jquery-rails'
require 'haml'
require 'countries'
require 'jbuilder'
require 'cancancan'
require 'devise'
require 'devise/strategies/remote_authenticatable'
require "her"
require "her_extension/her_orm_adapter"
require "her_extension/model/orm"
require "her_extension/model/relation"
require "her_extension/model/attributes"
require "her_extension/model/parse"
require "her_extension/model/associations/association"
require "her_extension/model/associations/association_proxy"
require "her_extension/model/associations/has_many_association"
require "her_extension/middleware/mnoe_api_v1_parse_json"
require "mno_enterprise/engine"

require 'mno_enterprise/database_extendable'

require 'mandrill'
require "mandrill_client"

require 'accountingjs_serializer'

module MnoEnterprise

  #==================================================================
  # MnoEnterprise Router
  # Centralizes all URLs available on the Maestrano Enterprise side
  #==================================================================
  class Router
    attr_accessor :terms_url

    def launch_url(id,opts = {})
      host_url("/launch/#{id}",opts)
    end

    def authorize_oauth_url(id,opts = {})
      host_url("/oauth/#{id}/authorize",opts)
    end

    def disconnect_oauth_url(id,opts = {})
      host_url("/oauth/#{id}/disconnect",opts)
    end

    def sync_oauth_url(id,opts = {})
      host_url("/oauth/#{id}/sync",opts)
    end

    def impac_root_url
      URI.join(MnoEnterprise.impac_api_host,MnoEnterprise.impac_api_root_path)
    end

    private
      def base_path
        MnoEnterprise.mno_api_root_path
      end

      def host
        MnoEnterprise.mno_api_host
      end

      def host_url(path,opts = {})
        url = URI.join(host,"#{base_path}#{path}").to_s
        url += "?#{opts.to_query}" if opts.any?
        url
      end
  end

  #==================================================================
  # Module definition
  #==================================================================

  #====================================
  # Tenant
  #====================================
  # Maestrano Enterprise Tenant name
  mattr_accessor :app_name
  @@tenant_name = 'Maestrano Enterprise'

  # Maestrano Enterprise Default Country
  mattr_accessor :app_country
  @@app_country = 'US'

  # Maestrano Enterprise Default Currency
  mattr_accessor :app_currency
  @@app_currency = 'USD'

  # Maestrano Enterprise Tenant ID
  mattr_accessor :tenant_id
  @@tenant_id = nil

  # Maestrano Enterprise Tenant Key
  mattr_accessor :tenant_key
  @@tenant_key = nil

  #====================================
  # Impac
  #====================================
  mattr_accessor :impac_api_host
  @@impac_api_host = 'https://api-impac-uat.maestrano.io'

  mattr_accessor :impac_api_root_path
  @@impac_api_root_path = "/api/v1"

  #====================================
  # Enterprise API
  #====================================
  # The Maestrano Enterprise API Host
  mattr_accessor :mno_api_host
  @@mno_api_host = "https://api-enterprise.maestrano.com"

  # The Maestrano Enterprise API Private Host
  # Used within VPCs for making calls to mno_api using
  # private DNS
  mattr_accessor :mno_api_private_host
  @@mno_api_private_host = nil

  # The Maestrano Enterprise API base path
  mattr_accessor :mno_api_root_path
  @@mno_api_root_path = "/v1"

  # Hold the Her API configuration (see configure_api method)
  mattr_reader :mnoe_api_v1
  @@mnoe_api_v1 = nil

  # Hold the Maestrano enterprise router (redirection to central enterprise platform)
  mattr_reader :router
  @@router = Router.new


  #====================================
  # Emailing
  #====================================
  # Mandrill Key for sending emails
  # Points to the default maestrano enterprise account
  mattr_accessor :mandrill_key
  @@mandrill_key = '<KEY>'

  # The support email address
  mattr_accessor :support_email
  @@support_email = "<EMAIL>"

  # Default sender name
  mattr_accessor :default_sender_name
  @@default_sender_name = nil

  # Default sender email
  mattr_accessor :default_sender_email
  @@default_sender_email = "<EMAIL>"

  #====================================
  # Third Party Plugins
  #====================================
  mattr_accessor :google_tag_container
  @@google_tag_container = nil

  #====================================
  # Layout & Styling
  #====================================
  # Nested structure defining the general style of the application
  mattr_accessor :styleguide
  mattr_accessor :style
  @@styleguide = nil
  @@style = nil

  #====================================
  # Marketplace
  #====================================
  # List of applications that should be offered on
  # the marketplace
  mattr_accessor :marketplace_listing
  @@marketplace_listing = [
    "allocpsa",
    "bugzilla",
    "collabtive",
    "dolibarr",
    "drupal",
    "egroupware",
    "eventbrite",
    "feng-office",
    "front-accounting",
    "group-office",
    "hummingbirdshare",
    "interleave",
    "jenkins",
    "joomla",
    "limesurvey",
    "mantisbt",
    "magento",
    "megaventory",
    "moodle",
    "myob",
    "office-365",
    "opendocman",
    "openerp",
    "openx",
    "orangehrm",
    "pentaho-bi",
    "phreedom",
    "plandora",
    "prestashop",
    "processmaker",
    "projectpier",
    "quickbooks",
    "receipt-bank",
    "signmee",
    "simpleinvoices",
    "so-planning",
    "spotlight-reporting",
    "sugarcrm",
    "timetrex",
    "vtiger6",
    "wordpress"
  ]

  #====================================
  # Module Methods
{'fraction_non_alphanumeric': 0.2285339168490153, 'fraction_numerical': 0.001575492341356674, 'mean_word_length': 4.453937947494033, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '771572', 'n_tokens_mistral': 3727, 'n_tokens_neox': 3539, 'n_words': 711}