desertcart 1.1.2 → 1.2.0

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: abd4133cc0f5f5fc77a0b031364c6a203ae98a988a4d558a6187bacb36e10612
4
- data.tar.gz: 6b7a8dae640b7723166261f8931a69063f0756d689ced600f87747ecbf61c3d7
3
+ metadata.gz: eb1774c9afba0ecfdc1996971f199d0d539cdcf35a971655b97e51cd4fd980c1
4
+ data.tar.gz: 72dc553eefd4d1366793af206de71644eab755170af4fa9fdc033e8bd414eb6a
5
5
  SHA512:
6
- metadata.gz: b2a0f4321d34761781f7ae109a22ea8834e07f7b64432f1fa9269079cea0aaaaf09b80fb22b2beec022bd8feab326f218768837def174e56da96fda9074e6a58
7
- data.tar.gz: c45a38634ea3a80bd47910db4e22aac033f4d1c7b0fff078a95ad323811a86a064d3ca2f19b752ddd10cd43c781c7ac284c49dcd64360a270e24df35c9ecf49e
6
+ metadata.gz: eabdcc7f7f4448dd43077e824149d8783d72fa366900700006c6269c8f980cce579347948cf2a9c3c3e18c2d22addb6a9b442c34e56739225783857fd1bc4e82
7
+ data.tar.gz: 9c1e71137ae6c00fee7a8aac8e1e733d85a01f288bac2b70ed61df982fb82cbd85d3d71b222204f541890ab2ebc54a8d41af199d13d3dc4b591582d6a2b9bad3
data/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [1.2.0] - 2021-12-27
4
+
5
+ - Feature: Create Operation succeeds only with 201 status code
6
+ - Feature: Update Operation succeeds only with 200 status code
7
+ - Feature: Create and Update Operation fails with `UnprocessableEntityError` for 422 status code
8
+
9
+ ## [1.1.5] - 2021-12-16
10
+
11
+ - Chore: Update LedgerSync to 2.3.1
12
+
13
+ ## [1.1.4] - 2021-11-22
14
+
15
+ - Fix: Wrong OrderItemAcceptance attribute type
16
+
17
+ ## [1.1.3] - 2021-11-22
18
+
19
+ - Fix: Add final purchase details to OrderItemAcceptance resource
20
+
3
21
  ## [1.1.2] - 2021-11-22
4
22
 
5
23
  - Feature: Add final purchase details to OrderItemAcceptance
data/Gemfile.lock CHANGED
@@ -1,20 +1,19 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- desertcart (1.1.2)
5
- ledger_sync (~> 2.2.0)
4
+ desertcart (1.2.0)
5
+ ledger_sync (~> 2.3.1)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- activemodel (6.1.4.1)
11
- activesupport (= 6.1.4.1)
12
- activesupport (6.1.4.1)
10
+ activemodel (7.0.0)
11
+ activesupport (= 7.0.0)
12
+ activesupport (7.0.0)
13
13
  concurrent-ruby (~> 1.0, >= 1.0.2)
14
14
  i18n (>= 1.6, < 2)
15
15
  minitest (>= 5.1)
16
16
  tzinfo (~> 2.0)
17
- zeitwerk (~> 2.3)
18
17
  ast (2.4.2)
19
18
  colorize (0.8.1)
20
19
  concurrent-ruby (1.1.9)
@@ -28,33 +27,30 @@ GEM
28
27
  dry-configurable (~> 0.13, >= 0.13.0)
29
28
  dry-core (0.7.1)
30
29
  concurrent-ruby (~> 1.0)
31
- dry-equalizer (0.3.0)
32
30
  dry-inflector (0.2.1)
33
31
  dry-initializer (3.0.4)
34
32
  dry-logic (1.2.0)
35
33
  concurrent-ruby (~> 1.0)
36
34
  dry-core (~> 0.5, >= 0.5)
37
- dry-schema (1.5.6)
35
+ dry-schema (1.8.0)
38
36
  concurrent-ruby (~> 1.0)
39
- dry-configurable (~> 0.8, >= 0.8.3)
40
- dry-core (~> 0.4)
41
- dry-equalizer (~> 0.2)
37
+ dry-configurable (~> 0.13, >= 0.13.0)
38
+ dry-core (~> 0.5, >= 0.5)
42
39
  dry-initializer (~> 3.0)
43
40
  dry-logic (~> 1.0)
44
- dry-types (~> 1.4)
41
+ dry-types (~> 1.5)
45
42
  dry-types (1.5.1)
46
43
  concurrent-ruby (~> 1.0)
47
44
  dry-container (~> 0.3)
48
45
  dry-core (~> 0.5, >= 0.5)
49
46
  dry-inflector (~> 0.1, >= 0.1.2)
50
47
  dry-logic (~> 1.0, >= 1.0.2)
51
- dry-validation (1.5.6)
48
+ dry-validation (1.7.0)
52
49
  concurrent-ruby (~> 1.0)
53
50
  dry-container (~> 0.7, >= 0.7.1)
54
- dry-core (~> 0.4)
55
- dry-equalizer (~> 0.2)
51
+ dry-core (~> 0.5, >= 0.5)
56
52
  dry-initializer (~> 3.0)
57
- dry-schema (~> 1.5, >= 1.5.2)
53
+ dry-schema (~> 1.8, >= 1.8.0)
58
54
  faraday (1.8.0)
59
55
  faraday-em_http (~> 1.0)
60
56
  faraday-em_synchrony (~> 1.0)
@@ -83,10 +79,10 @@ GEM
83
79
  i18n (1.8.11)
84
80
  concurrent-ruby (~> 1.0)
85
81
  ipaddr (1.2.3)
86
- ledger_sync (2.2.3)
82
+ ledger_sync (2.3.1)
87
83
  activemodel
88
- dry-schema (~> 1.5.4)
89
- dry-validation (~> 1.5.6)
84
+ dry-schema
85
+ dry-validation
90
86
  faraday
91
87
  faraday-detailed_logger
92
88
  faraday_middleware
@@ -98,7 +94,7 @@ GEM
98
94
  rainbow (~> 3.0)
99
95
  resonad
100
96
  simply_serializable (>= 1.5.1)
101
- minitest (5.14.4)
97
+ minitest (5.15.0)
102
98
  multipart-post (2.1.1)
103
99
  nokogiri (1.12.5-x86_64-linux)
104
100
  racc (~> 1.4)
@@ -147,7 +143,6 @@ GEM
147
143
  tzinfo (2.0.4)
148
144
  concurrent-ruby (~> 1.0)
149
145
  unicode-display_width (2.1.0)
150
- zeitwerk (2.5.1)
151
146
 
152
147
  PLATFORMS
153
148
  x86_64-linux
data/desertcart.gemspec CHANGED
@@ -29,7 +29,7 @@ Gem::Specification.new do |spec|
29
29
  spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
30
30
  spec.require_paths = ['lib']
31
31
 
32
- spec.add_dependency 'ledger_sync', '~> 2.2.0'
32
+ spec.add_dependency 'ledger_sync', '~> 2.3.1'
33
33
  spec.add_development_dependency 'dotenv'
34
34
  spec.add_development_dependency 'rubocop'
35
35
  end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module LedgerSync
4
+ class Error
5
+ class OperationError
6
+ class UnprocessableEntityError < OperationError; end
7
+ end
8
+ end
9
+ end
@@ -11,7 +11,7 @@ module Desertcart
11
11
  params do
12
12
  required(:order_item).maybe(:hash, Types::Reference)
13
13
  optional(:seller_reference_number).maybe(:string)
14
- optional(:final_purchase_price).maybe(:string)
14
+ optional(:final_purchase_price).maybe(:integer)
15
15
  optional(:final_purchase_currency_code).maybe(:string)
16
16
  end
17
17
  end
@@ -10,9 +10,14 @@ module Desertcart
10
10
  private
11
11
 
12
12
  def create_in_ledger
13
- return LedgerSync::Result.Success(response) if response.success?
14
-
15
- fail(response.status)
13
+ case response.status
14
+ when 201
15
+ LedgerSync::Result.Success(response)
16
+ when 422
17
+ rejected
18
+ else
19
+ fail(response.status)
20
+ end
16
21
  end
17
22
 
18
23
  def operate
@@ -44,6 +49,16 @@ module Desertcart
44
49
  resource: @resource
45
50
  )
46
51
  end
52
+
53
+ def rejected
54
+ failure(
55
+ LedgerSync::Error::OperationError::UnprocessableEntityError.new(
56
+ operation: self,
57
+ response: response
58
+ ),
59
+ resource: @resource
60
+ )
61
+ end
47
62
  end
48
63
  end
49
64
  end
@@ -10,9 +10,16 @@ module Desertcart
10
10
  private
11
11
 
12
12
  def update_in_ledger
13
- return LedgerSync::Result.Success(response) if response.success?
14
-
15
- fail(response.status)
13
+ case response.status
14
+ when 200
15
+ LedgerSync::Result.Success(response)
16
+ when 404
17
+ not_found
18
+ when 422
19
+ rejected
20
+ else
21
+ fail(response.status)
22
+ end
16
23
  end
17
24
 
18
25
  def operate
@@ -44,6 +51,26 @@ module Desertcart
44
51
  resource: @resource
45
52
  )
46
53
  end
54
+
55
+ def not_found
56
+ failure(
57
+ LedgerSync::Error::OperationError::NotFoundError.new(
58
+ operation: self,
59
+ response: response
60
+ ),
61
+ resource: @resource
62
+ )
63
+ end
64
+
65
+ def rejected
66
+ failure(
67
+ LedgerSync::Error::OperationError::UnprocessableEntityError.new(
68
+ operation: self,
69
+ response: response
70
+ ),
71
+ resource: @resource
72
+ )
73
+ end
47
74
  end
48
75
  end
49
76
  end
@@ -7,6 +7,8 @@ module Desertcart
7
7
  class OrderItemAcceptance < Desertcart::Resource
8
8
  references_one :order_item, to: Desertcart::Marketplace::OrderItem
9
9
  attribute :seller_reference_number, type: LedgerSync::Type::String
10
+ attribute :final_purchase_price, type: LedgerSync::Type::Integer
11
+ attribute :final_purchase_currency_code, type: LedgerSync::Type::String
10
12
  end
11
13
  end
12
14
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Desertcart
4
- VERSION = '1.1.2'
4
+ VERSION = '1.2.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: desertcart
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.2
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jozef Vaclavik
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-11-22 00:00:00.000000000 Z
11
+ date: 2021-12-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ledger_sync
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 2.2.0
19
+ version: 2.3.1
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 2.2.0
26
+ version: 2.3.1
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: dotenv
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -81,6 +81,7 @@ files:
81
81
  - lib/desertcart/client.rb
82
82
  - lib/desertcart/config.rb
83
83
  - lib/desertcart/deserializer.rb
84
+ - lib/desertcart/error.rb
84
85
  - lib/desertcart/marketplace/authorizations/operations/create.rb
85
86
  - lib/desertcart/marketplace/authorizations/serializer.rb
86
87
  - lib/desertcart/marketplace/movement/deserializer.rb