Skip to content

Instantly share code, notes, and snippets.

@lgs
Created December 19, 2014 20:39
Show Gist options
  • Save lgs/cc8a8be99348a4157b32 to your computer and use it in GitHub Desktop.
Save lgs/cc8a8be99348a4157b32 to your computer and use it in GitHub Desktop.
#### Rails s with Pry debugger
Started GET "/sub" for 127.0.0.1 at 2014-12-19 21:15:57 +0100
Processing by PagesController#sub as HTML
User Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? ORDER BY "users"."id" ASC LIMIT 1 [["id", 2]]
SubscriptionPlan Load (0.1ms) SELECT "subscription_plans".* FROM "subscription_plans" WHERE "subscription_plans"."id" = ? LIMIT 1 [["id", 1]]
From: /home/lsoave/Github/querier/app/controllers/pages_controller.rb @ line 22 PagesController#sub:
16: def sub
17: owner ||= current_user
18:
19: params[:plan_id] = 1
20: params[:plan] = SubscriptionPlan.find_by(id: params[:plan_id])
21:
=> 22: binding.pry
23:
24: subscription = Payola::CreateSubscription.call(params, owner)
25: render_payola_status(subscription)
26: end
[1] pry(#<PagesController>)> params
=> {"controller"=>"pages",
"action"=>"sub",
"plan_id"=>1,
"plan"=>
#<SubscriptionPlan:0x007f2e10627fb0
id: 1,
amount: 1000,
interval: "month",
stripe_id: "test-plan",
name: "Test Plan",
interval_count: nil,
trial_period_days: nil,
created_at: Fri, 19 Dec 2014 15:12:03 UTC +00:00,
updated_at: Fri, 19 Dec 2014 15:12:03 UTC +00:00>}
[2] pry(#<PagesController>)> owner
=> #<User:0x007f2e105169f0
id: 2,
email: "[email protected]",
encrypted_password: "11111111111111111111111111111111111111",
admin: false,
locked: false,
reset_password_token: "11111111111111111111111111111111111111",
reset_password_sent_at: Fri, 19 Dec 2014 16:52:17 UTC +00:00,
remember_created_at: nil,
sign_in_count: 2,
current_sign_in_at: Fri, 19 Dec 2014 16:59:30 UTC +00:00,
last_sign_in_at: Fri, 19 Dec 2014 16:59:11 UTC +00:00,
current_sign_in_ip: "127.0.0.1",
last_sign_in_ip: "127.0.0.1",
confirmation_token: nil,
confirmed_at: Fri, 19 Dec 2014 16:58:58 UTC +00:00,
confirmation_sent_at: Fri, 19 Dec 2014 16:52:51 UTC +00:00,
unconfirmed_email: nil,
created_at: Fri, 19 Dec 2014 14:47:14 UTC +00:00,
updated_at: Fri, 19 Dec 2014 16:59:30 UTC +00:00>
[3] pry(#<PagesController>)> params[:plan_id]
=> 1
[4] pry(#<PagesController>)> params[:plan]
=> #<SubscriptionPlan:0x007f2e10627fb0
id: 1,
amount: 1000,
interval: "month",
stripe_id: "test-plan",
name: "Test Plan",
interval_count: nil,
trial_period_days: nil,
created_at: Fri, 19 Dec 2014 15:12:03 UTC +00:00,
updated_at: Fri, 19 Dec 2014 15:12:03 UTC +00:00>
[5] pry(#<PagesController>)> subscription = Payola::CreateSubscription.call(params, owner)
(0.1ms) begin transaction
Payola::Subscription Exists (0.1ms) SELECT 1 AS one FROM "payola_subscriptions" WHERE "payola_subscriptions"."guid" IS NULL LIMIT 1
(0.1ms) rollback transaction
=> #<Payola::Subscription:0x007f2e25161278
id: nil,
plan_type: "SubscriptionPlan",
plan_id: 1,
start: nil,
status: nil,
owner_type: "User",
owner_id: 2,
stripe_customer_id: nil,
cancel_at_period_end: nil,
current_period_start: nil,
current_period_end: nil,
ended_at: nil,
trial_start: nil,
trial_end: nil,
canceled_at: nil,
quantity: nil,
stripe_id: nil,
stripe_token: nil,
card_last4: nil,
card_expiration: nil,
card_type: nil,
error: nil,
state: "pending",
email: nil,
created_at: nil,
updated_at: nil,
currency: "usd",
amount: 1000,
guid: nil,
stripe_status: nil,
affiliate_id: nil,
coupon: nil,
signed_custom_fields: nil,
customer_address: nil,
business_address: nil,
setup_fee: nil>
[6] pry(#<PagesController>)> render_payola_status(subscription)
=> ["{\"guid\":null,\"status\":\"pending\",\"error\":\"Email can't be blank and Stripe token can't be blank\"}"]
[7] pry(#<PagesController>)>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment