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

Allow funnel token to carry application context information #4

Merged
merged 2 commits into from
Dec 15, 2016

Conversation

rstawarz
Copy link
Member

A funnel can now be generated with extra context information that will
be retained through out it's use. This data can be useful for
applications wanting to carry around extra information outside of the
URL params.

Copy link

@dzajic dzajic left a comment

Choose a reason for hiding this comment

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

LGTM, but I'd update the README to document the new feature.

@@ -30,14 +30,17 @@ def from_token(token:)
raise InvalidTokenError, "Invalid token '#{token}': #{e.message}"
end

def build(route_generator:, params: {}, expires_in_days: nil)
def build(route_generator:, params: {}, expires_in_days: nil, context: {})
Copy link
Member

Choose a reason for hiding this comment

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

I think meta is a better name than context here, context maybe should be the key something inside the meta hash...Thinking of the way we could/will use this in the future (tracking, auth, trigger actions, set flash messages etc), it should be a bit more abstract.

I agree that the current app-side implementation of context is a little clunky, ie:

-    funnel = Funneler.from_routes(routes: routes)
+    funnel = Funneler.from_routes(routes: routes,
+                                  context: { funnel_name: Funnels::PendingInvitesStue.name })

Default contextual information (like the funnel name) should be added to Funnels::Base and perhaps the more information can be captured here in the constructor, eg, context.reverse_merge!(caller: caller.last)

A funnel can now be generated with extra `meta` information that will
be retained through out it's use.  This data can be useful for
applications wanting to carry around extra information outside of the
URL params.
@rstawarz rstawarz force-pushed the rs_allow_funnel_to_cary_context branch from 56f4910 to 99f6db2 Compare December 14, 2016 19:51
@rstawarz rstawarz merged commit 26d6331 into master Dec 15, 2016
@jmonteiro jmonteiro deleted the rs_allow_funnel_to_cary_context branch February 5, 2020 01:27
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