Class: DIDWW::Resource::Export

Inherits:
Base
  • Object
show all
Extended by:
Forwardable
Includes:
Callback::CONST
Defined in:
lib/didww/resource/export.rb

Constant Summary collapse

STATUS_COMPLETED =
'Completed'
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

Methods inherited from Base

#as_json_api

Constructor Details

#initialize(params = {}) ⇒ Export

Returns a new instance of Export.



51
52
53
# File 'lib/didww/resource/export.rb', line 51

def initialize(params = {})
  super params.reverse_merge(filters: {})
end

Instance Method Details

#complete?Boolean Also known as: completed?

Returns:

  • (Boolean)


60
61
62
# File 'lib/didww/resource/export.rb', line 60

def complete?
  status == STATUS_COMPLETED
end

#csvObject



55
56
57
58
# File 'lib/didww/resource/export.rb', line 55

def csv
  return unless url.present?
  Down::Http.new(headers: { 'Api-Key' => DIDWW::Client.api_key }).open(url)
end