REFACTOR: Use models to store data (#11)

* REFACTOR: Use api to add subscribe link

* FIX: I18n subscribe link

* REFACTOR: Use models to store some data

This enables the plugin to show only subscription information which was
generated on Discourse. Subscription data storage is limited to the
external identifiers Stripe generates so we can interact with the API.

* DEV: Test/linting fixes/rake task
This commit is contained in:
Justin DiRose
2020-05-22 11:20:05 -05:00
committed by GitHub
parent 7ba08ab7da
commit fb4fac197b
47 changed files with 308 additions and 225 deletions
+2
View File
@@ -6,6 +6,8 @@ module DiscourseSubscriptions
scope :find_user, ->(user) { find_by_user_id(user.id) }
has_many :subscriptions
def self.create_customer(user, customer)
create(customer_id: customer[:id], user_id: user.id)
end
+6
View File
@@ -0,0 +1,6 @@
# frozen_string_literal: true
module DiscourseSubscriptions
class Product < ActiveRecord::Base
end
end
+7
View File
@@ -0,0 +1,7 @@
# frozen_string_literal: true
module DiscourseSubscriptions
class Subscription < ActiveRecord::Base
belongs_to :customer
end
end