Class: PipedrivePUT::Files
- Inherits:
-
Object
- Object
- PipedrivePUT::Files
- Includes:
- PipedrivePUT
- Defined in:
- lib/PipedrivePUT/files.rb
Constant Summary
Constants included from PipedrivePUT
Instance Attribute Summary
Attributes included from PipedrivePUT
Class Method Summary collapse
Methods included from PipedrivePUT
Class Method Details
.downloadFile(file_id) ⇒ Object
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/PipedrivePUT/files.rb', line 11 def self.downloadFile(file_id) file = "https://api.pipedrive.com/v1/files/#{file_id}/download?api_token=#{@@key}" base = "https://api.pipedrive.com/v1/files/#{file_id}?api_token=#{@@key}" content = open(base).read p_data = JSON.parse(content) file_name = p_data['data']['file_name'] open(file_name, 'wb') do |d_file| d_file << open(file).read end end |
.getAllFiles ⇒ Object
5 6 7 8 9 |
# File 'lib/PipedrivePUT/files.rb', line 5 def self.getAllFiles base = "https://api.pipedrive.com/v1/files?start=0&sort=file_name&api_token=#{@@key}" content = open(base).read JSON.parse(content) end |