paypal-rest-api 0.2.1 → 0.3.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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/VERSION +1 -1
  3. data/lib/paypal-api/request.rb +11 -2
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d478a936d84b05a9f4a6eb98491649648250cc49dcb3f524381404d9ded0084f
4
- data.tar.gz: 5ec4bc0bbf68f3be84ce5cd1cd31e85f6fec5c9bc6ce795fd3b64eea902d033f
3
+ metadata.gz: cb41159069ce06e4af428ec51fd553c176383626ac51eae019484f7bf65d22c8
4
+ data.tar.gz: 6c91629dd7dc266198642ae2ed4606c764cf8e376a39695fb7fbdf5ebfd22e28
5
5
  SHA512:
6
- metadata.gz: 15d2abe1866d6724c00520b43dfec0ac4b9e8383039e3580b78c182bbd184fd2499c0beaa1328500453e85868622fc0e1e49a4dbdc4f58e6401258021f04dd69
7
- data.tar.gz: c51693b8445126a269f7d356baa4cba3ca40ffc0a19e80bc1278b69061146e723589237ac85a5940381309868f2af2e619cbdc4bc76295f0420d7606ab010d45
6
+ metadata.gz: 4dfa83c73dbf06ac3badf8151241baa837a075f17bbe40927b8b1280bbff3867bdf8da3b4ed2e4b4126530767019aabf82899941edc0efeccdca42eba7d597e5
7
+ data.tar.gz: '08df1fc1d94b9c395e684a366aed64c50f94a2e357ee1d0ddb0894ba2bd5db7a2a8513799caa6138c87784fe1932f7bbcd8028f0c679e843fa9f0cfbe9b97f69'
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.1
1
+ 0.3.1
@@ -74,7 +74,6 @@ module PaypalAPI
74
74
  def build_http_request(request_type, path, body:, query:, headers:)
75
75
  uri = build_http_uri(path, query)
76
76
  http_request = request_type.new(uri, "accept-encoding" => nil)
77
-
78
77
  build_http_headers(http_request, body, headers || {})
79
78
  build_http_body(http_request, body)
80
79
 
@@ -88,8 +87,18 @@ module PaypalAPI
88
87
  http_request["authorization"] = client.access_token.authorization_string
89
88
  end
90
89
 
90
+ #
91
+ # We should set json content type header to not get 415 UnsupportedMediaType
92
+ # error in various APIs
93
+ #
94
+ # PayPal requires "application/json" content type even for GET requests
95
+ # and for POST requests without body.
96
+ #
97
+ # Net::HTTP sets default content-type "application/x-www-form-urlencoded"
98
+ # if not provided
99
+ #
91
100
  unless headers.key?("content-type")
92
- http_request["content-type"] = "application/json" if body
101
+ http_request["content-type"] = "application/json"
93
102
  end
94
103
 
95
104
  unless headers.key?("paypal-request-id")
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: paypal-rest-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrey Glushkov