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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/VERSION +1 -1
  3. data/lib/paypal-api/request.rb +12 -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: 2175195520b60ede367903d5fcecb9f4d2635984829b03310732a246aa32b7ff
4
+ data.tar.gz: 89de6af2dcc2a8bb662d9c31cdb9cf07dc940975462b319eba33ea7d339f738d
5
5
  SHA512:
6
- metadata.gz: 15d2abe1866d6724c00520b43dfec0ac4b9e8383039e3580b78c182bbd184fd2499c0beaa1328500453e85868622fc0e1e49a4dbdc4f58e6401258021f04dd69
7
- data.tar.gz: c51693b8445126a269f7d356baa4cba3ca40ffc0a19e80bc1278b69061146e723589237ac85a5940381309868f2af2e619cbdc4bc76295f0420d7606ab010d45
6
+ metadata.gz: 6af08d2783b8a0c56e50d0cc6cfbe4c4cc21e20c7d0b6657928815abf4e0388c35456f4ab242341834c9872db3beb4a535f7674b9e3cdef14f4b171d031a67d5
7
+ data.tar.gz: e4f9d202ce476c8cd03c161807a1a192f762cc912b50567e1b1b3fdc7064422a0ffe0d19aabab574523563fa9e393ee6cb81fee1e63a64c5bf83332b4900d497
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.1
1
+ 0.3.0
@@ -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" if body
102
+ http_request["content-type"] = "application/json"
93
103
  end
94
104
 
95
105
  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.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrey Glushkov