paypalhttp 1.0.1 → 2.0.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 +4 -4
- data/lib/paypalhttp/serializers/form_encoded.rb +5 -1
- data/lib/paypalhttp/version.rb +1 -1
- data/spec/paypalhttp/encoder_spec.rb +33 -0
- metadata +8 -8
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
|
@@ -2,10 +2,14 @@ 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 = "
|
1
|
+
VERSION = "2.0.1"
|
@@ -108,6 +108,39 @@ describe Encoder do
|
|
108
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 a URI parser' do
|
112
|
+
req = OpenStruct.new({
|
113
|
+
:verb => "POST",
|
114
|
+
:path => "/v1/api",
|
115
|
+
:headers => {
|
116
|
+
"content-type" => "application/x-www-form-urlencoded; charset=utf8"
|
117
|
+
},
|
118
|
+
:body => {
|
119
|
+
:key => " ..<..>..%..{..}..|..^..`..!",
|
120
|
+
:another_key => 1013,
|
121
|
+
}
|
122
|
+
})
|
123
|
+
serialized = Encoder.new.serialize_request(req)
|
124
|
+
|
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/")
|
142
|
+
end
|
143
|
+
|
111
144
|
it 'throws when content-type is unsupported' do
|
112
145
|
req = OpenStruct.new({
|
113
146
|
:headers => {
|
metadata
CHANGED
@@ -1,17 +1,17 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: paypalhttp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- PayPal
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-07-27 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Used for generated API clients
|
14
|
-
email:
|
14
|
+
email:
|
15
15
|
executables: []
|
16
16
|
extensions: []
|
17
17
|
extra_rdoc_files: []
|
@@ -33,11 +33,11 @@ files:
|
|
33
33
|
- spec/paypalhttp/serializers/form_part_spec.rb
|
34
34
|
- spec/paypalhttp/serializers/multipart_spec.rb
|
35
35
|
- spec/spec_helper.rb
|
36
|
-
homepage:
|
36
|
+
homepage:
|
37
37
|
licenses:
|
38
38
|
- MIT
|
39
39
|
metadata: {}
|
40
|
-
post_install_message:
|
40
|
+
post_install_message:
|
41
41
|
rdoc_options: []
|
42
42
|
require_paths:
|
43
43
|
- lib
|
@@ -52,8 +52,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
52
52
|
- !ruby/object:Gem::Version
|
53
53
|
version: '0'
|
54
54
|
requirements: []
|
55
|
-
rubygems_version: 3.0.
|
56
|
-
signing_key:
|
55
|
+
rubygems_version: 3.0.3.1
|
56
|
+
signing_key:
|
57
57
|
specification_version: 4
|
58
58
|
summary: PayPalHttp Client Library
|
59
59
|
test_files: []
|