Class: Bambora::Rest::WWWFormClient
- Defined in:
- lib/bambora/rest/www_form_client.rb
Overview
The base class for making www form urlencoded requests.
Constant Summary collapse
- CONTENT_TYPE =
'application/x-www-form-urlencoded'
Instance Attribute Summary
Attributes inherited from Client
#base_url, #merchant_id, #sub_merchant_id
Instance Method Summary collapse
-
#post(path:, body:) ⇒ Hash
Make a POST Request.
Methods inherited from Client
Constructor Details
This class inherits a constructor from Bambora::Rest::Client
Instance Method Details
#post(path:, body:) ⇒ Hash
Make a POST Request.
16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/bambora/rest/www_form_client.rb', line 16 def post(path:, body:) # Both Faraday's and Excon's docs show that you can pass a hash into the +body+ and set the content type to # application/x-www-form-urlencoded and the +body+ will be transformed into query parameters, however, this # did not work in testing so I am manually transforming the hash into query parameters here. parse_response_body( super( path: path, body: Bambora::Builders::WWWFormParameters.new(body: body).to_s, headers: build_headers, ), ) end |