Class: Vonage::Files

Inherits:
Namespace
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/vonage/files.rb

Instance Method Summary collapse

Instance Method Details

#get(id) ⇒ Object



11
12
13
# File 'lib/vonage/files.rb', line 11

def get(id)
  request('/v1/files/' + T.must(id.split('/').last))
end

#save(id, filename) ⇒ Object



16
17
18
19
20
21
22
23
24
# File 'lib/vonage/files.rb', line 16

def save(id, filename)
  request('/v1/files/' + T.must(id.split('/').last)) do |response|
    File.open(filename, 'wb') do |file|
      response.read_body do |chunk|
        file.write(chunk)
      end
    end
  end
end