Class: WavixApi::V1::Billing::Invoices::Find

Inherits:
Object
  • Object
show all
Includes:
BaseMethods
Defined in:
lib/wavix_api/v1/billing/invoices/find.rb

Constant Summary

Constants included from BaseMethods

BaseMethods::AVAILABLE_TRANSCRIPTION_LANGUAGES, BaseMethods::BASE_DATE_FORMAT, BaseMethods::DEFAULT_HEADERS, BaseMethods::IP_REGEXP, BaseMethods::LIST_OF_DIGITS_REGEXP, BaseMethods::ONLY_DIGITS_REGEXP, BaseMethods::ONLY_ID_SCHEMA, BaseMethods::ONLY_UUID_SCHEMA, BaseMethods::PAGINATION_SCHEMA

Instance Attribute Summary

Attributes included from BaseMethods

#client, #id, #params

Class Method Summary collapse

Instance Method Summary collapse

Methods included from BaseMethods

#delete, #download, #file_extention, #format_file, #get, #patch, #post, #put, #raise_error, #stringify_dates!, #validate!, #validate_dates!

Constructor Details

#initialize(params = {}) ⇒ Find



32
33
34
35
# File 'lib/wavix_api/v1/billing/invoices/find.rb', line 32

def initialize(params = {})
  super(params)
  @save_path = @params[:save_path]
end

Class Method Details

.call(id = nil, save_path: nil) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/wavix_api/v1/billing/invoices/find.rb', line 15

def call(id = nil, save_path: nil)
  instance = new({ id: id })

  instance.validate!

  instance.download(
    ['v1/billing/invoices', instance.id].join('/'),
    headers: {
      'Content-Disposition' => 'attachment; filename="invoice.pdf"',
      'Content-Type' => 'application/octet-stream',
      'Content-Transfer-Encoding' => 'binary'
    },
    save_path: save_path
  )
end

Instance Method Details

#callObject



37
38
39
# File 'lib/wavix_api/v1/billing/invoices/find.rb', line 37

def call
  self.class.call(id, save_path: @save_path)
end