$ git checkout master
$ git fetch --all --prune
$ git rebase origin/master
$ git checkout my-feature-branch
$ git rebase master
# These are "behind-the-scenes" setup tasks that must happen before we can | |
# start syncing invoice data to NetSuite. | |
# We'll call these "Groups" for now. These are shown to the user in the UI: | |
# | |
# ( ) Validating NetSuite Credentials | |
# ( ) Gathering Data from NetSuite | |
# ( ) Creating Custom Fields in NetSuite | |
[ |
###### New Business | |
transactions: [ | |
Charge.new( | |
product_id: 1, | |
component_id: nil, | |
kind: "baseline", | |
amount_in_cents: 100_00, | |
memo: "Essential", | |
), | |
Charge.new( |
# Customer Signs up | |
# $100 Advanced (Product) | |
# $50 Minutes (Component) | |
# | |
# -$10 Coupon One (Single Use) | |
# -$20 Coupon Two (Multi Use) | |
Sale.new( | |
sale_amount_in_cents: 150_00, | |
discount_amount_in_cents: -30_00, |
# User signs up for 'free' and adds 'ip_addresses' (3 units) | |
# Datapoint1 | |
# subcription.items: | |
[ | |
{ | |
product_id: free.id, | |
component_id: ip_addresses.id, | |
name: "IP Addresses", | |
mrr: 30_00, | |
mrr_movements: [{ amount: 30_00, category: "new_business" }], |
# | |
# August 2017 | |
# - Customer 2 renewal (+$35 plan, -$40 usage, -$5 net) overall contraction | |
# - Customer 3 renewal (+$50 plan, -$40 usage, +$10 net) overall expansion | |
# - Customer 4 renewal (-$50 plan, +$30 usage, -$20 net) overall contraction | |
# | |
# August | |
# expansion | |
# ------------ | |
# plan 85 |
module MRR::Datapoint | |
# This class generates the `recurring_movement` object for an MRR datapoint. | |
class RecurringMovement | |
def initialize(datapoint, previous_datapoint) | |
@datapoint = datapoint | |
@previous_datapoint = previous_datapoint | |
end | |
def build | |
{ |
Details: | |
https://devcenter.heroku.com/articles/heroku-postgres-backups | |
$ heroku pg:backups capture #=> <backup_number> | |
$ heroku pg:backups public-url <backup_number> #=> <backup_url> | |
$ curl -o latest.dump <backup_url> | |
(drop and re-create local database) | |
$ pg_restore --verbose --clean --no-acl --no-owner -h localhost -U myuser -d mydb latest.dump |
# models/feature.rb | |
class Feature | |
validates :name, presence: true, uniqueness: true | |
end | |
# models/feature_provider.rb | |
class FeatureProvider | |
belongs_to :feature | |
belongs_to :provider, polymorphic: true | |