Class: DIDWW::Resource::Export
- Extended by:
- Forwardable
- Includes:
- Callback::CONST, HasStatusHelpers
- Defined in:
- lib/didww/resource/export.rb
Constant Summary collapse
- STATUS_PENDING =
'pending'- STATUS_PROCESSING =
'processing'- STATUS_COMPLETED =
'completed'- STATUSES =
[ STATUS_PENDING, STATUS_PROCESSING, STATUS_COMPLETED ].freeze
- EXPORT_TYPE_CDR_IN =
'cdr_in'- EXPORT_TYPE_CDR_OUT =
'cdr_out'- EXPORT_TYPES =
[ EXPORT_TYPE_CDR_IN, EXPORT_TYPE_CDR_OUT ].freeze
Constants included from Callback::CONST
Callback::CONST::CALLBACK_METHODS, Callback::CONST::CALLBACK_METHOD_GET, Callback::CONST::CALLBACK_METHOD_POST
Instance Method Summary collapse
- #csv ⇒ Object
- #download ⇒ Object
-
#initialize(params = {}) ⇒ Export
constructor
Type: String Description: Customer-supplied reference.
Methods included from HasStatusHelpers
Methods inherited from Base
Constructor Details
#initialize(params = {}) ⇒ Export
Type: String Description: Customer-supplied reference. Max 100 characters. (API 2026-04-16)
67 68 69 |
# File 'lib/didww/resource/export.rb', line 67 def initialize(params = {}) super params.reverse_merge(filters: {}) end |
Instance Method Details
#csv ⇒ Object
80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/didww/resource/export.rb', line 80 def csv file = download return unless file gz = Zlib::GzipReader.new(file) begin StringIO.new(gz.read) ensure gz.close unless gz.closed? file.close if file.respond_to?(:close) && !file.closed? end end |
#download ⇒ Object
71 72 73 74 75 76 77 78 |
# File 'lib/didww/resource/export.rb', line 71 def download return unless url.present? Down::Http.new(headers: { 'Api-Key' => DIDWW::Client.api_key, 'X-DIDWW-API-Version' => DIDWW::Client.api_version, 'User-Agent' => "didww-v3 Ruby gem v#{DIDWW::VERSION}" }).open(url) end |