workarea-api 4.5.3 → 4.5.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0e1cb3e9913b2746955a162453b9c25864562b2e0cb4e567d1f0cd0a3b202e38
4
- data.tar.gz: bbc070da292f5002261deca67eb84056f7b3e837cf2f057154c7cc465e6a1a1f
3
+ metadata.gz: bb882700d49c189d82c8986183a1cba9750f01187f172fcc81988d27e2236ab1
4
+ data.tar.gz: 7de993c7945ed5934c9c3bdd9d1bb50d278876c915c5d46c01686100e520d1cb
5
5
  SHA512:
6
- metadata.gz: 97857f0599e2a0afc84641a14075b126f37e6ce047ac6d38489e210968c2ff04b8d4e82f1378a5a99c5832b86a8bf8a16dbb0cb17fcba00aeb690d0e1f207556
7
- data.tar.gz: 3ee7e29e9c513cc012bdfe9dcaafce64c00adc8d18d4d3073ed46208715168df10708f093bef81d93028cbdff2f8ddb8d49a02c0a1ee51baf665878bcc4148dd
6
+ metadata.gz: 103ac8773fa6881af720616002bc3e1ff8bfbbb98d232de9527f4e2755de9299775254a6bedbd8201393812977dd7d9854c59120ca5ee2e277be4f158d3b3939
7
+ data.tar.gz: a9907fd80fa4797e28a6cfc460a5720fdf809510bb0dc8cfb8c4d97f974389d1a3900ee1ae11e6890f3afe8321d84f09547761fb0c4acff914226b12e77cb78e
@@ -1,3 +1,27 @@
1
+ Workarea Api 4.5.4 (2020-08-19)
2
+ --------------------------------------------------------------------------------
3
+
4
+ * Handle non-persisted recommendation settings
5
+
6
+ This uses `find_or_initialize` to match our usage of
7
+ `Recommendation::Settings` elsewhere in the platform.
8
+
9
+ Fixes #19
10
+ Ben Crouse
11
+
12
+ * Add Documentation Test for Failed Checkout Update
13
+
14
+ This documents the scenario in which a checkout update fails to persist,
15
+ and thus the API returns a `422` error to signify its failure. It
16
+ depends on the code changes in workarea-commerce/workarea#481, and thus
17
+ we will need to bump the Workarea version to restrict its upgrade to
18
+ users of v3.5.17 and beyond.
19
+
20
+ API-14
21
+ Tom Scott
22
+
23
+
24
+
1
25
  Workarea Api 4.5.3 (2020-03-26)
2
26
  --------------------------------------------------------------------------------
3
27
 
data/Rakefile CHANGED
@@ -6,6 +6,8 @@ rescue LoadError
6
6
  end
7
7
 
8
8
  require 'rails'
9
+ require "action_view/railtie"
10
+
9
11
  require 'workarea/core'
10
12
  require 'rake/testtask'
11
13
  require 'date'
@@ -114,7 +114,7 @@ module Workarea
114
114
  private
115
115
 
116
116
  def find_recommendation_settings
117
- @recommendation_settings = Recommendation::Settings.find(params[:product_id])
117
+ @recommendation_settings = Recommendation::Settings.find_or_initialize_by(id: params[:product_id])
118
118
  end
119
119
  end
120
120
  end
@@ -35,6 +35,20 @@ module Workarea
35
35
 
36
36
  assert_equal(['foo'], recommendation_settings.reload.product_ids)
37
37
  end
38
+
39
+ def test_unpersisted_recommendation_settings
40
+ get admin_api.product_recommendation_settings_path(@product.id)
41
+ result = JSON.parse(response.body)['recommendation_settings']
42
+ assert_equal(@product.id, result['_id'])
43
+ assert_equal(0, Recommendation::Settings.count)
44
+
45
+ patch admin_api.product_recommendation_settings_path(@product.id),
46
+ params: { recommendation_settings: { product_ids: ['foo'] } }
47
+
48
+ assert_equal(1, Recommendation::Settings.count)
49
+ assert_equal(@product.id, Recommendation::Settings.first.id)
50
+ assert_equal(['foo'], Recommendation::Settings.first.product_ids)
51
+ end
38
52
  end
39
53
  end
40
54
  end
@@ -1,5 +1,5 @@
1
1
  module Workarea
2
2
  module Api
3
- VERSION = '4.5.3'.freeze
3
+ VERSION = '4.5.4'.freeze
4
4
  end
5
5
  end
@@ -85,6 +85,27 @@ module Workarea
85
85
  end
86
86
  end
87
87
 
88
+ def test_and_document_update_failure
89
+ description 'Failure to update a checkout'
90
+ route storefront_api.checkout_path(':id')
91
+ explanation <<-EOS
92
+ This is an example of what occurs when you fail to send in the correct parameters for your checkout.
93
+ EOS
94
+
95
+ record_request do
96
+ patch storefront_api.checkout_path(@order),
97
+ as: :json,
98
+ params: {
99
+ email: 'susanb@workarea.com',
100
+ shipping_address: address.except(:first_name),
101
+ billing_address: address.except(:last_name),
102
+ shipping_service: 'Express'
103
+ }
104
+
105
+ assert_equal(422, response.status)
106
+ end
107
+ end
108
+
88
109
  def test_and_document_complete
89
110
  description 'Completing a checkout'
90
111
  route storefront_api.complete_checkout_path(':id')
@@ -72,7 +72,7 @@ module Workarea
72
72
  }
73
73
  }
74
74
 
75
- assert_equal(200, response.status)
75
+ assert_equal(422, response.status)
76
76
  end
77
77
  end
78
78
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: workarea-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.5.3
4
+ version: 4.5.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Crouse
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2020-03-26 00:00:00.000000000 Z
12
+ date: 2020-08-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: workarea
@@ -37,28 +37,28 @@ dependencies:
37
37
  requirements:
38
38
  - - '='
39
39
  - !ruby/object:Gem::Version
40
- version: 4.5.3
40
+ version: 4.5.4
41
41
  type: :runtime
42
42
  prerelease: false
43
43
  version_requirements: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - '='
46
46
  - !ruby/object:Gem::Version
47
- version: 4.5.3
47
+ version: 4.5.4
48
48
  - !ruby/object:Gem::Dependency
49
49
  name: workarea-api-admin
50
50
  requirement: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - '='
53
53
  - !ruby/object:Gem::Version
54
- version: 4.5.3
54
+ version: 4.5.4
55
55
  type: :runtime
56
56
  prerelease: false
57
57
  version_requirements: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - '='
60
60
  - !ruby/object:Gem::Version
61
- version: 4.5.3
61
+ version: 4.5.4
62
62
  - !ruby/object:Gem::Dependency
63
63
  name: raddocs
64
64
  requirement: !ruby/object:Gem::Requirement
@@ -755,7 +755,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
755
755
  - !ruby/object:Gem::Version
756
756
  version: '0'
757
757
  requirements: []
758
- rubygems_version: 3.0.6
758
+ rubygems_version: 3.0.3
759
759
  signing_key:
760
760
  specification_version: 4
761
761
  summary: Adds a JSON REST API to the Workarea Commerce Platform