Module: ApiResource::Formats::FileUploadFormat
- Extended by:
- FileUploadFormat
- Included in:
- FileUploadFormat
- Defined in:
- lib/api_resource/formats/file_upload_format.rb
Overview
Class to handle posting of multipart data to HTTPClient
Instance Method Summary collapse
-
#decode(json) ⇒ Hash
Implementation of #decode - decodes data back from the server We expect the data to be JSON-formatted.
-
#encode(hash, options = nil) ⇒ Hash
Implementation of #encode - encodes data to POST to the server.
-
#extension ⇒ String
The extension for the request.
-
#mime_type ⇒ String
The mime_type header for the request.
Instance Method Details
#decode(json) ⇒ Hash
Implementation of #decode - decodes data back from the server We expect the data to be JSON-formatted
54 55 56 |
# File 'lib/api_resource/formats/file_upload_format.rb', line 54 def decode(json) JSON.parse(json) end |
#encode(hash, options = nil) ⇒ Hash
Implementation of #encode - encodes data to POST to the server
40 41 42 43 44 45 46 |
# File 'lib/api_resource/formats/file_upload_format.rb', line 40 def encode(hash, = nil) ret = {} hash.each_pair do |k,v| ret[k] = self.encode_value(v) end ret end |
#extension ⇒ String
The extension for the request
21 22 23 |
# File 'lib/api_resource/formats/file_upload_format.rb', line 21 def extension "json" end |
#mime_type ⇒ String
The mime_type header for the request
30 31 32 |
# File 'lib/api_resource/formats/file_upload_format.rb', line 30 def mime_type "multipart/form-data" end |