paypal-rest-api 0.2.1 → 0.3.0
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/VERSION +1 -1
- data/lib/paypal-api/request.rb +12 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2175195520b60ede367903d5fcecb9f4d2635984829b03310732a246aa32b7ff
|
4
|
+
data.tar.gz: 89de6af2dcc2a8bb662d9c31cdb9cf07dc940975462b319eba33ea7d339f738d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6af08d2783b8a0c56e50d0cc6cfbe4c4cc21e20c7d0b6657928815abf4e0388c35456f4ab242341834c9872db3beb4a535f7674b9e3cdef14f4b171d031a67d5
|
7
|
+
data.tar.gz: e4f9d202ce476c8cd03c161807a1a192f762cc912b50567e1b1b3fdc7064422a0ffe0d19aabab574523563fa9e393ee6cb81fee1e63a64c5bf83332b4900d497
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.3.0
|
data/lib/paypal-api/request.rb
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
require "securerandom"
|
4
4
|
require "json"
|
5
|
+
require "debug"
|
5
6
|
|
6
7
|
module PaypalAPI
|
7
8
|
#
|
@@ -74,7 +75,6 @@ module PaypalAPI
|
|
74
75
|
def build_http_request(request_type, path, body:, query:, headers:)
|
75
76
|
uri = build_http_uri(path, query)
|
76
77
|
http_request = request_type.new(uri, "accept-encoding" => nil)
|
77
|
-
|
78
78
|
build_http_headers(http_request, body, headers || {})
|
79
79
|
build_http_body(http_request, body)
|
80
80
|
|
@@ -88,8 +88,18 @@ module PaypalAPI
|
|
88
88
|
http_request["authorization"] = client.access_token.authorization_string
|
89
89
|
end
|
90
90
|
|
91
|
+
#
|
92
|
+
# We should set json content type header to not get 415 UnsupportedMediaType
|
93
|
+
# error in various APIs
|
94
|
+
#
|
95
|
+
# PayPal requires "application/json" content type even for GET requests
|
96
|
+
# and for POST requests without body.
|
97
|
+
#
|
98
|
+
# Net::HTTP sets default content-type "application/x-www-form-urlencoded"
|
99
|
+
# if not provided
|
100
|
+
#
|
91
101
|
unless headers.key?("content-type")
|
92
|
-
http_request["content-type"] = "application/json"
|
102
|
+
http_request["content-type"] = "application/json"
|
93
103
|
end
|
94
104
|
|
95
105
|
unless headers.key?("paypal-request-id")
|