Skip to content

Instantly share code, notes, and snippets.

View thorwebdev's full-sized avatar
🔨
building

Thor 雷神 Schaeff thorwebdev

🔨
building
View GitHub Profile
<table>
<% @c.each do |customer| %>
<tr>
<td><%= customer.id %><td>
<td><%= customer.email %></td>
<td><a href="../customer/<%= customer.id %>">Subscriptions [<%= customer.subscriptions.total_count %>] </a></td>
</tr>
<% end %>
</table>
get '/customer/:cid' do
# Output params hash in bash
puts params.inspect
# Retrieve customer ID from params hash
cid = params[:cid]
# Retrieve customer object from Stripe API
# Store customer object in an instance variable
@customer = Stripe::Customer.retrieve(cid)
<h1><%= @customer.email %> // <%= @customer.id %></h1>
<h2># Subscriptions: <%= @customer.subscriptions.total_count %></h2>
<ol>
<% @customer.subscriptions.each do |sub| %>
<li><%= sub.plan.name %></li>
<%end%>
</ol>