seko_ecom_api 0.1.3 → 0.1.7
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/CHANGELOG.md +5 -0
- data/Gemfile.lock +3 -3
- data/README.md +10 -0
- data/lib/seko_ecom_api/clients/omni_returns_client.rb +15 -6
- data/lib/seko_ecom_api/error.rb +3 -0
- data/lib/seko_ecom_api/version.rb +1 -1
- data/lib/seko_ecom_api.rb +1 -0
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a41a027114e50992ec48ee4b802d70efa63ae11464846a43c48cc2fd5ab47d2d
|
|
4
|
+
data.tar.gz: 84259d77ebc536c28ad54b14136c7a78892703c04e31035394805cdf3cf2d98d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9737617efef68c1613c3c8238c12cf9ecfe33441ea4039b4a64be1db07af403f7e0b7dbc81a48d9762acc2314ec62c358e44d79be682ba6d460a40265b88f90d
|
|
7
|
+
data.tar.gz: f6793fb20021b8253fca6f9d3a989b02a02f1ff27e8212c2172a4ee25721ca5f6ffb88225691f9860990e0a8f25e2a37b4712f9909f2fb5ec2656ca64fdab784
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
## [Unreleased]
|
|
2
2
|
|
|
3
|
+
## [0.1.7] - 2026-11-13
|
|
4
|
+
|
|
5
|
+
- `OmniReturnsClient` sends production requests to `https://www.omniparcelreturns.com/api/`. Since 12 Nov 2026 Seko redirects the old `/index.php/api/` address with a 307.
|
|
6
|
+
- A 3xx response raises `SekoEcomAPI::RedirectError`, a `ParseError` subclass whose message names the new address.
|
|
7
|
+
|
|
3
8
|
## [0.1.0] - 2023-05-23
|
|
4
9
|
|
|
5
10
|
- Initial release
|
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
seko_ecom_api (0.1.
|
|
4
|
+
seko_ecom_api (0.1.3)
|
|
5
5
|
activesupport
|
|
6
6
|
faraday (~> 2.7)
|
|
7
7
|
faraday-encoding
|
|
@@ -26,7 +26,7 @@ GEM
|
|
|
26
26
|
domain_name (0.5.20190701)
|
|
27
27
|
unf (>= 0.0.5, < 1.0.0)
|
|
28
28
|
dotenv (2.8.1)
|
|
29
|
-
faraday (2.7.
|
|
29
|
+
faraday (2.7.6)
|
|
30
30
|
faraday-net_http (>= 2.0, < 3.1)
|
|
31
31
|
ruby2_keywords (>= 0.0.4)
|
|
32
32
|
faraday-encoding (0.0.5)
|
|
@@ -55,7 +55,7 @@ GEM
|
|
|
55
55
|
ffi-compiler (~> 1.0)
|
|
56
56
|
rake (~> 13.0)
|
|
57
57
|
method_source (1.0.0)
|
|
58
|
-
minitest (5.18.
|
|
58
|
+
minitest (5.18.1)
|
|
59
59
|
parallel (1.23.0)
|
|
60
60
|
parser (3.2.2.1)
|
|
61
61
|
ast (~> 2.4.1)
|
data/README.md
CHANGED
|
@@ -106,3 +106,13 @@ The gem is available as open source under the terms of the [MIT License](https:/
|
|
|
106
106
|
## Code of Conduct
|
|
107
107
|
|
|
108
108
|
Everyone interacting in the SekoEcomApi project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/seko_ecom_api/blob/pc-2546-setup-sekoecomapi/CODE_OF_CONDUCT.md).
|
|
109
|
+
|
|
110
|
+
## Publishing
|
|
111
|
+
|
|
112
|
+
Pushing a version tag publishes the gem through RubyGems trusted publishing (`.github/workflows/publish.yml`). Bump `lib/seko_ecom_api/version.rb`, add a CHANGELOG entry, merge to `main`, then tag that commit:
|
|
113
|
+
|
|
114
|
+
```sh
|
|
115
|
+
git tag v0.1.8 && git push origin v0.1.8
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
The workflow fails if the tag doesn't match the version.
|
|
@@ -7,7 +7,7 @@ module SekoEcomAPI
|
|
|
7
7
|
class OmniReturnsClient
|
|
8
8
|
include Client
|
|
9
9
|
|
|
10
|
-
BASE_URL = 'https://www.omniparcelreturns.com/
|
|
10
|
+
BASE_URL = 'https://www.omniparcelreturns.com/api/'.freeze
|
|
11
11
|
TEST_BASE_URL = 'https://test.omniparcelreturns.com/index.php/api/'.freeze
|
|
12
12
|
|
|
13
13
|
attr_reader :access_key, :adapter, :test, :conn_opts
|
|
@@ -41,15 +41,21 @@ module SekoEcomAPI
|
|
|
41
41
|
# since Seko seems to send a 200 OK response even if there're errors
|
|
42
42
|
# we will need to also check for errors in the response body
|
|
43
43
|
def handle_response(response)
|
|
44
|
-
|
|
44
|
+
raise_redirect(response) if (300..399).cover?(response.status)
|
|
45
|
+
|
|
45
46
|
parsed_response = parse_response(response)
|
|
46
|
-
response_errors = parsed_response['errors']
|
|
47
|
+
response_errors = parsed_response['errors'] || parsed_response['message']
|
|
47
48
|
|
|
48
|
-
raise(Error, "Something went wrong. #{response_errors}") unless response_errors
|
|
49
|
+
raise(Error, "Something went wrong. #{response_errors}") unless response_errors&.empty?
|
|
49
50
|
|
|
50
51
|
parsed_response
|
|
51
52
|
end
|
|
52
53
|
|
|
54
|
+
def raise_redirect(response)
|
|
55
|
+
message = "Seko redirected the request to #{response.headers['location']}."
|
|
56
|
+
raise RedirectError.new(message, error_response(response))
|
|
57
|
+
end
|
|
58
|
+
|
|
53
59
|
# need to be manual parsed here instead of in the middleware
|
|
54
60
|
# since Seko response's Content-Type is always in 'text/html'
|
|
55
61
|
# with the response body can be in JSON or in html
|
|
@@ -57,8 +63,11 @@ module SekoEcomAPI
|
|
|
57
63
|
parsed_response = JSON.parse(response.body)
|
|
58
64
|
parsed_response.deep_transform_keys(&:underscore)
|
|
59
65
|
rescue JSON::ParserError
|
|
60
|
-
|
|
61
|
-
|
|
66
|
+
raise ParseError.new('Response body cannot be parsed.', error_response(response))
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
def error_response(response)
|
|
70
|
+
Struct.new(:body, :headers).new(response.body, response.headers)
|
|
62
71
|
end
|
|
63
72
|
end
|
|
64
73
|
end
|
data/lib/seko_ecom_api/error.rb
CHANGED
data/lib/seko_ecom_api.rb
CHANGED
|
@@ -3,6 +3,7 @@ require_relative 'seko_ecom_api/version'
|
|
|
3
3
|
module SekoEcomAPI
|
|
4
4
|
autoload :Error, 'seko_ecom_api/error'
|
|
5
5
|
autoload :ParseError, 'seko_ecom_api/error'
|
|
6
|
+
autoload :RedirectError, 'seko_ecom_api/error'
|
|
6
7
|
autoload :Object, 'seko_ecom_api/object'
|
|
7
8
|
autoload :Client, 'seko_ecom_api/client'
|
|
8
9
|
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: seko_ecom_api
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.7
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jane Trang Mai Nguyen
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2026-11-13 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activesupport
|
|
@@ -170,7 +170,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
170
170
|
- !ruby/object:Gem::Version
|
|
171
171
|
version: '0'
|
|
172
172
|
requirements: []
|
|
173
|
-
rubygems_version: 3.
|
|
173
|
+
rubygems_version: 3.5.22
|
|
174
174
|
signing_key:
|
|
175
175
|
specification_version: 4
|
|
176
176
|
summary: Seko Ecommerce API Wrapper
|