Class: Occson::Document
- Inherits:
-
Object
- Object
- Occson::Document
- Defined in:
- lib/occson/document.rb
Overview
An abstraction for the Document concept. Simplifies building URLs, uploading and downloading contents. Abstracts away workspaces due to the use of access tokens in constructions.
Instance Method Summary collapse
-
#download ⇒ String
Downloads the encrypted document at ‘@uri` and returns the plaintext contents (given that `@passphrase` matches).
-
#initialize(uri, access_token, passphrase) ⇒ Document
constructor
Constructs a Document instance from a given URI, access token and passphrase.
-
#upload(content, force: false) ⇒ Object
Uploads the given plaintext ‘content` to target URI.
Constructor Details
#initialize(uri, access_token, passphrase) ⇒ Document
Constructs a Document instance from a given URI, access token and passphrase.
20 21 22 23 24 |
# File 'lib/occson/document.rb', line 20 def initialize(uri, access_token, passphrase) @uri = build_uri(uri) @access_token = access_token @passphrase = passphrase end |
Instance Method Details
#download ⇒ String
Downloads the encrypted document at ‘@uri` and returns the plaintext contents (given that `@passphrase` matches).
44 45 46 |
# File 'lib/occson/document.rb', line 44 def download Downloader.new(@uri, @access_token, @passphrase).call end |