gmo 0.5.8 → 0.5.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 01b3f2fbd63de33e391333dd6e1d1a2b47ee785ea330aebda9aa461e2adcf6c8
4
- data.tar.gz: 675aa139a33705769efa1764c8176778a492da09232e8ff915b92e376d46e252
3
+ metadata.gz: af1dd3f7ad4b9e6ac9d6ca3031f4667297e6f031aba145d50665d01fc32025e5
4
+ data.tar.gz: 616883c20b27bb5d94a0c4b11abfb3396247abe6da1e592d30282cba9dccb0ac
5
5
  SHA512:
6
- metadata.gz: '0944fb5d4702aa5a1b2e3c035125063ba484f6420c037ad775895d6af5ea99fbc55be979750e37688b78a25eb4a2ffbb9abd4dc72e3e010811ac8a1ce5d4658c'
7
- data.tar.gz: ca482bcc26e1eda87d96c77c24165c9dbf5f4cdc63f451ae3c6ce94d7e0760d41913c4372eafc20b7b7a5c91439255e816a3d17d5ee65ba7eb9231a68228c88b
6
+ metadata.gz: d570dc713d1281eebb404d022f2fdb07eca419f770bdd685d217b2ac7798474e5f03c292b606c59d3beb30f24996152e6b812e05849a636b694edf4658c1bfb4
7
+ data.tar.gz: 121ec172132e99240b194da859e997140758d0a822e49bd55ad36ea114efb38442b462ac8126cc99a99826627bc72d582819d35e4d202f7877031e75f1582522
data/CHANGELOG.md CHANGED
@@ -1,4 +1,7 @@
1
1
  # CHANGELOG
2
+ ## 0.5.9
3
+ - net-http 0.7.0+でcontent typeを明示的に設定する必要がある問題を修正 [#79](https://github.com/t-k/gmo-payment-ruby/pull/79) (Thanks [@johnnyshields](https://github.com/johnnyshields))
4
+
2
5
  ## 0.5.8
3
6
  - クレジットカード決済の3Dセキュア2.0に対応 [#76](https://github.com/t-k/gmo-payment-ruby/pull/76)
4
7
  - 3DS2.0認証実行 (`tds2_auth`)
@@ -44,7 +44,8 @@ module GMO
44
44
  headers = { "Content-Type" => "application/json" }
45
45
  h.post(path, args.to_json, headers)
46
46
  else
47
- h.post(path, encode_params(args))
47
+ headers = { "Content-Type" => "application/x-www-form-urlencoded" }
48
+ h.post(path, encode_params(args), headers)
48
49
  end
49
50
  else
50
51
  h.get("#{path}?#{encode_params(args)}")
data/lib/gmo/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module GMO
2
- VERSION = "0.5.8"
2
+ VERSION = "0.5.9"
3
3
  end
@@ -0,0 +1,88 @@
1
+ require 'spec_helper'
2
+
3
+ class FakeNetHTTPService
4
+ include GMO::NetHTTPService
5
+ end
6
+
7
+ describe "GMO::NetHTTPService" do
8
+
9
+ describe "#make_request" do
10
+ let(:mock_http) { double("Net::HTTP") }
11
+ let(:mock_http_session) { double("Net::HTTP session") }
12
+ let(:mock_response) { double("Net::HTTPResponse", code: "200", body: "AccessID=test123") }
13
+
14
+ before do
15
+ allow(Net::HTTP).to receive(:new).and_return(mock_http)
16
+ allow(mock_http).to receive(:use_ssl=)
17
+ allow(mock_http).to receive(:start).and_yield(mock_http_session)
18
+ end
19
+
20
+ describe "Content-Type header for form-encoded POST requests" do
21
+ it "sets Content-Type to application/x-www-form-urlencoded" do
22
+ expect(mock_http_session).to receive(:post) do |path, body, headers|
23
+ expect(path).to eq("/payment/EntryTran.idPass")
24
+ expect(headers["Content-Type"]).to eq("application/x-www-form-urlencoded")
25
+ mock_response
26
+ end
27
+
28
+ FakeNetHTTPService.make_request(
29
+ "/payment/EntryTran.idPass",
30
+ { "ShopID" => "shop123", "OrderID" => "order456" },
31
+ "post",
32
+ { :host => "example.com" }
33
+ )
34
+ end
35
+
36
+ it "properly encodes form parameters" do
37
+ expect(mock_http_session).to receive(:post) do |path, body, headers|
38
+ expect(path).to eq("/payment/EntryTran.idPass")
39
+ expect(body).to include("ShopID=")
40
+ expect(body).to include("OrderID=")
41
+ expect(headers["Content-Type"]).to eq("application/x-www-form-urlencoded")
42
+ mock_response
43
+ end
44
+
45
+ FakeNetHTTPService.make_request(
46
+ "/payment/EntryTran.idPass",
47
+ { "ShopID" => "shop123", "OrderID" => "order456" },
48
+ "post",
49
+ { :host => "example.com" }
50
+ )
51
+ end
52
+ end
53
+
54
+ describe "Content-Type header for JSON POST requests" do
55
+ it "sets Content-Type to application/json for .json paths" do
56
+ expect(mock_http_session).to receive(:post) do |path, body, headers|
57
+ expect(path).to eq("/payment/EntryTran.json")
58
+ expect(headers["Content-Type"]).to eq("application/json")
59
+ mock_response
60
+ end
61
+
62
+ FakeNetHTTPService.make_request(
63
+ "/payment/EntryTran.json",
64
+ { "ShopID" => "shop123" },
65
+ "post",
66
+ { :host => "example.com" }
67
+ )
68
+ end
69
+ end
70
+
71
+ describe "GET requests" do
72
+ it "appends parameters to query string without Content-Type header" do
73
+ expect(mock_http_session).to receive(:get) do |path_with_query|
74
+ expect(path_with_query).to include("/payment/SearchTrade.idPass?")
75
+ expect(path_with_query).to include("ShopID=")
76
+ mock_response
77
+ end
78
+
79
+ FakeNetHTTPService.make_request(
80
+ "/payment/SearchTrade.idPass",
81
+ { "ShopID" => "shop123" },
82
+ "get",
83
+ { :host => "example.com" }
84
+ )
85
+ end
86
+ end
87
+ end
88
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gmo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.8
4
+ version: 0.5.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tatsuo Kaniwa
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-07-29 00:00:00.000000000 Z
11
+ date: 2026-02-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack
@@ -236,6 +236,7 @@ files:
236
236
  - spec/gmo/errors_spec.rb
237
237
  - spec/gmo/http_service_spec.rb
238
238
  - spec/gmo/json_spec.rb
239
+ - spec/gmo/net_http_service_spec.rb
239
240
  - spec/gmo/remittance_api_spec.rb
240
241
  - spec/gmo/shop_and_site_api_spec.rb
241
242
  - spec/gmo/shop_api_spec.rb