Class: Unit::Account::Credit::PatchAccountRequest

Inherits:
Object
  • Object
show all
Defined in:
lib/unit/models/account/credit/patch_account_request.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(account_id, tags = nil, credit_limit = nil) ⇒ PatchAccountRequest

Returns a new instance of PatchAccountRequest.

Parameters:

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

  • credit_limit (Integer) (defaults to: nil)
    • optional



14
15
16
17
18
# File 'lib/unit/models/account/credit/patch_account_request.rb', line 14

def initialize(, tags = nil, credit_limit = nil)
  @account_id = 
  @tags = tags
  @credit_limit = credit_limit
end

Instance Attribute Details

#account_idObject (readonly)

Returns the value of attribute account_id.



9
10
11
# File 'lib/unit/models/account/credit/patch_account_request.rb', line 9

def 
  @account_id
end

#credit_limitObject (readonly)

Returns the value of attribute credit_limit.



9
10
11
# File 'lib/unit/models/account/credit/patch_account_request.rb', line 9

def credit_limit
  @credit_limit
end

#tagsObject (readonly)

Returns the value of attribute tags.



9
10
11
# File 'lib/unit/models/account/credit/patch_account_request.rb', line 9

def tags
  @tags
end

Instance Method Details

#to_json_apiObject



20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/unit/models/account/credit/patch_account_request.rb', line 20

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