Class: Ilovepdf::RequestPayload::FormUrlEncoded
- Inherits:
-
Object
- Object
- Ilovepdf::RequestPayload::FormUrlEncoded
- Defined in:
- lib/ilovepdf/request_payload/form_url_encoded.rb
Instance Method Summary collapse
- #extract_to_s ⇒ Object
-
#initialize(body) ⇒ FormUrlEncoded
constructor
A new instance of FormUrlEncoded.
- #mime_type ⇒ Object
Constructor Details
#initialize(body) ⇒ FormUrlEncoded
Returns a new instance of FormUrlEncoded.
4 5 6 7 |
# File 'lib/ilovepdf/request_payload/form_url_encoded.rb', line 4 def initialize(body) raise ArgumentError.new("Body must be a hash") unless body.is_a?(Hash) @body = body end |
Instance Method Details
#extract_to_s ⇒ Object
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/ilovepdf/request_payload/form_url_encoded.rb', line 13 def extract_to_s components = [] @body.each do |key, value| resolved_val = stringify_into_form_format(key, value) components << resolved_val if !resolved_val.nil? end components.join("&") end |
#mime_type ⇒ Object
9 10 11 |
# File 'lib/ilovepdf/request_payload/form_url_encoded.rb', line 9 def mime_type 'application/x-www-form-urlencoded' end |