Class: Faraday::ParamPart
- Inherits:
-
Object
- Object
- Faraday::ParamPart
- Defined in:
- lib/faraday/param_part.rb
Overview
Multipart value used to POST data with a content type.
Instance Attribute Summary collapse
-
#content_id ⇒ String?
readonly
The value’s content ID, if given.
-
#content_type ⇒ String
readonly
The value’s content type.
-
#value ⇒ String
readonly
The content to upload.
Instance Method Summary collapse
-
#headers ⇒ Hash
Returns a Hash of String key/value pairs.
- #initialize(value, content_type, content_id = nil) ⇒ Faraday::ParamPart constructor
-
#to_part(boundary, key) ⇒ Faraday::Parts::Part
Converts this value to a form part.
Constructor Details
#initialize(value, content_type, content_id = nil) ⇒ Faraday::ParamPart
11 12 13 14 15 |
# File 'lib/faraday/param_part.rb', line 11 def initialize(value, content_type, content_id = nil) @value = value @content_type = content_type @content_id = content_id end |
Instance Attribute Details
#content_id ⇒ String? (readonly)
The value’s content ID, if given.
51 52 53 |
# File 'lib/faraday/param_part.rb', line 51 def content_id @content_id end |
#content_type ⇒ String (readonly)
The value’s content type.
46 47 48 |
# File 'lib/faraday/param_part.rb', line 46 def content_type @content_type end |
#value ⇒ String (readonly)
The content to upload.
41 42 43 |
# File 'lib/faraday/param_part.rb', line 41 def value @value end |
Instance Method Details
#headers ⇒ Hash
Returns a Hash of String key/value pairs.
31 32 33 34 35 36 |
# File 'lib/faraday/param_part.rb', line 31 def headers { 'Content-Type' => content_type, 'Content-ID' => content_id } end |