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
@@ -26,6 +26,43 @@ module Workarea
26
26
  assert_equal(users.first, User.new(result.second))
27
27
  end
28
28
 
29
+ def test_filtered_users
30
+ create_user
31
+ create_user
32
+
33
+ travel_to 1.week.from_now
34
+
35
+ get admin_api.users_path(
36
+ updated_at_starts_at: 5.days.ago,
37
+ updated_at_ends_at: 4.days.ago
38
+ )
39
+ result = JSON.parse(response.body)['users']
40
+
41
+ assert_equal(0, result.length)
42
+
43
+ get admin_api.users_path(
44
+ created_at_starts_at: 5.days.ago,
45
+ created_at_ends_at: 4.days.ago
46
+ )
47
+ result = JSON.parse(response.body)['users']
48
+
49
+ assert_equal(0, result.length)
50
+
51
+ get admin_api.users_path(
52
+ updated_at_starts_at: 8.days.ago,
53
+ updated_at_ends_at: 6.days.ago
54
+ )
55
+ result = JSON.parse(response.body)['users']
56
+ assert_equal(3, result.length) # plus one for API auth
57
+
58
+ get admin_api.users_path(
59
+ created_at_starts_at: 8.days.ago,
60
+ created_at_ends_at: 6.days.ago
61
+ )
62
+ result = JSON.parse(response.body)['users']
63
+ assert_equal(3, result.length) # plus one for API auth
64
+ end
65
+
29
66
  def test_creates_users
30
67
  data = sample_attributes
31
68
  assert_difference 'User.count', 1 do
@@ -34,11 +71,17 @@ module Workarea
34
71
  end
35
72
 
36
73
  def test_shows_users
37
- user = create_user
74
+ user = create_user(email: 'test@workarea.com')
75
+
38
76
  get admin_api.user_path(user.id)
39
77
  result = JSON.parse(response.body)['user']
40
78
  assert(result['password_digest'].blank?)
41
79
  assert_equal(user, User.new(result))
80
+
81
+ get admin_api.user_path(URI.escape(user.email, '+@.'))
82
+ result = JSON.parse(response.body)['user']
83
+ assert(result['password_digest'].blank?)
84
+ assert_equal(user, User.new(result))
42
85
  end
43
86
 
44
87
  def test_updates_users
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: workarea-api-admin
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.4.7
4
+ version: 4.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Crouse
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-08-22 00:00:00.000000000 Z
11
+ date: 2019-11-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: workarea
@@ -92,6 +92,7 @@ files:
92
92
  - app/controllers/workarea/api/admin/users_controller.rb
93
93
  - app/controllers/workarea/api/admin/variants_controller.rb
94
94
  - app/models/workarea/api/admin/bulk_upsert.rb
95
+ - app/models/workarea/api/admin/date_filtering.rb
95
96
  - app/models/workarea/user.decorator
96
97
  - app/views/workarea/admin/users/_api_permissions.html.haml
97
98
  - app/workers/workarea/perform_api_bulk_upsert.rb
@@ -110,6 +111,7 @@ files:
110
111
  - test/documentation/workarea/api/admin/discounts_documentation_test.rb
111
112
  - test/documentation/workarea/api/admin/email_signups_documentation_test.rb
112
113
  - test/documentation/workarea/api/admin/fulfillment_documentation_test.rb
114
+ - test/documentation/workarea/api/admin/global_functionality_documentation_test.rb
113
115
  - test/documentation/workarea/api/admin/inventory_skus_documentation_test.rb
114
116
  - test/documentation/workarea/api/admin/navigation_menus_documentation_test.rb
115
117
  - test/documentation/workarea/api/admin/navigation_taxons_documentation_test.rb
@@ -248,7 +250,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
248
250
  - !ruby/object:Gem::Version
249
251
  version: '0'
250
252
  requirements: []
251
- rubygems_version: 3.0.4
253
+ rubygems_version: 3.0.6
252
254
  signing_key:
253
255
  specification_version: 4
254
256
  summary: Admin JSON REST API for the Workarea Commerce Platform