Class: Ccs::Uploader
- Inherits:
-
Object
- Object
- Ccs::Uploader
- Defined in:
- lib/ccs/uploader.rb
Overview
Encrypts and uploads the document to Occson.
Instance Method Summary collapse
-
#call ⇒ Boolean
Performs the actual upload to server.
-
#initialize(uri, content, access_token, passphrase, force: false) ⇒ Uploader
constructor
Constructs an Uploader instance from a given URI, content, access token and passphrase.
Constructor Details
#initialize(uri, content, access_token, passphrase, force: false) ⇒ Uploader
Constructs an Uploader instance from a given URI, content, access token and passphrase.
21 22 23 24 25 26 27 |
# File 'lib/ccs/uploader.rb', line 21 def initialize(uri, content, access_token, passphrase, force: false) @uri = uri @content = content @access_token = access_token @passphrase = passphrase @force = force.to_s end |
Instance Method Details
#call ⇒ Boolean
Performs the actual upload to server.
32 33 34 35 |
# File 'lib/ccs/uploader.rb', line 32 def call request.body = { encrypted_content: encrypted_content, force: @force }.to_json %w[200 201].include?(http.request(request).code) end |