Class: Unit::Reward::CreateRewardRequest
- Inherits:
-
Object
- Object
- Unit::Reward::CreateRewardRequest
- Defined in:
- lib/unit/models/reward/create_reward_request.rb
Instance Attribute Summary collapse
-
#amount ⇒ Object
readonly
Returns the value of attribute amount.
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#funding_account_id ⇒ Object
readonly
Returns the value of attribute funding_account_id.
-
#idempotency_key ⇒ Object
readonly
Returns the value of attribute idempotency_key.
-
#receiving_account_id ⇒ Object
readonly
Returns the value of attribute receiving_account_id.
-
#rewarded_transaction_id ⇒ Object
readonly
Returns the value of attribute rewarded_transaction_id.
-
#tags ⇒ Object
readonly
Returns the value of attribute tags.
Instance Method Summary collapse
-
#initialize(receiving_account_id, amount, description, tags = nil, idempotency_key = nil, funding_account_id = nil, rewarded_transaction_id = nil) ⇒ CreateRewardRequest
constructor
A new instance of CreateRewardRequest.
- #to_json_api ⇒ Object
Constructor Details
#initialize(receiving_account_id, amount, description, tags = nil, idempotency_key = nil, funding_account_id = nil, rewarded_transaction_id = nil) ⇒ CreateRewardRequest
Returns a new instance of CreateRewardRequest.
17 18 19 20 21 22 23 24 25 |
# File 'lib/unit/models/reward/create_reward_request.rb', line 17 def initialize(receiving_account_id, amount, description, = nil, idempotency_key = nil, funding_account_id = nil, rewarded_transaction_id = nil) @receiving_account_id = receiving_account_id @amount = amount @description = description @tags = @idempotency_key = idempotency_key @funding_account_id = funding_account_id @rewarded_transaction = rewarded_transaction_id end |
Instance Attribute Details
#amount ⇒ Object (readonly)
Returns the value of attribute amount.
8 9 10 |
# File 'lib/unit/models/reward/create_reward_request.rb', line 8 def amount @amount end |
#description ⇒ Object (readonly)
Returns the value of attribute description.
8 9 10 |
# File 'lib/unit/models/reward/create_reward_request.rb', line 8 def description @description end |
#funding_account_id ⇒ Object (readonly)
Returns the value of attribute funding_account_id.
8 9 10 |
# File 'lib/unit/models/reward/create_reward_request.rb', line 8 def funding_account_id @funding_account_id end |
#idempotency_key ⇒ Object (readonly)
Returns the value of attribute idempotency_key.
8 9 10 |
# File 'lib/unit/models/reward/create_reward_request.rb', line 8 def idempotency_key @idempotency_key end |
#receiving_account_id ⇒ Object (readonly)
Returns the value of attribute receiving_account_id.
8 9 10 |
# File 'lib/unit/models/reward/create_reward_request.rb', line 8 def receiving_account_id @receiving_account_id end |
#rewarded_transaction_id ⇒ Object (readonly)
Returns the value of attribute rewarded_transaction_id.
8 9 10 |
# File 'lib/unit/models/reward/create_reward_request.rb', line 8 def rewarded_transaction_id @rewarded_transaction_id end |
#tags ⇒ Object (readonly)
Returns the value of attribute tags.
8 9 10 |
# File 'lib/unit/models/reward/create_reward_request.rb', line 8 def @tags end |
Instance Method Details
#to_json_api ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/unit/models/reward/create_reward_request.rb', line 27 def to_json_api payload = { data: { type: "reward", attributes: { amount: amount, description: description, tags: , idempotencyKey: idempotency_key }, relationships: { receivingAccount: Unit::Types::Relationship.new("depositAccount", receiving_account_id).to_hash } } } payload[:data][:relationships][:funding_account] = Unit::Types::Relationship.new("fundingAccount", funding_account_id).to_hash if funding_account_id payload[:data][:relationships][:rewardedTransaction] = Unit::Types::Relationship.new("rewardedTransaction", rewarded_transaction).to_hash if rewarded_transaction_id payload[:data][:attributes].compact! payload.to_json end |