Class: Unit::Payment::PatchBookPaymentRequest

Inherits:
Object
  • Object
show all
Defined in:
lib/unit/models/payment/patch_book_payment_request.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(payment_id, tags = nil) ⇒ PatchBookPaymentRequest

Returns a new instance of PatchBookPaymentRequest.

Parameters:

  • payment_id (String)
  • tags (Hash) (defaults to: nil)
    • optional



12
13
14
15
# File 'lib/unit/models/payment/patch_book_payment_request.rb', line 12

def initialize(payment_id, tags = nil)
  @payment_id = payment_id
  @tags = tags
end

Instance Attribute Details

#payment_idObject (readonly)

Returns the value of attribute payment_id.



8
9
10
# File 'lib/unit/models/payment/patch_book_payment_request.rb', line 8

def payment_id
  @payment_id
end

#tagsObject (readonly)

Returns the value of attribute tags.



8
9
10
# File 'lib/unit/models/payment/patch_book_payment_request.rb', line 8

def tags
  @tags
end

Instance Method Details

#to_json_apiObject



17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/unit/models/payment/patch_book_payment_request.rb', line 17

def to_json_api
  payload = {
    data: {
      type: "bookPayment",
      attributes: {
        tags: tags
      }
    }
  }
  payload[:data][:attributes].compact!
  payload.to_json
end