paypalhttp 2.0.0 → 2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/paypalhttp/serializers/form_encoded.rb +6 -2
- data/lib/paypalhttp/version.rb +1 -1
- data/spec/paypalhttp/encoder_spec.rb +20 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e7b784f809b45daa88b7b605a078233f9d6d6389de4d22c58810ad904b1e6270
|
4
|
+
data.tar.gz: 83f24bf689519c48fb95474ffca65635b2c27eacecbabc4e4194761f88e2bceb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f6ccd5a75ac2a07ef84c2cc55d4caacd529bd075315ec040066b1c5cdd625d5de048e11b483318eb7adc3065ceec1ac9d3aed568df4dbc1cba30bf390749cafb
|
7
|
+
data.tar.gz: cebe0720259ce83416259eed470253ba5ec716eb329216617fd79a4eabf16a576a4e5c54a9b967852c3a0009fe478a37910aacfff333bdf75b41fa2acdc1113e
|
@@ -1,11 +1,15 @@
|
|
1
|
-
require '
|
1
|
+
require 'uri'
|
2
2
|
|
3
3
|
module PayPalHttp
|
4
4
|
class FormEncoded
|
5
|
+
def initialize
|
6
|
+
@parser = URI::Parser.new()
|
7
|
+
end
|
8
|
+
|
5
9
|
def encode(request)
|
6
10
|
encoded_params = []
|
7
11
|
request.body.each do |k, v|
|
8
|
-
encoded_params.push("#{
|
12
|
+
encoded_params.push("#{@parser.escape(k.to_s)}=#{@parser.escape(v.to_s)}")
|
9
13
|
end
|
10
14
|
|
11
15
|
encoded_params.join("&")
|
data/lib/paypalhttp/version.rb
CHANGED
@@ -1 +1 @@
|
|
1
|
-
VERSION = "2.0.
|
1
|
+
VERSION = "2.0.1"
|
@@ -105,10 +105,10 @@ describe Encoder do
|
|
105
105
|
})
|
106
106
|
serialized = Encoder.new.serialize_request(req)
|
107
107
|
|
108
|
-
expect(serialized).to eq("key=value
|
108
|
+
expect(serialized).to eq("key=value%20with%20a%20space&another_key=1013")
|
109
109
|
end
|
110
110
|
|
111
|
-
it 'encodes different special/unsafe characters when using
|
111
|
+
it 'encodes different special/unsafe characters when using a URI parser' do
|
112
112
|
req = OpenStruct.new({
|
113
113
|
:verb => "POST",
|
114
114
|
:path => "/v1/api",
|
@@ -116,13 +116,29 @@ describe Encoder do
|
|
116
116
|
"content-type" => "application/x-www-form-urlencoded; charset=utf8"
|
117
117
|
},
|
118
118
|
:body => {
|
119
|
-
:key => " ..<..>..%..{..}
|
119
|
+
:key => " ..<..>..%..{..}..|..^..`..!",
|
120
120
|
:another_key => 1013,
|
121
121
|
}
|
122
122
|
})
|
123
123
|
serialized = Encoder.new.serialize_request(req)
|
124
124
|
|
125
|
-
expect(serialized).to eq("key
|
125
|
+
expect(serialized).to eq("key=%20..%3C..%3E..%25..%7B..%7D..%7C..%5E..%60..!&another_key=1013")
|
126
|
+
end
|
127
|
+
|
128
|
+
it 'does not encode links given certain special characters' do
|
129
|
+
req = OpenStruct.new({
|
130
|
+
:verb => "POST",
|
131
|
+
:path => "/v1/api",
|
132
|
+
:headers => {
|
133
|
+
"content-type" => "application/x-www-form-urlencoded; charset=utf8"
|
134
|
+
},
|
135
|
+
:body => {
|
136
|
+
:key => "https://localhost:3001/"
|
137
|
+
}
|
138
|
+
})
|
139
|
+
serialized = Encoder.new.serialize_request(req)
|
140
|
+
|
141
|
+
expect(serialized).to eq("key=https://localhost:3001/")
|
126
142
|
end
|
127
143
|
|
128
144
|
it 'throws when content-type is unsupported' do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: paypalhttp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- PayPal
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-07-
|
11
|
+
date: 2022-07-27 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Used for generated API clients
|
14
14
|
email:
|