payload-api 0.6.0 → 0.6.1

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: 74c2fd7f99fba4cf6b0f1950d013debc81c56629a5b280e7ac79e4e4abd88838
4
- data.tar.gz: abf8b305b33a0e9a5241f5664807842989b7d423781f35606607298c9297d35a
3
+ metadata.gz: a6364ada87b188e97370c985aaee315c1abe7149162d0bfe1a1feca21407e416
4
+ data.tar.gz: 0ba29b0d267e6dbe078c0ffe8a20ac915cfebb515e9ac20f6d7f8697160a45d5
5
5
  SHA512:
6
- metadata.gz: 0e34c4a1a585078565d876af179d8e9b3344888ca44a08f9465ac2e740f5f112990d8b7564b7c0394e21dc4eae22c9b5e0e804850c23cb39d5ffd789ad055319
7
- data.tar.gz: ad8721f83c061113c6abcf4e26f7077e9c07b7a4d34b60d8cdaa9d4f61ad599443cc1e8511d46983d7acd368601b6596b42cd6cef9509dd3cc4a0a89c9492202
6
+ metadata.gz: d6e5b2ebca0650bc0358a0d8883681363a519795ffa49349fb936f821175d9d173f45ad49c86553ac701f3a284bfd48f8cdf901831fa7b559a7dc13c0f0adb07
7
+ data.tar.gz: 18634323e7c0221562430f79fc68638f2db08f2ee9caea5bb2b3c7b3f577aa2d8b70627ad17af9e3b72d2f9ed802ef211b69a2bc60566036b8922f3bb2b35b5b
@@ -179,12 +179,14 @@ module Payload
179
179
  if @cls.spec.key?("endpoint")
180
180
  endpoint = @cls.spec["endpoint"]
181
181
  else
182
- endpoint = "/"+@cls.spec["object"]+"s"
182
+ obj = @cls.spec["object"]
183
+ endpoint = "/" + (obj.end_with?("s") ? obj : obj + "s")
183
184
  end
184
185
  else
185
186
  if json.is_a? Array
186
187
  if json.all? {|obj| obj.key?("object") }
187
- endpoint = json[0]["object"]+"s"
188
+ obj = json[0]["object"]
189
+ endpoint = (obj.end_with?("s") ? obj : obj + "s")
188
190
  end
189
191
  end
190
192
  end
@@ -1,3 +1,3 @@
1
1
  module Payload
2
- VERSION = '0.6.0'
2
+ VERSION = '0.6.1'
3
3
  end
@@ -1017,4 +1017,41 @@ RSpec.describe Payload::ARMRequest do
1017
1017
  end
1018
1018
  end
1019
1019
  end
1020
+
1021
+ describe "default endpoint pluralization (object name → path)" do
1022
+ context "when spec object name ends with 's' (e.g. processing_settings)" do
1023
+ it "uses object name as path segment without appending 's'" do
1024
+ klass = Class.new(Payload::ARMObject) do
1025
+ @spec = { "object" => "processing_settings" }
1026
+ end
1027
+ session = Payload::Session.new("test_key", "https://api.test.com")
1028
+ instance = Payload::ARMRequest.new(klass, session)
1029
+
1030
+ expect(instance).to receive(:_execute_request) do |_http, request|
1031
+ expect(request.path).to start_with("/processing_settings/")
1032
+ expect(request.path).not_to include("processing_settingss")
1033
+ double(code: "200", body: '{"object":"processing_settings","id":"ps_123"}')
1034
+ end
1035
+
1036
+ instance.get("ps_123")
1037
+ end
1038
+ end
1039
+
1040
+ context "when spec object name does not end with 's' (e.g. transaction)" do
1041
+ it "appends 's' to build path segment" do
1042
+ klass = Class.new(Payload::ARMObject) do
1043
+ @spec = { "object" => "transaction" }
1044
+ end
1045
+ session = Payload::Session.new("test_key", "https://api.test.com")
1046
+ instance = Payload::ARMRequest.new(klass, session)
1047
+
1048
+ expect(instance).to receive(:_execute_request) do |_http, request|
1049
+ expect(request.path).to start_with("/transactions/")
1050
+ double(code: "200", body: '{"object":"transaction","id":"txn_456"}')
1051
+ end
1052
+
1053
+ instance.get("txn_456")
1054
+ end
1055
+ end
1056
+ end
1020
1057
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: payload-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Payload
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-02-09 00:00:00.000000000 Z
11
+ date: 2026-02-10 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A simple library to interface with the Payload API. See https://docs.payload.com
14
14
  for details.