Class: Bambora::Adapters::MultipartMixedRequest
- Inherits:
-
Object
- Object
- Bambora::Adapters::MultipartMixedRequest
- Defined in:
- lib/bambora/adapters/multipart_mixed_request.rb
Overview
Creates headers and a body for a multipart/mixed request with a file and a JSON body.
Instance Attribute Summary collapse
-
#multiparty ⇒ Object
readonly
Returns the value of attribute multiparty.
Instance Method Summary collapse
- #body ⇒ Object
- #content_type ⇒ Object
-
#initialize(options = {}) ⇒ MultipartMixedRequest
constructor
A new instance of MultipartMixedRequest.
Constructor Details
#initialize(options = {}) ⇒ MultipartMixedRequest
Returns a new instance of MultipartMixedRequest.
10 11 12 |
# File 'lib/bambora/adapters/multipart_mixed_request.rb', line 10 def initialize( = {}) @multiparty = Multiparty.new { |party| party.parts = [:multipart_args] } end |
Instance Attribute Details
#multiparty ⇒ Object (readonly)
Returns the value of attribute multiparty.
8 9 10 |
# File 'lib/bambora/adapters/multipart_mixed_request.rb', line 8 def multiparty @multiparty end |
Instance Method Details
#body ⇒ Object
18 19 20 |
# File 'lib/bambora/adapters/multipart_mixed_request.rb', line 18 def body "#{multiparty.body}\r\n" end |
#content_type ⇒ Object
14 15 16 |
# File 'lib/bambora/adapters/multipart_mixed_request.rb', line 14 def content_type multiparty.header.sub(/^Content-Type: /, '').strip end |