Class: Vonage::ProactiveConnect::Items
- Inherits:
-
Namespace
- Object
- Namespace
- Vonage::ProactiveConnect::Items
- Extended by:
- T::Sig
- Defined in:
- lib/vonage/proactive_connect/items.rb
Defined Under Namespace
Classes: FileResponse, ListResponse
Instance Method Summary collapse
- #download_csv(list_id:, order: 'asc', **params) ⇒ Object deprecated Deprecated.
- #list(list_id:, **params) ⇒ Object deprecated Deprecated.
- #upload_csv(list_id:, filepath:) ⇒ Object deprecated Deprecated.
Instance Method Details
#download_csv(list_id:, order: 'asc', **params) ⇒ Object
Deprecated.
Download list items as a CSV file format
71 72 73 74 75 76 77 78 79 |
# File 'lib/vonage/proactive_connect/items.rb', line 71 def download_csv(list_id:, order: 'asc', **params) logger.info('This method is deprecated and will be removed in a future release.') response = request("/v0.1/bulk/lists/#{list_id}/items/download?order=#{order}", response_class: FileResponse) response.filename = params[:filename] if params[:filename] response.save(filepath: params[:filepath]) if params[:filepath] response end |
#list(list_id:, **params) ⇒ Object
Deprecated.
Find all list items
33 34 35 36 37 38 39 |
# File 'lib/vonage/proactive_connect/items.rb', line 33 def list(list_id:, **params) logger.info('This method is deprecated and will be removed in a future release.') path = "/v0.1/bulk/lists/#{list_id}/items" path += "?#{Params.encode(params)}" unless params.empty? request(path, response_class: ListResponse) end |
#upload_csv(list_id:, filepath:) ⇒ Object
Deprecated.
Import list items from a CSV file
106 107 108 109 110 111 112 113 114 |
# File 'lib/vonage/proactive_connect/items.rb', line 106 def upload_csv(list_id:, filepath:) logger.info('This method is deprecated and will be removed in a future release.') pn = Pathname.new(filepath) raise ArgumentError, ':filepath not for a file' unless pn.file? raise ArgumentError, 'file at :filepath not readable' unless pn.readable? raise ArgumentError, 'file at :filepath not csv' unless pn.extname == '.csv' multipart_post_request("/v0.1/bulk/lists/#{list_id}/items/import", filepath: filepath, file_name: pn.basename, mime_type: 'text/csv') end |