workarea-api-admin 4.4.7 → 4.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/workarea/api/admin/categories_controller.rb +6 -0
  3. data/app/controllers/workarea/api/admin/content_assets_controller.rb +6 -0
  4. data/app/controllers/workarea/api/admin/content_controller.rb +6 -0
  5. data/app/controllers/workarea/api/admin/discounts_controller.rb +7 -0
  6. data/app/controllers/workarea/api/admin/email_signups_controller.rb +20 -4
  7. data/app/controllers/workarea/api/admin/fulfillments_controller.rb +6 -1
  8. data/app/controllers/workarea/api/admin/inventory_skus_controller.rb +7 -0
  9. data/app/controllers/workarea/api/admin/navigation_menus_controller.rb +7 -0
  10. data/app/controllers/workarea/api/admin/navigation_taxons_controller.rb +7 -0
  11. data/app/controllers/workarea/api/admin/orders_controller.rb +19 -1
  12. data/app/controllers/workarea/api/admin/pages_controller.rb +7 -0
  13. data/app/controllers/workarea/api/admin/payment_profiles_controller.rb +7 -0
  14. data/app/controllers/workarea/api/admin/payment_transactions_controller.rb +7 -0
  15. data/app/controllers/workarea/api/admin/payments_controller.rb +7 -0
  16. data/app/controllers/workarea/api/admin/pricing_skus_controller.rb +7 -0
  17. data/app/controllers/workarea/api/admin/products_controller.rb +11 -4
  18. data/app/controllers/workarea/api/admin/promo_code_lists_controller.rb +7 -0
  19. data/app/controllers/workarea/api/admin/redirects_controller.rb +7 -0
  20. data/app/controllers/workarea/api/admin/releases_controller.rb +7 -0
  21. data/app/controllers/workarea/api/admin/shipping_services_controller.rb +7 -0
  22. data/app/controllers/workarea/api/admin/shippings_controller.rb +7 -0
  23. data/app/controllers/workarea/api/admin/swagger_controller.rb +33 -0
  24. data/app/controllers/workarea/api/admin/tax_categories_controller.rb +2 -0
  25. data/app/controllers/workarea/api/admin/users_controller.rb +28 -14
  26. data/app/models/workarea/api/admin/date_filtering.rb +27 -0
  27. data/lib/workarea/api/admin/engine.rb +11 -0
  28. data/test/documentation/workarea/api/admin/email_signups_documentation_test.rb +14 -2
  29. data/test/documentation/workarea/api/admin/global_functionality_documentation_test.rb +140 -0
  30. data/test/documentation/workarea/api/admin/orders_documentation_test.rb +13 -6
  31. data/test/documentation/workarea/api/admin/users_documentation_test.rb +14 -2
  32. data/test/dummy/config/initializers/session_store.rb +3 -1
  33. data/test/integration/workarea/api/admin/categories_integration_test.rb +32 -0
  34. data/test/integration/workarea/api/admin/content_assets_integration_test.rb +32 -0
  35. data/test/integration/workarea/api/admin/content_integration_test.rb +32 -0
  36. data/test/integration/workarea/api/admin/discounts_integration_test.rb +32 -0
  37. data/test/integration/workarea/api/admin/email_signups_integration_test.rb +38 -1
  38. data/test/integration/workarea/api/admin/fulfillments_integration_test.rb +22 -0
  39. data/test/integration/workarea/api/admin/inventory_skus_integration_test.rb +32 -0
  40. data/test/integration/workarea/api/admin/navigation_menus_integration_test.rb +32 -0
  41. data/test/integration/workarea/api/admin/navigation_taxons_integration_test.rb +32 -0
  42. data/test/integration/workarea/api/admin/orders_integration_test.rb +41 -2
  43. data/test/integration/workarea/api/admin/pages_integration_test.rb +32 -0
  44. data/test/integration/workarea/api/admin/payment_profiles_integration_test.rb +32 -0
  45. data/test/integration/workarea/api/admin/payment_transactions_integration_test.rb +32 -0
  46. data/test/integration/workarea/api/admin/payments_integration_test.rb +32 -0
  47. data/test/integration/workarea/api/admin/pricing_skus_integration_test.rb +32 -0
  48. data/test/integration/workarea/api/admin/products_integration_test.rb +35 -0
  49. data/test/integration/workarea/api/admin/promo_code_lists_integration_test.rb +31 -0
  50. data/test/integration/workarea/api/admin/redirects_integration_test.rb +31 -0
  51. data/test/integration/workarea/api/admin/releases_integration_test.rb +31 -0
  52. data/test/integration/workarea/api/admin/shipping_services_integration_test.rb +31 -0
  53. data/test/integration/workarea/api/admin/shippings_integration_test.rb +31 -0
  54. data/test/integration/workarea/api/admin/tax_categories_integration_test.rb +31 -0
  55. data/test/integration/workarea/api/admin/users_integration_test.rb +44 -1
  56. metadata +5 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a7cf3a9b6d4cb3a3799538372eb669f503b170f8864bcb1fca5546519e93e964
4
- data.tar.gz: df228a08d189e38e4282e5d87ba65397f0da3886aaa43f710390c6b3e0c7f464
3
+ metadata.gz: 1293e8aaa96d2635d1dcbe8db63f474d72641e25b5a55c0962198151ad26d6e8
4
+ data.tar.gz: 6acda0225199411d454aec44aa70cbb16a8afa4d1d127b5f15c20faaf441b561
5
5
  SHA512:
6
- metadata.gz: 90665ea20415e55d51bbedff15de9f2673df1f0789663adaecd00c92a33a92dbc433505b061fa34e76223f6e2a92a3be9164147128828e123803ef0795fd7fba
7
- data.tar.gz: ebf57ffe3a8d33fb2802ab56b1315a16fec21a3ad8fa9d1c757985f15c44c24d11a2487bba4576120d15c41083eb779b2e6d30af1cf33fc6215cf0e52587f034
6
+ metadata.gz: '03188782d8a034260defff0c3de1d8707a62013277b40f9cb3a1a5727c562cdc87272d06b0a1b46617cfb64f530f99f7f1e4a716a5b1936cff78aa121e35e629'
7
+ data.tar.gz: f5aebc2374c504adb53576ebf7411d0b915d40b4e863909171df81b5e2b9f85c9a9d6854d0956455543898ce8defa5daa4aae369f41bea750e03a44b95c06282
@@ -35,6 +35,10 @@ module Workarea
35
35
  key :enum, %w(asc desc)
36
36
  key :default, 'desc'
37
37
  end
38
+ parameter :updated_at_starts_at
39
+ parameter :updated_at_ends_at
40
+ parameter :created_at_starts_at
41
+ parameter :created_at_ends_at
38
42
 
39
43
  response 200 do
40
44
  key :description, 'Categories'
@@ -97,6 +101,8 @@ module Workarea
97
101
  def index
98
102
  @categories = Catalog::Category
99
103
  .all
104
+ .by_updated_at(starts_at: params[:updated_at_starts_at], ends_at: params[:updated_at_ends_at])
105
+ .by_created_at(starts_at: params[:created_at_starts_at], ends_at: params[:created_at_ends_at])
100
106
  .order_by(sort_field => sort_direction)
101
107
  .page(params[:page])
102
108
 
@@ -35,6 +35,10 @@ module Workarea
35
35
  key :enum, %w(asc desc)
36
36
  key :default, 'desc'
37
37
  end
38
+ parameter :updated_at_starts_at
39
+ parameter :updated_at_ends_at
40
+ parameter :created_at_starts_at
41
+ parameter :created_at_ends_at
38
42
 
39
43
  response 200 do
40
44
  key :description, 'Content assets'
@@ -97,6 +101,8 @@ module Workarea
97
101
  def index
98
102
  @assets = Content::Asset
99
103
  .all
104
+ .by_updated_at(starts_at: params[:updated_at_starts_at], ends_at: params[:updated_at_ends_at])
105
+ .by_created_at(starts_at: params[:created_at_starts_at], ends_at: params[:created_at_ends_at])
100
106
  .order_by(sort_field => sort_direction)
101
107
  .page(params[:page])
102
108
 
@@ -35,6 +35,10 @@ module Workarea
35
35
  key :enum, %w(asc desc)
36
36
  key :default, 'desc'
37
37
  end
38
+ parameter :updated_at_starts_at
39
+ parameter :updated_at_ends_at
40
+ parameter :created_at_starts_at
41
+ parameter :created_at_ends_at
38
42
 
39
43
  response 200 do
40
44
  key :description, 'Content'
@@ -97,6 +101,8 @@ module Workarea
97
101
  def index
98
102
  @content = Content
99
103
  .all
104
+ .by_updated_at(starts_at: params[:updated_at_starts_at], ends_at: params[:updated_at_ends_at])
105
+ .by_created_at(starts_at: params[:created_at_starts_at], ends_at: params[:created_at_ends_at])
100
106
  .order_by(sort_field => sort_direction)
101
107
  .page(params[:page])
102
108
 
@@ -36,6 +36,11 @@ module Workarea
36
36
  key :default, 'desc'
37
37
  end
38
38
 
39
+ parameter :updated_at_starts_at
40
+ parameter :updated_at_ends_at
41
+ parameter :created_at_starts_at
42
+ parameter :created_at_ends_at
43
+
39
44
  response 200 do
40
45
  key :description, 'Discounts'
41
46
  schema do
@@ -97,6 +102,8 @@ module Workarea
97
102
  def index
98
103
  @discounts = Pricing::Discount
99
104
  .all
105
+ .by_updated_at(starts_at: params[:updated_at_starts_at], ends_at: params[:updated_at_ends_at])
106
+ .by_created_at(starts_at: params[:created_at_starts_at], ends_at: params[:created_at_ends_at])
100
107
  .order_by(sort_field => sort_direction)
101
108
  .page(params[:page])
102
109
 
@@ -2,6 +2,8 @@ module Workarea
2
2
  module Api
3
3
  module Admin
4
4
  class EmailSignupsController < Admin::ApplicationController
5
+ before_action :find_email_signup, only: :show
6
+
5
7
  swagger_path '/email_signups' do
6
8
  operation :get do
7
9
  key :summary, 'All Email Signups'
@@ -34,6 +36,11 @@ module Workarea
34
36
  key :default, 'desc'
35
37
  end
36
38
 
39
+ parameter :updated_at_starts_at
40
+ parameter :updated_at_ends_at
41
+ parameter :created_at_starts_at
42
+ parameter :created_at_ends_at
43
+
37
44
  response 200 do
38
45
  key :description, 'Email Signups'
39
46
  schema do
@@ -52,22 +59,24 @@ module Workarea
52
59
  def index
53
60
  @email_signups = Email::Signup
54
61
  .all
62
+ .by_updated_at(starts_at: params[:updated_at_starts_at], ends_at: params[:updated_at_ends_at])
63
+ .by_created_at(starts_at: params[:created_at_starts_at], ends_at: params[:created_at_ends_at])
55
64
  .order_by(sort_field => sort_direction)
56
65
  .page(params[:page])
57
66
 
58
67
  respond_with email_signups: @email_signups
59
68
  end
60
69
 
61
- swagger_path '/email_signups/{id}' do
70
+ swagger_path '/email_signups/{id_or_email}' do
62
71
  operation :get do
63
- key :summary, 'Find Email Signup by ID'
72
+ key :summary, 'Find Email Signup by ID or Email Address'
64
73
  key :description, 'Returns a single email signup'
65
74
  key :operationId, 'showEmailSignup'
66
75
 
67
76
  parameter do
68
77
  key :name, :id
69
78
  key :in, :path
70
- key :description, 'ID of email signup to fetch'
79
+ key :description, 'ID or URI escaped email of email signup to fetch'
71
80
  key :required, true
72
81
  key :type, :string
73
82
  end
@@ -99,9 +108,16 @@ module Workarea
99
108
  end
100
109
 
101
110
  def show
102
- @email_signup = Email::Signup.find(params[:id])
103
111
  respond_with email_signup: @email_signup
104
112
  end
113
+
114
+ private
115
+
116
+ def find_email_signup
117
+ @email_signup = Email::Signup.find(params[:id])
118
+ rescue Mongoid::Errors::DocumentNotFound
119
+ @email_signup = Email::Signup.find_by(email: URI.unescape(params[:id]))
120
+ end
105
121
  end
106
122
  end
107
123
  end
@@ -36,6 +36,11 @@ module Workarea
36
36
  key :default, 'desc'
37
37
  end
38
38
 
39
+ parameter :updated_at_starts_at
40
+ parameter :updated_at_ends_at
41
+ parameter :created_at_starts_at
42
+ parameter :created_at_ends_at
43
+
39
44
  response 200 do
40
45
  key :description, 'Fulfillments'
41
46
  schema do
@@ -54,9 +59,9 @@ module Workarea
54
59
  def index
55
60
  @fulfillments = Fulfillment
56
61
  .all
62
+ .by_updated_at(starts_at: params[:updated_at_starts_at], ends_at: params[:updated_at_ends_at])
57
63
  .order_by(sort_field => sort_direction)
58
64
  .page(params[:page])
59
-
60
65
  respond_with fulfillments: @fulfillments
61
66
  end
62
67
 
@@ -36,6 +36,11 @@ module Workarea
36
36
  key :default, 'desc'
37
37
  end
38
38
 
39
+ parameter :updated_at_starts_at
40
+ parameter :updated_at_ends_at
41
+ parameter :created_at_starts_at
42
+ parameter :created_at_ends_at
43
+
39
44
  response 200 do
40
45
  key :description, 'Inventory SKUs'
41
46
  schema do
@@ -97,6 +102,8 @@ module Workarea
97
102
  def index
98
103
  @inventory_skus = Inventory::Sku
99
104
  .all
105
+ .by_updated_at(starts_at: params[:updated_at_starts_at], ends_at: params[:updated_at_ends_at])
106
+ .by_created_at(starts_at: params[:created_at_starts_at], ends_at: params[:created_at_ends_at])
100
107
  .order_by(sort_field => sort_direction)
101
108
  .page(params[:page])
102
109
 
@@ -36,6 +36,11 @@ module Workarea
36
36
  key :default, 'desc'
37
37
  end
38
38
 
39
+ parameter :updated_at_starts_at
40
+ parameter :updated_at_ends_at
41
+ parameter :created_at_starts_at
42
+ parameter :created_at_ends_at
43
+
39
44
  response 200 do
40
45
  key :description, 'Navigation Menus'
41
46
  schema do
@@ -97,6 +102,8 @@ module Workarea
97
102
  def index
98
103
  @navigation_menus = Navigation::Menu
99
104
  .all
105
+ .by_updated_at(starts_at: params[:updated_at_starts_at], ends_at: params[:updated_at_ends_at])
106
+ .by_created_at(starts_at: params[:created_at_starts_at], ends_at: params[:created_at_ends_at])
100
107
  .order_by(sort_field => sort_direction)
101
108
  .page(params[:page])
102
109
 
@@ -36,6 +36,11 @@ module Workarea
36
36
  key :default, 'desc'
37
37
  end
38
38
 
39
+ parameter :updated_at_starts_at
40
+ parameter :updated_at_ends_at
41
+ parameter :created_at_starts_at
42
+ parameter :created_at_ends_at
43
+
39
44
  response 200 do
40
45
  key :description, 'Navigation taxons'
41
46
  schema do
@@ -97,6 +102,8 @@ module Workarea
97
102
  def index
98
103
  @navigation_taxons = Navigation::Taxon
99
104
  .all
105
+ .by_updated_at(starts_at: params[:updated_at_starts_at], ends_at: params[:updated_at_ends_at])
106
+ .by_created_at(starts_at: params[:created_at_starts_at], ends_at: params[:created_at_ends_at])
100
107
  .order_by(sort_field => sort_direction)
101
108
  .page(params[:page])
102
109
 
@@ -47,6 +47,18 @@ module Workarea
47
47
  key :type, :string
48
48
  key :format, 'date-time'
49
49
  end
50
+ parameter do
51
+ key :name, :email
52
+ key :in, :query
53
+ key :description, 'Email address associated to the orders'
54
+ key :required, false
55
+ key :type, :integer
56
+ end
57
+
58
+ parameter :updated_at_starts_at
59
+ parameter :updated_at_ends_at
60
+ parameter :created_at_starts_at
61
+ parameter :created_at_ends_at
50
62
 
51
63
  response 200 do
52
64
  key :description, 'Orders'
@@ -66,6 +78,10 @@ module Workarea
66
78
  def index
67
79
  criteria = Order.all
68
80
 
81
+ if params[:email].present?
82
+ criteria = criteria.where(email: params[:email])
83
+ end
84
+
69
85
  if params[:placed_at_greater_than].present?
70
86
  # TODO Workarea v4, rename to placed_at_starts_at
71
87
  criteria = criteria.where(:placed_at.gte => params[:placed_at_greater_than])
@@ -73,11 +89,13 @@ module Workarea
73
89
 
74
90
  if params[:placed_at_less_than].present?
75
91
  # TODO Workarea v4, rename to placed_at_ends_at
76
- criteria = criteria.where(:placed_at.lt => params[:placed_at_less_than])
92
+ criteria = criteria.where(:placed_at.lte => params[:placed_at_less_than])
77
93
  end
78
94
 
79
95
  @orders =
80
96
  criteria
97
+ .by_updated_at(starts_at: params[:updated_at_starts_at], ends_at: params[:updated_at_ends_at])
98
+ .by_created_at(starts_at: params[:created_at_starts_at], ends_at: params[:created_at_ends_at])
81
99
  .order_by(sort_field => sort_direction)
82
100
  .page(params[:page].presence || 1)
83
101
 
@@ -36,6 +36,11 @@ module Workarea
36
36
  key :default, 'desc'
37
37
  end
38
38
 
39
+ parameter :updated_at_starts_at
40
+ parameter :updated_at_ends_at
41
+ parameter :created_at_starts_at
42
+ parameter :created_at_ends_at
43
+
39
44
  response 200 do
40
45
  key :description, 'Pages'
41
46
  schema do
@@ -97,6 +102,8 @@ module Workarea
97
102
  def index
98
103
  @pages = Content::Page
99
104
  .all
105
+ .by_updated_at(starts_at: params[:updated_at_starts_at], ends_at: params[:updated_at_ends_at])
106
+ .by_created_at(starts_at: params[:created_at_starts_at], ends_at: params[:created_at_ends_at])
100
107
  .order_by(sort_field => sort_direction)
101
108
  .page(params[:page])
102
109
 
@@ -36,6 +36,11 @@ module Workarea
36
36
  key :default, 'desc'
37
37
  end
38
38
 
39
+ parameter :updated_at_starts_at
40
+ parameter :updated_at_ends_at
41
+ parameter :created_at_starts_at
42
+ parameter :created_at_ends_at
43
+
39
44
  response 200 do
40
45
  key :description, 'Payment profiles'
41
46
  schema do
@@ -97,6 +102,8 @@ module Workarea
97
102
  def index
98
103
  @payment_profiles = Payment::Profile
99
104
  .all
105
+ .by_updated_at(starts_at: params[:updated_at_starts_at], ends_at: params[:updated_at_ends_at])
106
+ .by_created_at(starts_at: params[:created_at_starts_at], ends_at: params[:created_at_ends_at])
100
107
  .order_by(sort_field => sort_direction)
101
108
  .page(params[:page])
102
109
 
@@ -34,6 +34,11 @@ module Workarea
34
34
  key :default, 'desc'
35
35
  end
36
36
 
37
+ parameter :updated_at_starts_at
38
+ parameter :updated_at_ends_at
39
+ parameter :created_at_starts_at
40
+ parameter :created_at_ends_at
41
+
37
42
  response 200 do
38
43
  key :description, 'Payment transactions'
39
44
  schema do
@@ -52,6 +57,8 @@ module Workarea
52
57
  def index
53
58
  @transactions = Payment::Transaction
54
59
  .all
60
+ .by_updated_at(starts_at: params[:updated_at_starts_at], ends_at: params[:updated_at_ends_at])
61
+ .by_created_at(starts_at: params[:created_at_starts_at], ends_at: params[:created_at_ends_at])
55
62
  .order_by(sort_field => sort_direction)
56
63
  .page(params[:page])
57
64
 
@@ -34,6 +34,11 @@ module Workarea
34
34
  key :default, 'desc'
35
35
  end
36
36
 
37
+ parameter :updated_at_starts_at
38
+ parameter :updated_at_ends_at
39
+ parameter :created_at_starts_at
40
+ parameter :created_at_ends_at
41
+
37
42
  response 200 do
38
43
  key :description, 'Payments'
39
44
  schema do
@@ -52,6 +57,8 @@ module Workarea
52
57
  def index
53
58
  @payments = Payment
54
59
  .all
60
+ .by_updated_at(starts_at: params[:updated_at_starts_at], ends_at: params[:updated_at_ends_at])
61
+ .by_created_at(starts_at: params[:created_at_starts_at], ends_at: params[:created_at_ends_at])
55
62
  .order_by(sort_field => sort_direction)
56
63
  .page(params[:page])
57
64
 
@@ -36,6 +36,11 @@ module Workarea
36
36
  key :default, 'desc'
37
37
  end
38
38
 
39
+ parameter :updated_at_starts_at
40
+ parameter :updated_at_ends_at
41
+ parameter :created_at_starts_at
42
+ parameter :created_at_ends_at
43
+
39
44
  response 200 do
40
45
  key :description, 'Pricing SKUs'
41
46
  schema do
@@ -97,6 +102,8 @@ module Workarea
97
102
  def index
98
103
  @pricing_skus = Pricing::Sku
99
104
  .all
105
+ .by_updated_at(starts_at: params[:updated_at_starts_at], ends_at: params[:updated_at_ends_at])
106
+ .by_created_at(starts_at: params[:created_at_starts_at], ends_at: params[:created_at_ends_at])
100
107
  .order_by(sort_field => sort_direction)
101
108
  .page(params[:page])
102
109
 
@@ -36,6 +36,11 @@ module Workarea
36
36
  key :default, 'desc'
37
37
  end
38
38
 
39
+ parameter :updated_at_starts_at
40
+ parameter :updated_at_ends_at
41
+ parameter :created_at_starts_at
42
+ parameter :created_at_ends_at
43
+
39
44
  response 200 do
40
45
  key :description, 'Products'
41
46
  schema do
@@ -95,10 +100,12 @@ module Workarea
95
100
  end
96
101
 
97
102
  def index
98
- @products = Catalog::Product
99
- .all
100
- .order_by(sort_field => sort_direction)
101
- .page(params[:page])
103
+ @products =
104
+ Catalog::Product.all
105
+ .by_updated_at(starts_at: params[:updated_at_starts_at], ends_at: params[:updated_at_ends_at])
106
+ .by_created_at(starts_at: params[:created_at_starts_at], ends_at: params[:created_at_ends_at])
107
+ .order_by(sort_field => sort_direction)
108
+ .page(params[:page])
102
109
 
103
110
  respond_with products: @products
104
111
  end
@@ -36,6 +36,11 @@ module Workarea
36
36
  key :default, 'desc'
37
37
  end
38
38
 
39
+ parameter :updated_at_starts_at
40
+ parameter :updated_at_ends_at
41
+ parameter :created_at_starts_at
42
+ parameter :created_at_ends_at
43
+
39
44
  response 200 do
40
45
  key :description, 'Promo code lists'
41
46
  schema do
@@ -97,6 +102,8 @@ module Workarea
97
102
  def index
98
103
  @promo_code_lists = Pricing::Discount::CodeList
99
104
  .all
105
+ .by_updated_at(starts_at: params[:updated_at_starts_at], ends_at: params[:updated_at_ends_at])
106
+ .by_created_at(starts_at: params[:created_at_starts_at], ends_at: params[:created_at_ends_at])
100
107
  .order_by(sort_field => sort_direction)
101
108
  .page(params[:page])
102
109