disco_app 0.11.1 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/components/shopify/image/_image.scss +82 -0
  3. data/app/assets/components/shopify/table/_table.scss +18 -0
  4. data/app/assets/javascripts/disco_app/components/custom/rules-editor.es6.jsx +2 -2
  5. data/app/assets/javascripts/disco_app/components/ui-kit/icons/next-icon.es6.jsx +3 -2
  6. data/app/assets/stylesheets/disco_app/disco_app.scss +2 -0
  7. data/app/assets/stylesheets/disco_app/ui-kit/_ui-kit.scss +5 -0
  8. data/app/jobs/disco_app/shop_job.rb +1 -1
  9. data/app/models/disco_app/concerns/has_metafields.rb +1 -1
  10. data/app/models/disco_app/concerns/renders_assets.rb +3 -3
  11. data/app/models/disco_app/concerns/shop.rb +3 -1
  12. data/app/models/disco_app/concerns/synchronises.rb +1 -1
  13. data/app/services/disco_app/charges_service.rb +3 -3
  14. data/app/views/disco_app/shared/_icons.html.erb +1 -1
  15. data/db/migrate/20150525000000_create_shops_if_not_existent.rb +102 -7
  16. data/lib/disco_app/version.rb +1 -1
  17. data/lib/generators/disco_app/disco_app_generator.rb +30 -33
  18. data/test/dummy/app/models/disco_app/shop.rb +5 -0
  19. data/test/fixtures/carts.yml +1 -1
  20. data/test/fixtures/products.yml +1 -1
  21. data/test/models/disco_app/has_metafields_test.rb +2 -2
  22. data/test/services/disco_app/subscription_service_test.rb +2 -2
  23. data/test/test_helper.rb +2 -0
  24. metadata +166 -89
  25. data/db/migrate/20150525162112_add_status_to_shops.rb +0 -5
  26. data/db/migrate/20150525171422_add_meta_to_shops.rb +0 -11
  27. data/db/migrate/20150629210346_add_charge_status_to_shop.rb +0 -5
  28. data/db/migrate/20150814214025_add_more_meta_to_shops.rb +0 -15
  29. data/db/migrate/20151017231302_create_disco_app_plans.rb +0 -13
  30. data/db/migrate/20151017232027_create_disco_app_subscriptions.rb +0 -15
  31. data/db/migrate/20151017234409_move_shop_to_disco_app_engine.rb +0 -5
  32. data/db/migrate/20160112233706_create_disco_app_sessions.rb +0 -12
  33. data/db/migrate/20160113194418_add_shop_id_to_disco_app_sessions.rb +0 -6
  34. data/db/migrate/20160223111044_create_disco_app_settings.rb +0 -8
  35. data/db/migrate/20160301223215_update_plans.rb +0 -22
  36. data/db/migrate/20160301224558_update_subscriptions.rb +0 -13
  37. data/db/migrate/20160302104816_create_disco_app_recurring_application_charges.rb +0 -14
  38. data/db/migrate/20160302105259_create_disco_app_application_charges.rb +0 -14
  39. data/db/migrate/20160302134728_drop_charge_status_from_shops.rb +0 -5
  40. data/db/migrate/20160302142941_add_shopify_attributes_to_charges.rb +0 -8
  41. data/db/migrate/20160331093148_create_disco_app_plan_codes.rb +0 -14
  42. data/db/migrate/20160401044420_add_status_to_plan_codes.rb +0 -5
  43. data/db/migrate/20160401045551_add_amount_and_plan_code_to_disco_app_subscriptions.rb +0 -7
  44. data/db/migrate/20160425205211_add_source_to_disco_app_subscriptions.rb +0 -5
  45. data/db/migrate/20160426033520_add_trial_period_days_to_disco_app_subscriptions.rb +0 -5
  46. data/db/migrate/20160513140727_add_name_to_disco_app_shops.rb +0 -5
  47. data/db/migrate/20160521135510_move_shop_to_synchronises.rb +0 -61
@@ -1,22 +0,0 @@
1
- class UpdatePlans < ActiveRecord::Migration
2
- def change
3
- remove_column :disco_app_plans, :default_price, :decimal
4
- rename_column :disco_app_plans, :default_trial_days, :trial_period_days
5
- rename_column :disco_app_plans, :charge_type, :plan_type
6
- add_column :disco_app_plans, :amount, :integer, default: 0
7
- add_column :disco_app_plans, :currency, :string, default: 'USD'
8
- add_column :disco_app_plans, :interval, :integer, default: 0
9
- add_column :disco_app_plans, :interval_count, :integer, default: 1
10
-
11
- reversible do |direction|
12
- direction.up do
13
- change_column :disco_app_plans, :plan_type, :integer, default: 0
14
- change_column :disco_app_plans, :status, :integer, default: 0
15
- end
16
- direction.down do
17
- change_column :disco_app_plans, :plan_type, :integer
18
- change_column :disco_app_plans, :status, :integer
19
- end
20
- end
21
- end
22
- end
@@ -1,13 +0,0 @@
1
- class UpdateSubscriptions < ActiveRecord::Migration
2
- def change
3
- remove_column :disco_app_subscriptions, :name, :string
4
- remove_column :disco_app_subscriptions, :price, :decimal
5
- remove_column :disco_app_subscriptions, :trial_days, :integer
6
-
7
- rename_column :disco_app_subscriptions, :charge_type, :subscription_type
8
-
9
- add_column :disco_app_subscriptions, :trial_start_at, :datetime, null: true
10
- add_column :disco_app_subscriptions, :trial_end_at, :datetime, null: true
11
- add_column :disco_app_subscriptions, :cancelled_at, :datetime, null: true
12
- end
13
- end
@@ -1,14 +0,0 @@
1
- class CreateDiscoAppRecurringApplicationCharges < ActiveRecord::Migration
2
- def change
3
- create_table :disco_app_recurring_application_charges do |t|
4
- t.integer :shop_id, limit: 8
5
- t.integer :subscription_id, limit: 8
6
- t.integer :status, default: 0
7
-
8
- t.timestamps null: false
9
- end
10
-
11
- add_foreign_key :disco_app_recurring_application_charges, :disco_app_shops, column: :shop_id
12
- add_foreign_key :disco_app_recurring_application_charges, :disco_app_subscriptions, column: :subscription_id
13
- end
14
- end
@@ -1,14 +0,0 @@
1
- class CreateDiscoAppApplicationCharges < ActiveRecord::Migration
2
- def change
3
- create_table :disco_app_application_charges do |t|
4
- t.integer :shop_id, limit: 8
5
- t.integer :subscription_id, limit: 8
6
- t.integer :status, default: 0
7
-
8
- t.timestamps null: false
9
- end
10
-
11
- add_foreign_key :disco_app_application_charges, :disco_app_shops, column: :shop_id
12
- add_foreign_key :disco_app_application_charges, :disco_app_subscriptions, column: :subscription_id
13
- end
14
- end
@@ -1,5 +0,0 @@
1
- class DropChargeStatusFromShops < ActiveRecord::Migration
2
- def change
3
- remove_column :disco_app_shops, :charge_status, :integer, default: 0
4
- end
5
- end
@@ -1,8 +0,0 @@
1
- class AddShopifyAttributesToCharges < ActiveRecord::Migration
2
- def change
3
- add_column :disco_app_application_charges, :shopify_id, :integer, limit: 8, null: true
4
- add_column :disco_app_recurring_application_charges, :shopify_id, :integer, limit: 8, null: true
5
- add_column :disco_app_application_charges, :confirmation_url, :string, null: true
6
- add_column :disco_app_recurring_application_charges, :confirmation_url, :string, null: true
7
- end
8
- end
@@ -1,14 +0,0 @@
1
- class CreateDiscoAppPlanCodes < ActiveRecord::Migration
2
- def change
3
- create_table :disco_app_plan_codes do |t|
4
- t.integer :plan_id, limit: 8
5
- t.string :code
6
- t.integer :trial_period_days
7
- t.integer :amount
8
-
9
- t.timestamps null: false
10
- end
11
-
12
- add_foreign_key :disco_app_plan_codes, :disco_app_plans, column: :plan_id
13
- end
14
- end
@@ -1,5 +0,0 @@
1
- class AddStatusToPlanCodes < ActiveRecord::Migration
2
- def change
3
- add_column :disco_app_plan_codes, :status, :integer, default: 0
4
- end
5
- end
@@ -1,7 +0,0 @@
1
- class AddAmountAndPlanCodeToDiscoAppSubscriptions < ActiveRecord::Migration
2
- def change
3
- add_column :disco_app_subscriptions, :amount, :integer, default: 0
4
- add_column :disco_app_subscriptions, :plan_code_id, :integer, limit: 8
5
- add_foreign_key :disco_app_subscriptions, :disco_app_plan_codes, column: :plan_code_id
6
- end
7
- end
@@ -1,5 +0,0 @@
1
- class AddSourceToDiscoAppSubscriptions < ActiveRecord::Migration
2
- def change
3
- add_column :disco_app_subscriptions, :source, :string
4
- end
5
- end
@@ -1,5 +0,0 @@
1
- class AddTrialPeriodDaysToDiscoAppSubscriptions < ActiveRecord::Migration
2
- def change
3
- add_column :disco_app_subscriptions, :trial_period_days, :integer
4
- end
5
- end
@@ -1,5 +0,0 @@
1
- class AddNameToDiscoAppShops < ActiveRecord::Migration
2
- def change
3
- add_column :disco_app_shops, :name, :string
4
- end
5
- end
@@ -1,61 +0,0 @@
1
- class MoveShopToSynchronises < ActiveRecord::Migration
2
-
3
- class DiscoApp::Shop < ActiveRecord::Base
4
- end
5
-
6
- ATTRIBUTES_TO_MIGRATE = [
7
- :email, :country_name, :currency, :money_format,
8
- :money_with_currency_format, :plan_display_name,
9
- :latitude, :longitude, :customer_email, :password_enabled, :phone,
10
- :primary_locale, :ships_to_countries, :timezone, :iana_timezone,
11
- :has_storefront
12
- ]
13
-
14
- def up
15
- add_column :disco_app_shops, :data, :jsonb, default: {}
16
-
17
- DiscoApp::Shop.find_each do |shop|
18
- data = shop.data
19
- ATTRIBUTES_TO_MIGRATE.each do |attribute|
20
- data[attribute.to_s] = shop.send(attribute)
21
- end
22
- shop.update(data: data)
23
- end
24
-
25
- ATTRIBUTES_TO_MIGRATE.each do |attribute|
26
- remove_column :disco_app_shops, attribute
27
- end
28
- end
29
-
30
- def down
31
- ATTRIBUTES_TO_MIGRATE.each do |attribute|
32
- add_column :disco_app_shops, attribute, attribute_column_type(attribute)
33
- end
34
-
35
- DiscoApp::Shop.find_each do |shop|
36
- shop.update(Hash[ATTRIBUTES_TO_MIGRATE.map do |attribute|
37
- [attribute, shop.data[attribute.to_s]]
38
- end])
39
- end
40
-
41
- remove_column :disco_app_shops, :data
42
- end
43
-
44
- private
45
-
46
- def attribute_column_type(attribute)
47
- case attribute
48
- when :password_enabled
49
- :boolean
50
- when :has_storefront
51
- :boolean
52
- when :latitude
53
- :decimal
54
- when :longitude
55
- :decimal
56
- else
57
- :string
58
- end
59
- end
60
-
61
- end