Class: Praxis::MultipartPart
- Inherits:
-
Object
- Object
- Praxis::MultipartPart
- Defined in:
- lib/praxis/multipart/part.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
Returns the value of attribute body.
-
#filename ⇒ Object
Returns the value of attribute filename.
-
#headers ⇒ Object
Returns the value of attribute headers.
Instance Method Summary collapse
- #encode! ⇒ Object
-
#initialize(body, headers = {}, filename: nil) ⇒ MultipartPart
constructor
A new instance of MultipartPart.
- #status ⇒ Object
Constructor Details
#initialize(body, headers = {}, filename: nil) ⇒ MultipartPart
Returns a new instance of MultipartPart.
8 9 10 11 12 |
# File 'lib/praxis/multipart/part.rb', line 8 def initialize(body, headers={}, filename: nil) @body = body @headers = headers @filename = filename end |
Instance Attribute Details
#body ⇒ Object
Returns the value of attribute body.
4 5 6 |
# File 'lib/praxis/multipart/part.rb', line 4 def body @body end |
#filename ⇒ Object
Returns the value of attribute filename.
6 7 8 |
# File 'lib/praxis/multipart/part.rb', line 6 def filename @filename end |
#headers ⇒ Object
Returns the value of attribute headers.
5 6 7 |
# File 'lib/praxis/multipart/part.rb', line 5 def headers @headers end |
Instance Method Details
#encode! ⇒ Object
18 19 20 21 22 23 |
# File 'lib/praxis/multipart/part.rb', line 18 def encode! case @body when Hash, Array @body = JSON.pretty_generate(@body) end end |
#status ⇒ Object
14 15 16 |
# File 'lib/praxis/multipart/part.rb', line 14 def status @headers['Status'].to_i end |