Skip to content

Instantly share code, notes, and snippets.

@mosinski
Created March 10, 2020 11:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mosinski/78bd9647968180caad52142cc337773b to your computer and use it in GitHub Desktop.
Save mosinski/78bd9647968180caad52142cc337773b to your computer and use it in GitHub Desktop.
coś takiego:
# frozen_string_literal: true
class Shop::Settings
ALL_TERMINAL_LOCKERS_OPEN_ENABLED = "ALL_TERMINAL_LOCKERS_OPEN_ENABLED"
API_GATEWAY_NAME = "api_gateway_name"
ASSISTANCE_ENABLED = "ASSISTANCE_ENABLED"
CHECK_IN_FREE_LOCKER_ENABLED = "CHECK_IN_FREE_LOCKER_ENABLED"
CHECK_IN_MAILER_ENABLED = "CHECK_IN_MAILER_ENABLED"
CUSTOMER_CAR_SERVICE_SMS_ENABLED = "CUSTOMER_CAR_SERVICE_SMS_ENABLED"
CUSTOMER_EMAILS_ENABLED = "CUSTOMER_EMAILS_ENABLED"
CUSTOMER_EMAIL_MANDATORY_ENABLED = "CUSTOMER_EMAIL_MANDATORY_ENABLED"
CUSTOMER_HOME_CHECK_IN_SMS_ENABLED = "CUSTOMER_HOME_CHECK_IN_SMS_ENABLED"
CUSTOMER_OUTDOOR_CHECK_IN_SMS_ENABLED = "CUSTOMER_OUTDOOR_CHECK_IN_SMS_ENABLED"
CUSTOMER_PHONE_MANDATORY_ENABLED = "CUSTOMER_PHONE_MANDATORY_ENABLED"
CUSTOMER_RENTAL_SMS_ENABLED = "CUSTOMER_RENTAL_SMS_ENABLED"
CUSTOMER_WAITING_PAGE_ENABLED = "CUSTOMER_WAITING_PAGE_ENABLED"
CUSTOMER_CHANGES_MAILER_ENABLED = "CUSTOMER_CHANGES_MAILER_ENABLED"
CUSTOMER_CONTACT_NEW_PAGE_ENABLED = "CUSTOMER_CONTACT_NEW_PAGE_ENABLED"
DATA_SOURCE_TJEKVIK_DASHBOARD_ENABLED = "DATA_SOURCE_TJEKVIK_DASHBOARD_ENABLED"
DEALER_NUMBERS = "DEALER_NUMBERS"
KEEP_USED_APPOINTMENTS_DAYS = "KEEP_USED_APPOINTMENTS_DAYS"
KEEP_PENDING_APPOINTMENTS_DAYS = "KEEP_PENDING_APPOINTMENTS_DAYS"
DEFAULT_CUSTOMER_PHONE = "DEFAULT_CUSTOMER_PHONE"
FINISH_APPOINTMENT_BUTTON_ENABLED = "FINISH_APPOINTMENT_BUTTON_ENABLED"
FORCE_PRODUCTION_BUTTON_ENABLED = "FORCE_PRODUCTION_BUTTON_ENABLED"
HOME_CHECK_IN_ENABLED = "HOME_CHECK_IN_ENABLED"
HOME_CHECK_IN_SEND_SMS_ENABLED = "HOME_CHECK_IN_SEND_SMS_ENABLED"
HOME_CHECKED_IN_REMINDER_SMS_ENABLED = "HOME_CHECKED_IN_REMINDER_SMS_ENABLED"
KIOSK_CAR_SERVICE_CHECK_IN_SUMMARY_ENABLED = "KIOSK_CAR_SERVICE_CHECK_IN_SUMMARY_ENABLED"
KIOSK_CAR_SERVICE_CHECK_OUT_SUMMARY_ENABLED = "KIOSK_CAR_SERVICE_CHECK_OUT_SUMMARY_ENABLED"
KIOSK_IDLE_SECONDS = "KIOSK_IDLE_SECONDS"
KIOSK_LOGIN_VIA_LICENSE_PLATE_ENABLED = "KIOSK_LOGIN_VIA_LICENSE_PLATE_ENABLED"
KIOSK_LOGIN_VIA_BOOKING_CODE_ENABLED = "KIOSK_LOGIN_VIA_BOOKING_CODE_ENABLED"
KIOSK_LOGIN_VIA_PHONE_NUMBER_ENABLED = "KIOSK_LOGIN_VIA_PHONE_NUMBER_ENABLED"
KIOSK_SELF_SERVICE_CHECK_IN_FILTERING_ENABLED = "KIOSK_SELF_SERVICE_CHECK_IN_FILTERING_ENABLED"
KIOSK_TABLE_REMARKS_ENABLED = "KIOSK_TABLE_REMARKS_ENABLED"
KIOSK_PRIVACY_POLICY_ENABLED = "KIOSK_PRIVACY_POLICY_ENABLED"
MODULE_NAME = "module_name"
SMS_PROVIDER_NAME = "sms_provider_name"
NOTIFY_EMAIL_ENABLED = "NOTIFY_EMAIL_ENABLED"
NOTIFY_OUTDOOR_EMAIL_ENABLED = "NOTIFY_OUTDOOR_EMAIL_ENABLED"
OPT_IN_ENABLED = "OPT_IN_ENABLED"
OUTDOOR_APPOINTMENT_CREATION_ENABLED = "OUTDOOR_APPOINTMENT_CREATION_ENABLED"
INDOOR_APPOINTMENT_CREATION_ENABLED = "INDOOR_APPOINTMENT_CREATION_ENABLED"
PAYMENT_REPORT_MAILER_ENABLED = "PAYMENT_REPORT_MAILER_ENABLED"
PDF_SUMMARY_MAILER_ENABLED = "PDF_SUMMARY_MAILER_ENABLED"
PRE_CHECK_IN_CONFIRMATION_ENABLED = "PRE_CHECK_IN_CONFIRMATION_ENABLED"
RENTAL_INFO_PAGE_ENABLED = "RENTAL_INFO_PAGE_ENABLED"
RENTAL_KEY_ENABLED = "RENTAL_KEY_ENABLED"
RENTAL_AGREEMENT_SHOP_MAILER_ENABLED = "RENTAL_AGREEMENT_SHOP_MAILER_ENABLED"
RENTAL_AGREEMENT_CUSTOMER_MAILER_ENABLED = "RENTAL_AGREEMENT_CUSTOMER_MAILER_ENABLED"
REQUIRE_APPOINTMENT_REMARKS_ENABLED = "REQUIRE_APPOINTMENT_REMARKS_ENABLED"
REVIEW_ENABLED = "REVIEW_ENABLED"
SAMTYKKE_DEALER_STANDARD_ENABLED = "SAMTYKKE_DEALER_STANDARD_ENABLED"
SAMTYKKE_ID = "SAMTYKKE_ID"
SATISFACTION_RATE_CHECK_IN_ENABLED = "SATISFACTION_RATE_CHECK_IN_ENABLED"
TEST_DRIVE_PASSWORD = "TEST_DRIVE_PASSWORD"
VEE24_ENABLED = "VEE24_ENABLED"
WORK_LINES_REJECTION_FILTER = "WORK_LINES_REJECTION_FILTER"
CHECK_IN_RE_IMPORT_ENABLED = "CHECK_IN_RE_IMPORT_ENABLED"
KIOSK_CUSTOMER_EDIT_CHECK_ENABLED = "KIOSK_CUSTOMER_EDIT_CHECK_ENABLED"
MARKETING_CONSENT_MAILER_ENABLED = "MARKETING_CONSENT_MAILER_ENABLED"
EXTERNAL_PROVIDER_REQUEST_MAILER_ENABLED = "EXTERNAL_PROVIDER_REQUEST_MAILER_ENABLED"
CUSTOM_APPOINTMENT_INFO_MAILER_ENABLED = "CUSTOM_APPOINTMENT_INFO_MAILER_ENABLED"
TJEKVIK_DISCLOSURE_ENABLED = "TJEKVIK_DISCLOSURE_ENABLED"
SEMLER_IMPORT_ONLY_SERVICE_ADVISOR_REFS = "SEMLER_IMPORT_ONLY_SERVICE_ADVISOR_REFS"
SEMLER_NOT_SUITED_BRANDS = "SEMLER_NOT_SUITED_BRANDS"
SEMLER_SUITED_BRANDS = "SEMLER_SUITED_BRANDS"
CDK_API_SELF_SERVICE_CHECK_WHEN_WAITING_ENABLED = "CDK_API_SELF_SERVICE_CHECK_WHEN_WAITING_ENABLED"
CDK_NOT_SUITED_BRANDS = "CDK_NOT_SUITED_BRANDS"
CDK_CONTRACT_CODE = "CDK_CONTRACT_CODE"
CDK_BUSINESS_UNIT = "CDK_BUSINESS_UNIT"
CDK_CLIENT_ID = "CDK_CLIENT_ID"
CDK_CLIENT_SECRET = "CDK_CLIENT_SECRET"
BILIA_BRANCH_CODE = "BILIA_BRANCH_CODE"
PHRASEAPP_IN_CONTEXT_EDITOR_ENABLED = "PHRASEAPP_IN_CONTEXT_EDITOR_ENABLED"
HOME_CHECK_IN_COMPLETED_NOTIFICATION_ENABLED = "HOME_CHECK_IN_COMPLETED_NOTIFICATION_ENABLED"
UNSCHEDULED_CHECK_IN_COMPLETED_NOTIFICATION_ENABLED = "UNSCHEDULED_CHECK_IN_COMPLETED_NOTIFICATION_ENABLED"
RENTAL_DEDICATED_LOCKER_CAR_ENABLED = "RENTAL_DEDICATED_LOCKER_CAR_ENABLED"
MANAGE_PREPARE_FOR_CHECKOUT_ENABLED = "MANAGE_PREPARE_FOR_CHECKOUT_ENABLED"
AGREEMENT_POPUP_FORWARD_BUTTON_ENABLED = "AGREEMENT_POPUP_FORWARD_BUTTON_ENABLED"
WORK_ORDER_CONTENT_FILTERS = "WORK_ORDER_CONTENT_FILTERS"
WORK_ORDER_BUILDER_CLASS = "WORK_ORDER_BUILDER_CLASS"
KIOSK_CAR_SERVICE_CHECK_IN_INDOOR_2_FACTOR_ENABLED = "KIOSK_CAR_SERVICE_CHECK_IN_INDOOR_2_FACTOR_ENABLED"
KIOSK_CAR_SERVICE_CHECK_IN_INDOOR_2_FACTOR_MOBILE_ENABLED = "KIOSK_CAR_SERVICE_CHECK_IN_INDOOR_2_FACTOR_MOBILE_ENABLED"
RTC_DEALER_ID = "RTC_DEALER_ID"
IMPORT_FILE_CSV_SEPARATOR = "IMPORT_FILE_CSV_SEPARATOR"
def initialize(settings)
@settings = settings || {}
end
def assistance_enabled?
settings.fetch(ASSISTANCE_ENABLED, "true") == "true"
end
def notify_by_email?
settings.fetch(NOTIFY_EMAIL_ENABLED, "true") == "true"
end
alias :notify_email_enabled? :notify_by_email?
def notify_outdoor_email_enabled?
settings.fetch(NOTIFY_OUTDOOR_EMAIL_ENABLED, "false") == "true"
end
def default_customer_phone
settings.fetch(DEFAULT_CUSTOMER_PHONE, "+4530706970")
end
def opt_in_enabled?
settings.fetch(OPT_IN_ENABLED, "false") == "true"
end
def review_enabled?
settings.fetch(REVIEW_ENABLED, "false") == "true"
end
def customer_car_service_sms_enabled?
settings.fetch(CUSTOMER_CAR_SERVICE_SMS_ENABLED, "false") == "true"
end
def customer_rental_sms_enabled?
settings.fetch(CUSTOMER_RENTAL_SMS_ENABLED, "false") == "true"
end
def customer_home_check_in_sms_enabled?
settings.fetch(CUSTOMER_HOME_CHECK_IN_SMS_ENABLED, "false") == "true"
end
def home_checked_in_reminder_sms_enabled?
settings.fetch(HOME_CHECKED_IN_REMINDER_SMS_ENABLED, "false") == "true"
end
def customer_outdoor_check_in_sms_enabled?
settings.fetch(CUSTOMER_OUTDOOR_CHECK_IN_SMS_ENABLED, "false") == "true"
end
def customer_emails_enabled?
settings.fetch(CUSTOMER_EMAILS_ENABLED, "false") == "true"
end
def customer_email_mandatory_enabled?
settings.fetch(CUSTOMER_EMAIL_MANDATORY_ENABLED, "false") == "true"
end
def customer_phone_mandatory_enabled?
settings.fetch(CUSTOMER_PHONE_MANDATORY_ENABLED, "false") == "true"
end
def customer_changes_mailer_enabled?
settings.fetch(CUSTOMER_CHANGES_MAILER_ENABLED, "true") == "true"
end
def customer_contact_new_page_enabled?
settings.fetch(CUSTOMER_CONTACT_NEW_PAGE_ENABLED, "false") == "true"
end
def outdoor_appointment_creation_enabled?
settings.fetch(OUTDOOR_APPOINTMENT_CREATION_ENABLED, "false") == "true"
end
def indoor_appointment_creation_enabled?
settings.fetch(INDOOR_APPOINTMENT_CREATION_ENABLED, "false") == "true"
end
def all_terminal_lockers_open_enabled?
settings.fetch(ALL_TERMINAL_LOCKERS_OPEN_ENABLED, "false") == "true"
end
def module_name_or_default
settings.fetch(MODULE_NAME, "Default")
end
alias :module_name :module_name_or_default
def module_name
settings.fetch(MODULE_NAME, "Default")
end
def sms_provider_name
settings.fetch(SMS_PROVIDER_NAME, "twilio")
end
def api_gateway_name
settings.fetch(API_GATEWAY_NAME, '')
end
def kiosk_idle_seconds
settings.fetch(KIOSK_IDLE_SECONDS, '300')
end
def samtykke_id
settings.fetch(SAMTYKKE_ID, '')
end
def dealer_numbers
settings.fetch(DEALER_NUMBERS, '')
end
def keep_used_appointments_days
settings.fetch(KEEP_USED_APPOINTMENTS_DAYS, '14').to_i
end
def keep_pending_appointments_days
settings.fetch(KEEP_PENDING_APPOINTMENTS_DAYS, '14').to_i
end
def test_drive_password
settings.fetch(TEST_DRIVE_PASSWORD, 'DEMO')
end
def tjekvik_disclosure_enabled?
settings.fetch(TJEKVIK_DISCLOSURE_ENABLED, "false") == "true"
end
def require_appointment_remarks_enabled?
settings.fetch(REQUIRE_APPOINTMENT_REMARKS_ENABLED, "false") == "true"
end
def kiosk_login_via_phone_number_enabled?
settings.fetch(KIOSK_LOGIN_VIA_PHONE_NUMBER_ENABLED, "false") == "true"
end
def kiosk_login_via_license_plate_enabled?
settings.fetch(KIOSK_LOGIN_VIA_LICENSE_PLATE_ENABLED, "true") == "true"
end
def kiosk_login_via_booking_code_enabled?
settings.fetch(KIOSK_LOGIN_VIA_BOOKING_CODE_ENABLED, "false") == "true"
end
def pdf_summary_mailer_enabled?
settings.fetch(PDF_SUMMARY_MAILER_ENABLED, "false") == "true"
end
def check_in_mailer_enabled?
settings.fetch(CHECK_IN_MAILER_ENABLED, "false") == "true"
end
def payment_report_mailer_enabled?
settings.fetch(PAYMENT_REPORT_MAILER_ENABLED, "false") == "true"
end
def home_check_in_enabled?
settings.fetch(HOME_CHECK_IN_ENABLED, "false") == "true"
end
def home_check_in_send_sms_enabled?
settings.fetch(HOME_CHECK_IN_SEND_SMS_ENABLED, "false") == "true"
end
def satisfaction_rate_check_in_enabled?
settings.fetch(SATISFACTION_RATE_CHECK_IN_ENABLED, "false") == "true"
end
def rental_key_enabled?
settings.fetch(RENTAL_KEY_ENABLED, "false") == "true"
end
def rental_dedicated_locker_car_enabled?
settings.fetch(RENTAL_DEDICATED_LOCKER_CAR_ENABLED, "false") == "true"
end
def vee24_enabled?
settings.fetch(VEE24_ENABLED, "false") == "true"
end
def force_production_button_enabled?
settings.fetch(FORCE_PRODUCTION_BUTTON_ENABLED, "false") == "true"
end
def finish_appointment_button_enabled?
settings.fetch(FINISH_APPOINTMENT_BUTTON_ENABLED, "false") == "true"
end
def kiosk_self_service_check_in_filtering_enabled?
settings.fetch(KIOSK_SELF_SERVICE_CHECK_IN_FILTERING_ENABLED, "false") == "true"
end
def kiosk_car_service_check_in_summary_enabled?
settings.fetch(KIOSK_CAR_SERVICE_CHECK_IN_SUMMARY_ENABLED, "false") == "true"
end
def kiosk_car_service_check_out_summary_enabled?
settings.fetch(KIOSK_CAR_SERVICE_CHECK_OUT_SUMMARY_ENABLED, "false") == "true"
end
def check_in_free_locker_enabled?
settings.fetch(CHECK_IN_FREE_LOCKER_ENABLED, "false") == "true"
end
def data_source_tjekvik_dashboard_enabled?
settings.fetch(DATA_SOURCE_TJEKVIK_DASHBOARD_ENABLED, "false") == "true"
end
def kiosk_table_remarks_enabled?
settings.fetch(KIOSK_TABLE_REMARKS_ENABLED, "false") == "true"
end
def rental_info_page_enabled?
settings.fetch(RENTAL_INFO_PAGE_ENABLED, "false") == "true"
end
def rental_agreement_shop_mailer_enabled?
settings.fetch(RENTAL_AGREEMENT_SHOP_MAILER_ENABLED, "false") == "true"
end
def rental_agreement_customer_mailer_enabled?
settings.fetch(RENTAL_AGREEMENT_CUSTOMER_MAILER_ENABLED, "false") == "true"
end
def customer_waiting_page_enabled?
settings.fetch(CUSTOMER_WAITING_PAGE_ENABLED, "false") == "true"
end
def samtykke_dealer_standard_enabled?
settings.fetch(SAMTYKKE_DEALER_STANDARD_ENABLED, "true") == "true"
end
def pre_check_in_confirmation_enabled?
settings.fetch(PRE_CHECK_IN_CONFIRMATION_ENABLED, "false") == "true"
end
def check_in_re_import_enabled?
settings.fetch(CHECK_IN_RE_IMPORT_ENABLED, "false") == "true"
end
def kiosk_customer_edit_check_enabled?
settings.fetch(KIOSK_CUSTOMER_EDIT_CHECK_ENABLED, "false") == "true"
end
def kiosk_privacy_policy_enabled?
settings.fetch(KIOSK_PRIVACY_POLICY_ENABLED, "false") == "true"
end
def cdk_contract_code
settings.fetch(CDK_CONTRACT_CODE, nil)
end
def cdk_business_unit
settings.fetch(CDK_BUSINESS_UNIT, nil)
end
def bilia_branch_code
settings.fetch(BILIA_BRANCH_CODE, nil)
end
def work_lines_rejection_filter
settings.fetch(WORK_LINES_REJECTION_FILTER, nil)
end
def semler_import_only_service_advisor_refs
settings.fetch(SEMLER_IMPORT_ONLY_SERVICE_ADVISOR_REFS, "").split(",")
end
def semler_not_suited_brands
JSON.parse(settings.fetch(SEMLER_NOT_SUITED_BRANDS, "[]"))
end
def semler_suited_brands
JSON.parse(settings.fetch(SEMLER_SUITED_BRANDS, "[]"))
end
def work_order_content_filters
JSON.parse(settings.fetch(WORK_ORDER_CONTENT_FILTERS, "[]"))
end
def marketing_consent_mailer_enabled?
settings.fetch(MARKETING_CONSENT_MAILER_ENABLED, "true") == "true"
end
def external_provider_request_mailer_enabled?
settings.fetch(EXTERNAL_PROVIDER_REQUEST_MAILER_ENABLED, "true") == "true"
end
def custom_appointment_info_mailer_enabled?
settings.fetch(CUSTOM_APPOINTMENT_INFO_MAILER_ENABLED, "true") == "true"
end
def phraseapp_in_context_editor_enabled?
settings.fetch(PHRASEAPP_IN_CONTEXT_EDITOR_ENABLED, "false") == "true"
end
def cdk_api_self_service_check_when_waiting_enabled?
settings.fetch(CDK_API_SELF_SERVICE_CHECK_WHEN_WAITING_ENABLED, "false") == "true"
end
def cdk_not_suited_brands # Car Brand names not suited for self service check in
settings.fetch(CDK_NOT_SUITED_BRANDS, '').split(';')
end
def home_check_in_completed_notification_enabled?
settings.fetch(HOME_CHECK_IN_COMPLETED_NOTIFICATION_ENABLED, "false") == "true"
end
def unscheduled_check_in_completed_notification_enabled?
settings.fetch(UNSCHEDULED_CHECK_IN_COMPLETED_NOTIFICATION_ENABLED, "false") == "true"
end
def manage_prepare_for_checkout_enabled?
settings.fetch(MANAGE_PREPARE_FOR_CHECKOUT_ENABLED, "false") == "true"
end
def cdk_client_id
settings.fetch(CDK_CLIENT_ID, "")
end
def cdk_client_secret
settings.fetch(CDK_CLIENT_SECRET, "")
end
def work_order_builder_class
settings.fetch(WORK_ORDER_BUILDER_CLASS, nil)
end
def kiosk_car_service_check_in_indoor_2_factor_enabled?
settings.fetch(KIOSK_CAR_SERVICE_CHECK_IN_INDOOR_2_FACTOR_ENABLED, "false") == "true"
end
def kiosk_car_service_check_in_indoor_2_factor_mobile_enabled?
settings.fetch(KIOSK_CAR_SERVICE_CHECK_IN_INDOOR_2_FACTOR_MOBILE_ENABLED, "false") == "true"
end
def agreement_popup_forward_button_enabled?
settings.fetch(AGREEMENT_POPUP_FORWARD_BUTTON_ENABLED, "false") == "true"
end
def rtc_dealer_id
settings.fetch(RTC_DEALER_ID, nil)
end
def import_file_csv_separator
settings.fetch(IMPORT_FILE_CSV_SEPARATOR, ";")
end
private
attr_reader :settings
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment