Class: PaypalAPI::Request
- Inherits:
-
Object
- Object
- PaypalAPI::Request
- Defined in:
- lib/paypal-api/request.rb
Overview
Builds PaypalAPI::Request:
-
assigns query params
-
assigns body params
-
assigns Authentication header
-
assigns paypal-request-id header
-
assigns content-type header
Instance Attribute Summary collapse
-
#client ⇒ Client
readonly
Current PaypalAPI Client.
-
#context ⇒ Hash, ...
Custom context that can be set/changed in callbacks.
-
#http_request ⇒ Net::HTTPRequest
readonly
Generated Net::HTTPRequest.
Instance Method Summary collapse
-
#body ⇒ String
HTTP request body.
-
#headers ⇒ Hash
HTTP request headers.
-
#initialize(client, request_type, path, body: nil, query: nil, headers: nil) ⇒ Request
constructor
Initializes Request object.
-
#method ⇒ String
HTTP request method name.
-
#path ⇒ String
HTTP request method name.
-
#uri ⇒ URI
HTTP request URI.
Constructor Details
#initialize(client, request_type, path, body: nil, query: nil, headers: nil) ⇒ Request
Initializes Request object
40 41 42 43 44 |
# File 'lib/paypal-api/request.rb', line 40 def initialize(client, request_type, path, body: nil, query: nil, headers: nil) @client = client @http_request = build_http_request(request_type, path, body: body, query: query, headers: headers) @context = nil end |
Instance Attribute Details
#client ⇒ Client (readonly)
Returns Current PaypalAPI Client.
17 18 19 |
# File 'lib/paypal-api/request.rb', line 17 def client @client end |
#context ⇒ Hash, ...
Returns Custom context that can be set/changed in callbacks.
23 24 25 |
# File 'lib/paypal-api/request.rb', line 23 def context @context end |
#http_request ⇒ Net::HTTPRequest (readonly)
Returns Generated Net::HTTPRequest.
20 21 22 |
# File 'lib/paypal-api/request.rb', line 20 def http_request @http_request end |
Instance Method Details
#body ⇒ String
Returns HTTP request body.
63 64 65 |
# File 'lib/paypal-api/request.rb', line 63 def body http_request.body end |
#headers ⇒ Hash
Returns HTTP request headers.
68 69 70 |
# File 'lib/paypal-api/request.rb', line 68 def headers http_request.each_header.to_h end |
#method ⇒ String
Returns HTTP request method name.
48 49 50 |
# File 'lib/paypal-api/request.rb', line 48 def method http_request.method end |
#path ⇒ String
Returns HTTP request method name.
53 54 55 |
# File 'lib/paypal-api/request.rb', line 53 def path http_request.path end |
#uri ⇒ URI
Returns HTTP request URI.
58 59 60 |
# File 'lib/paypal-api/request.rb', line 58 def uri http_request.uri end |