Class: Unit::Resource::CashDepositResource

Inherits:
BaseResource show all
Defined in:
lib/unit/api_resources/cash_deposit_resource.rb

Class Method Summary collapse

Methods inherited from BaseResource

file_response_handler, response_handler

Class Method Details

.generate_barcode(request) ⇒ UnitResponse, UnitError

Generate a barcode for cash deposit

Parameters:

  • request (GenerateBarcodeRequest)

Returns:



15
16
17
18
19
# File 'lib/unit/api_resources/cash_deposit_resource.rb', line 15

def generate_barcode(request)
  payload = request.to_json_api
  response = HttpHelper.post("#{api_url}/cash-deposits/barcodes", body: payload, headers: headers)
  response_handler(response)
end

.get_image_by_barcode_number(barcode_number) ⇒ UnitResponse, UnitError

Get cash deposit image by barcode number

Parameters:

  • barcode_number (String)

Returns:



40
41
42
43
# File 'lib/unit/api_resources/cash_deposit_resource.rb', line 40

def get_image_by_barcode_number(barcode_number)
  response = HttpHelper.get("#{api_url}/cash-deposits/barcodes/#{barcode_number}/image", headers: headers, response_type: "image")
  file_response_handler(response)
end

.list_by_coordinates(params = nil) ⇒ UnitResponse, UnitError

List cash deposit store locations by coordinates

Parameters:

  • request (ListByCoordinatesParams)

Returns:



24
25
26
27
# File 'lib/unit/api_resources/cash_deposit_resource.rb', line 24

def list_by_coordinates(params = nil)
  response = HttpHelper.get("#{api_url}/store-locations", params: params&.to_hash, headers: headers)
  response_handler(response)
end

.list_by_postal_code(params = nil) ⇒ UnitResponse, UnitError

List cash deposit store locations by postal code

Parameters:

  • request (ListByPostalCodeParams)

Returns:



32
33
34
35
# File 'lib/unit/api_resources/cash_deposit_resource.rb', line 32

def list_by_postal_code(params = nil)
  response = HttpHelper.get("#{api_url}/store-locations", params: params.to_hash, headers: headers)
  response_handler(response)
end