mintsoft 0.1.11 → 0.1.12

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 193f53b2dad0b19c81c5eb571928dde974fd46fe02f096b6093a33119528b074
4
- data.tar.gz: 6968738d3114be16799ffd322fcecf8d4500cc913c5b557fd01c8694bc9271d9
3
+ metadata.gz: f04dc7cd3bc75a9c2b2bc1d7cc36c247003fd0428e9c9a7d03ffc54831640429
4
+ data.tar.gz: cb488c9c266ddb1b346b5e055872918e59cdee4b6661daf055b95bc463dfca09
5
5
  SHA512:
6
- metadata.gz: 36a1196c64c41022aa01ff352fb4ae13e0d100937f864cd8cc2ad965439dea86c435f89e92fee2332e4725ed1f87bba64299b837fa188ec88e32e6823abafab5
7
- data.tar.gz: bb75d0cca832ea9e1f5f9a017587dbb45d20685fdffc1656952abfca76954dba7ea55deb04b54a55c2e2dd3f256f1097df5e10f990a10e28b10f8af1f564a137
6
+ metadata.gz: a329bf4a4a08129b09d3cf15f22e8e199b56218a747b0ef2007c8fa601913189df67a9b58fbb51d7d93ccad62609aa3cdf30ac043223b648d45983313e275060
7
+ data.tar.gz: ddd83252d8a4a3140cfce31220c687413b197100fcad8b864bf90dcd20b6e801780000a0f2b24246ed2f64183ef38ad5facd11d3dff330cd8afbdb563e79f2bf
data/README.md CHANGED
@@ -68,6 +68,8 @@ rescue Mintsoft::AuthClient::AuthenticationError => e
68
68
  puts "Authentication failed: #{e.message}"
69
69
  rescue Mintsoft::AuthenticationError => e
70
70
  puts "Token expired: #{e.message}"
71
+ rescue Mintsoft::ForbiddenError => e
72
+ puts "Insufficient permissions: #{e.message}"
71
73
  rescue Mintsoft::ValidationError => e
72
74
  puts "Validation error: #{e.message}"
73
75
  end
@@ -135,13 +137,18 @@ active_reasons = reasons.select(&:active?)
135
137
  return_obj = client.returns.create(order_id)
136
138
 
137
139
  # Add item to return
138
- result = client.returns.add_item(return_obj.id, {
139
- product_id: 123,
140
- quantity: 2,
141
- reason_id: reason_id,
142
- unit_value: 25.00,
143
- notes: "Optional notes"
144
- })
140
+ begin
141
+ result = client.returns.add_item(return_obj.id, {
142
+ product_id: 123,
143
+ quantity: 2,
144
+ reason_id: reason_id,
145
+ unit_value: 25.00,
146
+ notes: "Optional notes"
147
+ })
148
+ rescue Mintsoft::ForbiddenError => e
149
+ # This typically occurs when credentials don't have permission to add items to returns
150
+ puts "Permission denied: #{e.message}"
151
+ end
145
152
 
146
153
  # Retrieve a specific return by ID
147
154
  return_obj = client.returns.retrieve(return_id)
@@ -170,6 +177,10 @@ rescue Mintsoft::AuthClient::AuthenticationError => e
170
177
  # Invalid credentials when getting auth token
171
178
  puts "Auth client authentication failed: #{e.message}"
172
179
  puts "Status: #{e.status_code}"
180
+ rescue Mintsoft::ForbiddenError => e
181
+ # Insufficient permissions (403) - typically when adding items to returns
182
+ puts "Insufficient permissions: #{e.message}"
183
+ puts "Status: #{e.status_code}"
173
184
  rescue Mintsoft::ValidationError => e
174
185
  # Invalid request data (400)
175
186
  puts "Validation error: #{e.message}"
@@ -18,6 +18,8 @@ module Mintsoft
18
18
  # Authentication and authorization errors
19
19
  class AuthenticationError < APIError; end
20
20
 
21
+ class ForbiddenError < APIError; end
22
+
21
23
  # Request validation errors
22
24
  class ValidationError < APIError; end
23
25
  end
@@ -36,6 +36,7 @@ module Mintsoft
36
36
  error_class = case response.status
37
37
  when 400 then ValidationError
38
38
  when 401 then AuthenticationError
39
+ when 403 then ForbiddenError
39
40
  else APIError
40
41
  end
41
42
 
@@ -45,10 +46,12 @@ module Mintsoft
45
46
 
46
47
  def build_error_message(status, error_message)
47
48
  case status
48
- when 401
49
- "Invalid or expired token"
50
49
  when 400
51
50
  "Invalid request data: #{error_message}"
51
+ when 401
52
+ "Invalid or expired token"
53
+ when 403
54
+ "Insufficient permissions"
52
55
  else
53
56
  "API error: #{status} - #{error_message}"
54
57
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Mintsoft
4
- VERSION = "0.1.11"
4
+ VERSION = "0.1.12"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mintsoft
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.11
4
+ version: 0.1.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Chong