Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make rules engine code public #612

Merged
merged 6 commits into from
Apr 27, 2021
Merged

make rules engine code public #612

merged 6 commits into from
Apr 27, 2021

Conversation

shalehaha
Copy link
Contributor

@shalehaha shalehaha commented Apr 22, 2021

Description

  1. Make LaunchRulesEngine public, with methods:
    • public func replaceRules(with rules: [LaunchRule])
    • public func process(event: Event) -> Event
    • func replaceRules(from urlString: String)
    • func replaceRulesWithCache(from urlString: String)
  2. Make JSONRulesParser public
  3. Make LaunchRule and RuleConsequnce class public.

Related Issue

Motivation and Context

How Has This Been Tested?

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • I have signed the Adobe Open Source CLA.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@codecov
Copy link

codecov bot commented Apr 22, 2021

Codecov Report

Merging #612 (cd3c164) into dev-v3.1.2 (593a39d) will decrease coverage by 0.05%.
The diff coverage is 83.61%.

@@              Coverage Diff               @@
##           dev-v3.1.2     #612      +/-   ##
==============================================
- Coverage       85.32%   85.27%   -0.05%     
==============================================
  Files             102      104       +2     
  Lines            4571     4570       -1     
==============================================
- Hits             3900     3897       -3     
- Misses            671      673       +2     


/// A rules engine for Launch rules
class LaunchRulesEngine {
private let LOG_TAG = "\(RulesConstants.LOG_MODULE_PREFIX) - LaunchRulesEngine"
public class LaunchRulesEngine {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need to find a better name for LaunchRulesEngine

public struct RuleConsequence {
let id: String
let type: String
var detailDict: [String: Any?]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we change this var name to details?

@@ -0,0 +1,24 @@
/*
Copyright 2020 Adobe. All rights reserved.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2021


init(name: String, extensionRuntime: ExtensionRuntime) {
public init(name: String, extensionRuntime: ExtensionRuntime) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would be good to get some in-code documentation here, especially for public apis

}

guard let rules = JSONRulesParser.parse(data) else {
return
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need to combine guards and print log.

@shalehaha shalehaha changed the title Rules make rules engine code public Apr 26, 2021
@shalehaha shalehaha merged commit 18d463f into adobe:dev-v3.1.2 Apr 27, 2021
@shalehaha shalehaha linked an issue Apr 29, 2021 that may be closed by this pull request
@shalehaha shalehaha added this to the v3.1.2 milestone Apr 29, 2021
@shalehaha shalehaha added coresquad enhancement New feature or request labels Apr 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
coresquad enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

share rules engine code with messaging and campaign extension
4 participants