mintsoft 0.1.7 → 0.1.9
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 +4 -4
- data/README.md +9 -2
- data/lib/mintsoft/resources/orders.rb +22 -0
- data/lib/mintsoft/resources/returns.rb +9 -0
- data/lib/mintsoft/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9b07eb48344fbc2e9350b4dfb180155f25849e2e07b6918089b577436b156ea3
|
4
|
+
data.tar.gz: a41f333869f6cee4e8e662aaf227fa10b4ae91221ccfb18df1140b42e7a09ff7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 070433bc3da2e1357514c4aa98a0b7daea60e05403077beca76f9e7910cc1548d2ca6f71e7b8ee37db34a035def363ee793f9d27dab22a74e936bb93e2a1d842
|
7
|
+
data.tar.gz: 2e9a745d24b126e9bdf6a21b3bfddfe6fcc944683f323ed8c715b2a4c903cfd1be7b9dea7be2cfae954ca8d9b3a734d0efc4fbc66603f0208f0cd82772cc10ce
|
data/README.md
CHANGED
@@ -5,7 +5,7 @@ A Ruby wrapper for the Mintsoft API that provides simple token-based authenticat
|
|
5
5
|
## Features
|
6
6
|
|
7
7
|
- **Token-only authentication**: Manual token management for full control
|
8
|
-
- **
|
8
|
+
- **6 Essential API endpoints**: Authentication, Order Search, Return Reasons, Create Returns, Add Return Items, Retrieve Returns
|
9
9
|
- **OpenStruct-based objects**: Flexible response handling with automatic attribute conversion
|
10
10
|
- **Faraday HTTP client**: Robust HTTP handling with JSON support
|
11
11
|
- **Comprehensive error handling**: Clear error messages for common scenarios
|
@@ -120,9 +120,16 @@ result = client.returns.add_item(return_obj.id, {
|
|
120
120
|
notes: "Optional notes"
|
121
121
|
})
|
122
122
|
|
123
|
+
# Retrieve a specific return by ID
|
124
|
+
return_obj = client.returns.retrieve(return_id)
|
125
|
+
|
123
126
|
# Access return properties
|
124
127
|
puts return_obj.id # Direct access to return ID
|
125
|
-
#
|
128
|
+
puts return_obj.order_id # Direct access to order ID
|
129
|
+
puts return_obj.status # Direct access to return status
|
130
|
+
puts return_obj.customer_name # Direct access to customer name
|
131
|
+
puts return_obj.total_value # Direct access to total value
|
132
|
+
# Note: Available properties depend on API response structure
|
126
133
|
```
|
127
134
|
|
128
135
|
### Error Handling
|
@@ -15,17 +15,39 @@ module Mintsoft
|
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
18
|
+
def retrieve(id)
|
19
|
+
validate_id!(id)
|
20
|
+
response = get_request("/api/Order/#{id}")
|
21
|
+
|
22
|
+
if response.status == 404
|
23
|
+
nil # Return nil for not found orders
|
24
|
+
else
|
25
|
+
response_data = handle_response(response)
|
26
|
+
parse_order(response_data)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
18
30
|
private
|
19
31
|
|
20
32
|
def validate_order_number!(order_number)
|
21
33
|
raise ValidationError, "Order number required" if order_number.nil? || order_number.empty?
|
22
34
|
end
|
23
35
|
|
36
|
+
def validate_id!(id)
|
37
|
+
raise ValidationError, "ID must be present" if id.nil? || (id.respond_to?(:empty?) && id.empty?)
|
38
|
+
end
|
39
|
+
|
24
40
|
def parse_orders(data)
|
25
41
|
return [] unless data.is_a?(Array)
|
26
42
|
|
27
43
|
data.map { |order_data| Objects::Order.new(order_data) }
|
28
44
|
end
|
45
|
+
|
46
|
+
def parse_order(data)
|
47
|
+
return nil unless data.is_a?(Hash)
|
48
|
+
|
49
|
+
Objects::Order.new(data)
|
50
|
+
end
|
29
51
|
end
|
30
52
|
end
|
31
53
|
end
|
@@ -31,6 +31,15 @@ module Mintsoft
|
|
31
31
|
Objects::Return.new(response_data)
|
32
32
|
end
|
33
33
|
|
34
|
+
def retrieve(return_id)
|
35
|
+
validate_return_id!(return_id)
|
36
|
+
|
37
|
+
response = get_request("/api/Return/#{return_id}")
|
38
|
+
response_data = handle_response(response)
|
39
|
+
|
40
|
+
Objects::Return.new(response_data)
|
41
|
+
end
|
42
|
+
|
34
43
|
private
|
35
44
|
|
36
45
|
def validate_order_id!(order_id)
|
data/lib/mintsoft/version.rb
CHANGED