Class: Audiobank::Document
- Inherits:
-
Object
- Object
- Audiobank::Document
- Includes:
- Virtus
- Defined in:
- lib/audiobank/document.rb
Instance Attribute Summary collapse
-
#account ⇒ Object
Returns the value of attribute account.
-
#errors ⇒ Object
Returns the value of attribute errors.
Instance Method Summary collapse
Instance Attribute Details
#account ⇒ Object
Returns the value of attribute account.
12 13 14 |
# File 'lib/audiobank/document.rb', line 12 def account @account end |
#errors ⇒ Object
Returns the value of attribute errors.
13 14 15 |
# File 'lib/audiobank/document.rb', line 13 def errors @errors end |
Instance Method Details
#confirm ⇒ Object
37 38 39 |
# File 'lib/audiobank/document.rb', line 37 def confirm account.post "/documents/#{id}/upload/confirm.json" end |
#upload!(file) ⇒ Object
27 28 29 30 31 32 33 34 35 |
# File 'lib/audiobank/document.rb', line 27 def upload!(file) Net::FTP.open(upload_uri.host) do |ftp| ftp.login ftp.chdir upload_uri.path ftp.putbinaryfile file end self end |
#upload_uri ⇒ Object
23 24 25 |
# File 'lib/audiobank/document.rb', line 23 def upload_uri @upload_uri ||= URI.parse(upload) end |
#valid? ⇒ Boolean
19 20 21 |
# File 'lib/audiobank/document.rb', line 19 def valid? errors.blank? end |