Class: Unit::Account::Credit::CreateAccountRequest
- Inherits:
-
Object
- Object
- Unit::Account::Credit::CreateAccountRequest
- Defined in:
- lib/unit/models/account/credit/create_account_request.rb
Instance Attribute Summary collapse
-
#credit_limit ⇒ Object
readonly
Returns the value of attribute credit_limit.
-
#credit_terms ⇒ Object
readonly
Returns the value of attribute credit_terms.
-
#customer_id ⇒ Object
readonly
Returns the value of attribute customer_id.
-
#idempotency_key ⇒ Object
readonly
Returns the value of attribute idempotency_key.
-
#tags ⇒ Object
readonly
Returns the value of attribute tags.
Instance Method Summary collapse
-
#initialize(credit_terms, credit_limit, customer_id = nil, tags = nil, idempotency_key = nil) ⇒ CreateAccountRequest
constructor
A new instance of CreateAccountRequest.
- #to_json_api ⇒ Object
Constructor Details
#initialize(credit_terms, credit_limit, customer_id = nil, tags = nil, idempotency_key = nil) ⇒ CreateAccountRequest
Returns a new instance of CreateAccountRequest.
16 17 18 19 20 21 22 |
# File 'lib/unit/models/account/credit/create_account_request.rb', line 16 def initialize(credit_terms, credit_limit, customer_id = nil, = nil, idempotency_key = nil) @credit_terms = credit_terms @credit_limit = credit_limit @customer_id = customer_id @tags = @idempotency_key = idempotency_key end |
Instance Attribute Details
#credit_limit ⇒ Object (readonly)
Returns the value of attribute credit_limit.
9 10 11 |
# File 'lib/unit/models/account/credit/create_account_request.rb', line 9 def credit_limit @credit_limit end |
#credit_terms ⇒ Object (readonly)
Returns the value of attribute credit_terms.
9 10 11 |
# File 'lib/unit/models/account/credit/create_account_request.rb', line 9 def credit_terms @credit_terms end |
#customer_id ⇒ Object (readonly)
Returns the value of attribute customer_id.
9 10 11 |
# File 'lib/unit/models/account/credit/create_account_request.rb', line 9 def customer_id @customer_id end |
#idempotency_key ⇒ Object (readonly)
Returns the value of attribute idempotency_key.
9 10 11 |
# File 'lib/unit/models/account/credit/create_account_request.rb', line 9 def idempotency_key @idempotency_key end |
#tags ⇒ Object (readonly)
Returns the value of attribute tags.
9 10 11 |
# File 'lib/unit/models/account/credit/create_account_request.rb', line 9 def @tags end |
Instance Method Details
#to_json_api ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/unit/models/account/credit/create_account_request.rb', line 24 def to_json_api payload = { data: { type: "creditAccount", attributes: { creditTerms: credit_terms, creditLimit: credit_limit, tags: }, relationships: { customer: Unit::Types::Relationship.new("customer", customer_id).to_hash } } } payload[:data][:attributes].compact! payload.to_json end |