Class: Nexmo::Files

Inherits:
Namespace show all
Defined in:
lib/nexmo/files.rb

Instance Method Summary collapse

Methods inherited from Namespace

authentication, authentication=, host, host=, #initialize, request_body, request_body=

Constructor Details

This class inherits a constructor from Nexmo::Namespace

Instance Method Details

#get(id) ⇒ Object



7
8
9
10
# File 'lib/nexmo/files.rb', line 7

def get(id)
  response = request('/v1/files/' + id.split('/').last)
  response.body
end

#save(id, filename) ⇒ Object



12
13
14
15
16
17
18
19
20
# File 'lib/nexmo/files.rb', line 12

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