Skip to content

Instantly share code, notes, and snippets.

@belison
Created August 18, 2016 20:45
Show Gist options
  • Select an option

  • Save belison/9407e6b52e4a90e12a18f2a81025c0b0 to your computer and use it in GitHub Desktop.

Select an option

Save belison/9407e6b52e4a90e12a18f2a81025c0b0 to your computer and use it in GitHub Desktop.
iex(2)> {:ok, r} = Api.Service.Recommendation.get(q, %{feature_mixes: true}, 8, nil, ["prod"])
{:ok,
[%{author: 207719,
canonical_url: "http://onpurple.com/blog/which-famous-person-shares-sleeping-habits-quiz/",
featured_priority: 1, id: 253597,
image: "https://movement-prod.imgix.net/uploads/6d/8d89d730e148af8e9123d1bb403b86/upload.jpeg",
organization: 849,
title: "Which famous person shares your sleeping habits?", type: "quiz"},
%{author: 207719,
canonical_url: "https://www.boombox.com/c/quiz/252084/what-s-your-olympic-sport-cde0a5a8-d227-4fd9-823e-01b900741df4",
featured_priority: nil, id: 252084,
image: "https://movement-prod.imgix.net/uploads/67/bc487644704c8c98c334a4cb5d9184/upload.jpg",
organization: 849, title: "What's your Olympic sport?", type: "quiz"},
%{author: 207719,
canonical_url: "http://onpurple.com/blog/better-sleep-tonight-quiz/",
featured_priority: nil, id: 253643,
image: "https://movement-prod.imgix.net/uploads/4e/d428685120427d8e8e569afeb03854/e034b90620f51c2ad65a5854e44c4492e374e6c818b5164191f3c37ba0e4_960.jpg",
organization: 849, title: "Want better sleep tonight? Take this quiz",
type: "quiz"}]}
iex(3)> Api.Service.Organization.first(ancestor_of: 849, parent_id: nil, cache: true)
{:ok,
%Api.Service.Organization{__meta__: #Ecto.Schema.Metadata<:loaded>,
created_at: #Api.DB.DateTime<2016-08-04T17:58:35Z>, disable_labs: false,
display_name: "Purple", id: 849,
image_url: "https://movement-prod.imgix.net/uploads/07/32d453b0d044ea9e62655b98d9a31f/upload.jpg",
name: "Purple", parent_id: nil, settings: nil, slug: nil,
subscription_id: 216319, twitter_handle: nil,
updated_at: #Api.DB.DateTime<2016-08-04T18:00:29.445Z>}}
iex(4)> Api.Service.Subscription.get_cached(216319)
{:ok,
%{billing_email: "bryant@onpurple.com",
created_at: #Api.DB.DateTime<2016-08-04T18:00:26.148Z>, expired_plan_id: nil,
expires_at: nil, has_trialled: false, id: 216319, is_paying: false,
plan_id: 90, prev_plan_id: nil, purchased_at: nil,
stripe_subscription_token: nil, stripe_token: nil, temp_stripe_token: nil,
updated_at: #Api.DB.DateTime<2016-08-04T18:00:26.148Z>}}
iex(5)> {:ok, p} = Api.Service.Plan.get_cached(90)
{:ok,
%{created_at: #Api.DB.DateTime<2015-07-09T20:31:11.921Z>,
description: "This plan is just for our Inner Circle customers to give them a preview of Boombox features and functionality.",
feature_adv_customization: true, feature_adv_display: true,
feature_adv_share: true, feature_adv_stats: false,
feature_boombox_branded: true, feature_boost: true,
feature_custom_meta: true, feature_custom_share: true,
feature_download_embed: false, feature_export_responses: true,
feature_font_face: true, feature_mixes: true, feature_offers: true,
feature_organization_admins: true, feature_organizations: true,
feature_qzzr_legacy: false, feature_reduced_branding: true,
feature_white_label: true, id: 90, is_active: false, is_default: false,
is_upgradeable: false, max_engagements: 0, name: "Boombox Inner Circle",
price: 0.0, stripe_identifier: nil,
subscriptions: #Ecto.Association.NotLoaded<association :subscriptions is not loaded>,
updated_at: #Api.DB.DateTime<2016-08-04T17:31:56.128Z>}}
iex(6)> {:ok, r} = Api.Service.Recommendation.get(q, p, 8, nil, ["prod"])
{:ok,
[%{author: 207719,
canonical_url: "http://onpurple.com/blog/which-famous-person-shares-sleeping-habits-quiz/",
featured_priority: 1, id: 253597,
image: "https://movement-prod.imgix.net/uploads/6d/8d89d730e148af8e9123d1bb403b86/upload.jpeg",
organization: 849,
title: "Which famous person shares your sleeping habits?", type: "quiz"},
%{author: 207719,
canonical_url: "https://www.boombox.com/c/quiz/252084/what-s-your-olympic-sport-cde0a5a8-d227-4fd9-823e-01b900741df4",
featured_priority: nil, id: 252084,
image: "https://movement-prod.imgix.net/uploads/67/bc487644704c8c98c334a4cb5d9184/upload.jpg",
organization: 849, title: "What's your Olympic sport?", type: "quiz"},
%{author: 207719,
canonical_url: "http://onpurple.com/blog/better-sleep-tonight-quiz/",
featured_priority: nil, id: 253643,
image: "https://movement-prod.imgix.net/uploads/4e/d428685120427d8e8e569afeb03854/e034b90620f51c2ad65a5854e44c4492e374e6c818b5164191f3c37ba0e4_960.jpg",
organization: 849, title: "Want better sleep tonight? Take this quiz",
type: "quiz"}]}
iex(7)> q
%{accent_color: "#4d306a", background_hex: "#54d3d1", calc_embedded_url: nil,
cloned_from_id: 252395, created_at: #Api.DB.DateTime<2016-08-10T09:27:22Z>,
custom_share_image_properties: nil, custom_share_image_url: nil,
custom_share_text: nil, deleted_at: nil,
description: "<p>Oh, to be a kid... Those little brats can sleep through anything, right? Remember when the biggest stress you had was whether your favorite cartoon would be on after school? We understand.</p><p>Well, there are a boatload of simple things you can do to catch better ZZZs, but let us determine what might be the most effective for you.</p>",
displays_mix: true, featured_priority: nil, font_face: nil, font_family: nil,
has_custom_share_text: false, has_updates: false, hide_bg_overlay: false,
hide_times_taken: false, id: 253643, image_bg_position: nil,
image_properties: nil,
image_url: "https://movement-prod.imgix.net/uploads/4e/d428685120427d8e8e569afeb03854/e034b90620f51c2ad65a5854e44c4492e374e6c818b5164191f3c37ba0e4_960.jpg",
include_attribution: false, inverted_text: false, is_active: true,
is_featured: false, is_mixed: true, is_private: false,
offers_are_active: true, organization_id: 849,
published_at: #Api.DB.DateTime<2016-08-16T03:46:00Z>,
questions: #Ecto.Association.NotLoaded<association :questions is not loaded>,
random_order: false,
share_url: "http://onpurple.com/blog/better-sleep-tonight-quiz/",
show_results_per_question: false, skip_start: true,
slug: "make-one-change-and-kick-bad-sleep-square-in-the-teeth-copy",
social_networks: nil, submit_required: false,
title: "Want better sleep tonight? Take this quiz",
track_stats_from: #Api.DB.DateTime<2016-08-10T09:27:00Z>,
twitter_postfix: "@LifeOnPurple", type: "OutcomeQuiz",
updated_at: #Api.DB.DateTime<2016-08-17T16:54:38.704Z>, use_page_meta: false,
user_id: 207719}
iex(8)> {:ok, r} = Api.Service.Recommendation.get(q, p, 6, nil, ["prod"])
{:ok,
[%{author: 207719,
canonical_url: "http://onpurple.com/blog/which-famous-person-shares-sleeping-habits-quiz/",
featured_priority: 1, id: 253597,
image: "https://movement-prod.imgix.net/uploads/6d/8d89d730e148af8e9123d1bb403b86/upload.jpeg",
organization: 849,
title: "Which famous person shares your sleeping habits?", type: "quiz"},
%{author: 207719,
canonical_url: "https://www.boombox.com/c/quiz/252084/what-s-your-olympic-sport-cde0a5a8-d227-4fd9-823e-01b900741df4",
featured_priority: nil, id: 252084,
image: "https://movement-prod.imgix.net/uploads/67/bc487644704c8c98c334a4cb5d9184/upload.jpg",
organization: 849, title: "What's your Olympic sport?", type: "quiz"},
%{author: 207719,
canonical_url: "http://onpurple.com/blog/better-sleep-tonight-quiz/",
featured_priority: nil, id: 253643,
image: "https://movement-prod.imgix.net/uploads/4e/d428685120427d8e8e569afeb03854/e034b90620f51c2ad65a5854e44c4492e374e6c818b5164191f3c37ba0e4_960.jpg",
organization: 849, title: "Want better sleep tonight? Take this quiz",
type: "quiz"}]}
iex(9)> exit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment