Class: Unit::CashDeposit::GenerateBarcodeRequest

Inherits:
Object
  • Object
show all
Defined in:
lib/unit/models/cash_deposit/generate_barcode_request.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(store_id, account_id, customer_id) ⇒ GenerateBarcodeRequest

Returns a new instance of GenerateBarcodeRequest.

Parameters:

  • store_id (String)
  • account_id (String)
  • customer_id (String)


13
14
15
16
17
# File 'lib/unit/models/cash_deposit/generate_barcode_request.rb', line 13

def initialize(store_id, , customer_id)
  @store_id = store_id
  @account_id = 
  @customer_id = customer_id
end

Instance Attribute Details

#account_idObject (readonly)

Returns the value of attribute account_id.



8
9
10
# File 'lib/unit/models/cash_deposit/generate_barcode_request.rb', line 8

def 
  @account_id
end

#customer_idObject (readonly)

Returns the value of attribute customer_id.



8
9
10
# File 'lib/unit/models/cash_deposit/generate_barcode_request.rb', line 8

def customer_id
  @customer_id
end

#store_idObject (readonly)

Returns the value of attribute store_id.



8
9
10
# File 'lib/unit/models/cash_deposit/generate_barcode_request.rb', line 8

def store_id
  @store_id
end

Instance Method Details

#to_json_apiObject



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/unit/models/cash_deposit/generate_barcode_request.rb', line 19

def to_json_api
  payload = {
    "data": {
      "type": "cashDepositBarcode",
      "attributes": {
        storeId: store_id
      },
      "relationships": {
        "account": Unit::Types::Relationship.new("account", ).to_hash,
        "customer": Unit::Types::Relationship.new("customer", customer_id).to_hash
      }
    }
  }
  payload[:data][:attributes].compact!
  payload.to_json
end