seko_ecom_api 0.1.6 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 405424563b02d158dc959588e432f013d29672ae32e4c51da51ddc5792579750
4
- data.tar.gz: 261a2a929f629c2139bae911be2547084146a99799078b4b24ee646bbd0b427f
3
+ metadata.gz: a41a027114e50992ec48ee4b802d70efa63ae11464846a43c48cc2fd5ab47d2d
4
+ data.tar.gz: 84259d77ebc536c28ad54b14136c7a78892703c04e31035394805cdf3cf2d98d
5
5
  SHA512:
6
- metadata.gz: 5b3e8d2d5acb048d2dcf77631abc986318b0dc8e1d400bd9295f274a43ddc8acf9177ba1ae01f1aecc5010ce5d4e3c857830e35783dc3fae4d51471b78efb930
7
- data.tar.gz: 174298f00951f4f0b07703296dc1faf8e9e101184c6222e613a6cdcfe1de164762f20aa4dd7e82e49737c9c1c23b4e41b171a577e9ee3cf8f4db1c5cb43066e3
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/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/index.php/api/'.freeze
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,6 +41,8 @@ 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
+ raise_redirect(response) if (300..399).cover?(response.status)
45
+
44
46
  parsed_response = parse_response(response)
45
47
  response_errors = parsed_response['errors'] || parsed_response['message']
46
48
 
@@ -49,6 +51,11 @@ module SekoEcomAPI
49
51
  parsed_response
50
52
  end
51
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
+
52
59
  # need to be manual parsed here instead of in the middleware
53
60
  # since Seko response's Content-Type is always in 'text/html'
54
61
  # with the response body can be in JSON or in html
@@ -56,8 +63,11 @@ module SekoEcomAPI
56
63
  parsed_response = JSON.parse(response.body)
57
64
  parsed_response.deep_transform_keys(&:underscore)
58
65
  rescue JSON::ParserError
59
- error_response = Struct.new(:body, :headers).new(response.body, response.headers)
60
- raise ParseError.new('Response body cannot be parsed.', error_response)
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)
61
71
  end
62
72
  end
63
73
  end
@@ -9,4 +9,7 @@ module SekoEcomAPI
9
9
  @response = response
10
10
  end
11
11
  end
12
+
13
+ class RedirectError < ParseError
14
+ end
12
15
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SekoEcomAPI
4
- VERSION = "0.1.6"
4
+ VERSION = "0.1.7"
5
5
  end
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.6
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: 2024-06-17 00:00:00.000000000 Z
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.5.6
173
+ rubygems_version: 3.5.22
174
174
  signing_key:
175
175
  specification_version: 4
176
176
  summary: Seko Ecommerce API Wrapper