Skip to content

Conversation

@pilaf
Copy link
Collaborator

@pilaf pilaf commented May 12, 2023

@marquete @turino

This PR adds an option that affects the way the library behaves when dealing with unsatisfiable queries:

FmRest::Spyke.on_unsatisifiable_query = :return_silent
Contact.query(first_name: "Jacob").and(first_name: "marquete")
# => [] (no Data API request sent)
Contact.query(first_name: "Jacob").and(first_name: "marquete").or(first_name: "Jacob")
# -> issues a Data API request with first_name: "Jacob"

FmRest::Spyke.on_unsatisifiable_query = :request_silent
Contact.query(first_name: "Jacob").and(first_name: "marquete")
# -> issues a Data API request with first_name: "1001..1000"

FmRest::Spyke.on_unsatisifiable_query = :raise
Contact.query(first_name: "Jacob").and(first_name: "marquete")
# -> UnsatisfiableQuery error

Other options not showcased above are :return_warn and :request_warn, which will do the same as the first two examples, but also printing a warn() message.

This is missing updated specs and documentation, but I'd like your general input.

@pilaf pilaf requested a review from marquete May 12, 2023 11:32
Copy link
Collaborator

@marquete marquete left a comment

Choose a reason for hiding this comment

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

Looks great!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants