Class: HTTParty::Request::Body
- Inherits:
-
Object
- Object
- HTTParty::Request::Body
- Defined in:
- lib/httparty/request/body.rb
Instance Method Summary collapse
- #boundary ⇒ Object
- #call ⇒ Object
-
#initialize(params, query_string_normalizer: nil, force_multipart: false) ⇒ Body
constructor
A new instance of Body.
- #multipart? ⇒ Boolean
Constructor Details
#initialize(params, query_string_normalizer: nil, force_multipart: false) ⇒ Body
Returns a new instance of Body.
11 12 13 14 15 |
# File 'lib/httparty/request/body.rb', line 11 def initialize(params, query_string_normalizer: nil, force_multipart: false) @params = params @query_string_normalizer = query_string_normalizer @force_multipart = force_multipart end |
Instance Method Details
#boundary ⇒ Object
25 26 27 |
# File 'lib/httparty/request/body.rb', line 25 def boundary @boundary ||= MultipartBoundary.generate end |
#call ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/httparty/request/body.rb', line 17 def call if params.respond_to?(:to_hash) multipart? ? generate_multipart : normalize_query(params) else params end end |
#multipart? ⇒ Boolean
29 30 31 |
# File 'lib/httparty/request/body.rb', line 29 def multipart? params.respond_to?(:to_hash) && (force_multipart || has_file?(params)) end |