Class: RippleRest::Payment
- Inherits:
-
RestObject
- Object
- RestObject
- RippleRest::Payment
- Defined in:
- lib/ripple-rest/generated-schemas.rb,
lib/ripple-rest/schemas.rb,
lib/ripple-rest/generated-schemas.rb
Overview
A flattened Payment object used by the ripple-rest API
Instance Attribute Summary collapse
- #client_resource_id ⇒ String
- #destination_account ⇒ String<RippleAddress>
-
#destination_amount ⇒ Amount
The amount the destination_account will receive.
-
#destination_balance_changes ⇒ Array<Amount>
Parsed from the validated transaction metadata, this array represents the changes to balances held by the destination_account.
-
#destination_tag ⇒ String<UINT32>
A string representing an unsigned 32-bit integer most commonly used to refer to a receiver’s hosted account at a Ripple gateway.
-
#direction ⇒ String
The direction of the payment, from the perspective of the account being queried.
-
#fee ⇒ BigDecimal
The Ripple Network transaction fee, represented in whole XRP (NOT “drops”, or millionths of an XRP, which is used elsewhere in the Ripple protocol).
-
#hash ⇒ String<Hash256>
The 256-bit hash of the payment.
-
#invoice_id ⇒ String<Hash256>
A 256-bit hash that can be used to identify a particular payment.
-
#ledger ⇒ String
The string representation of the index number of the ledger containing the validated or failed payment.
-
#no_direct_ripple ⇒ Boolean
A boolean that can be set to true if paths are specified and the sender would like the Ripple Network to disregard any direct paths from the source_account to the destination_account.
-
#partial_payment ⇒ Boolean
A boolean that, if set to true, indicates that this payment should go through even if the whole amount cannot be delivered because of a lack of liquidity or funds in the source_account account.
-
#paths ⇒ String
A “stringified” version of the Ripple PathSet structure that users should treat as opaque.
-
#result ⇒ String
The rippled code indicating the success or failure type of the payment.
-
#source_account ⇒ String<RippleAddress>
The Ripple account address of the Payment sender.
-
#source_amount ⇒ Amount
An optional amount that can be specified to constrain cross-currency payments.
-
#source_balance_changes ⇒ Array<Amount>
Parsed from the validated transaction metadata, this array represents all of the changes to balances held by the source_account.
-
#source_slippage ⇒ BigDecimal
An optional cushion for the source_amount to increase the likelihood that the payment will succeed.
-
#source_tag ⇒ String<UINT32>
A string representing an unsigned 32-bit integer most commonly used to refer to a sender’s hosted account at a Ripple gateway.
-
#state ⇒ String
The state of the payment from the perspective of the Ripple Ledger.
-
#timestamp ⇒ Time
The timestamp representing when the payment was validated and written into the Ripple ledger.
Instance Method Summary collapse
-
#account ⇒ Object
Gets Account object of this Payment’s source account.
-
#account=(val) ⇒ Object
Sets source account and secret for this Payment.
-
#submit ⇒ String
Submits a payment.
Methods inherited from RestObject
Constructor Details
This class inherits a constructor from RippleRest::RestObject
Instance Attribute Details
#client_resource_id ⇒ String
82 83 84 |
# File 'lib/ripple-rest/schemas.rb', line 82 def client_resource_id @client_resource_id end |
#destination_account ⇒ String<RippleAddress>
265 |
# File 'lib/ripple-rest/generated-schemas.rb', line 265 property :destination_account, :RippleAddress |
#destination_amount ⇒ Amount
The amount the destination_account will receive
276 |
# File 'lib/ripple-rest/generated-schemas.rb', line 276 property :destination_amount, :Amount |
#destination_balance_changes ⇒ Array<Amount>
Parsed from the validated transaction metadata, this array represents the changes to balances held by the destination_account. For those receiving payments this is important to check because if the partial_payment flag is set this value may be less than the destination_amount
342 |
# File 'lib/ripple-rest/generated-schemas.rb', line 342 property :destination_balance_changes, [:Array, :Amount] |
#destination_tag ⇒ String<UINT32>
A string representing an unsigned 32-bit integer most commonly used to refer to a receiver’s hosted account at a Ripple gateway
271 |
# File 'lib/ripple-rest/generated-schemas.rb', line 271 property :destination_tag, :UINT32 |
#direction ⇒ String
The direction of the payment, from the perspective of the account being queried. Possible values are “incoming”, “outgoing”, and “passthrough”
302 |
# File 'lib/ripple-rest/generated-schemas.rb', line 302 property :direction, [:String, "^incoming|outgoing|passthrough$"] |
#fee ⇒ BigDecimal
The Ripple Network transaction fee, represented in whole XRP (NOT “drops”, or millionths of an XRP, which is used elsewhere in the Ripple protocol)
332 |
# File 'lib/ripple-rest/generated-schemas.rb', line 332 property :fee, :FloatString |
#hash ⇒ String<Hash256>
The 256-bit hash of the payment. This is used throughout the Ripple protocol as the unique identifier for the transaction
322 |
# File 'lib/ripple-rest/generated-schemas.rb', line 322 property :hash, :Hash256 |
#invoice_id ⇒ String<Hash256>
A 256-bit hash that can be used to identify a particular payment
282 |
# File 'lib/ripple-rest/generated-schemas.rb', line 282 property :invoice_id, :Hash256 |
#ledger ⇒ String
The string representation of the index number of the ledger containing the validated or failed payment. Failed payments will only be written into the Ripple Ledger if they fail after submission to a rippled and a Ripple Network fee is claimed
317 |
# File 'lib/ripple-rest/generated-schemas.rb', line 317 property :ledger, [:String, "^[0-9]+$"] |
#no_direct_ripple ⇒ Boolean
A boolean that can be set to true if paths are specified and the sender would like the Ripple Network to disregard any direct paths from the source_account to the destination_account. This may be used to take advantage of an arbitrage opportunity or by gateways wishing to issue balances from a hot wallet to a user who has mistakenly set a trustline directly to the hot wallet
297 |
# File 'lib/ripple-rest/generated-schemas.rb', line 297 property :no_direct_ripple, :Boolean |
#partial_payment ⇒ Boolean
A boolean that, if set to true, indicates that this payment should go through even if the whole amount cannot be delivered because of a lack of liquidity or funds in the source_account account
292 |
# File 'lib/ripple-rest/generated-schemas.rb', line 292 property :partial_payment, :Boolean |
#paths ⇒ String
A “stringified” version of the Ripple PathSet structure that users should treat as opaque
287 |
# File 'lib/ripple-rest/generated-schemas.rb', line 287 property :paths, :String |
#result ⇒ String
The rippled code indicating the success or failure type of the payment. The code “tesSUCCESS” indicates that the payment was successfully validated and written into the Ripple Ledger. All other codes will begin with the following prefixes: “tec”, “tef”, “tel”, or “tej”
312 |
# File 'lib/ripple-rest/generated-schemas.rb', line 312 property :result, [:String, "te[cfjlms][A-Za-z_]+"] |
#source_account ⇒ String<RippleAddress>
The Ripple account address of the Payment sender
244 |
# File 'lib/ripple-rest/generated-schemas.rb', line 244 property :source_account, :RippleAddress |
#source_amount ⇒ Amount
An optional amount that can be specified to constrain cross-currency payments
255 |
# File 'lib/ripple-rest/generated-schemas.rb', line 255 property :source_amount, :Amount |
#source_balance_changes ⇒ Array<Amount>
Parsed from the validated transaction metadata, this array represents all of the changes to balances held by the source_account. Most often this will have one amount representing the Ripple Network fee and, if the source_amount was not XRP, one amount representing the actual source_amount that was sent
337 |
# File 'lib/ripple-rest/generated-schemas.rb', line 337 property :source_balance_changes, [:Array, :Amount] |
#source_slippage ⇒ BigDecimal
An optional cushion for the source_amount to increase the likelihood that the payment will succeed. The source_account will never be charged more than source_amount.value + source_slippage
260 |
# File 'lib/ripple-rest/generated-schemas.rb', line 260 property :source_slippage, :FloatString |
#source_tag ⇒ String<UINT32>
A string representing an unsigned 32-bit integer most commonly used to refer to a sender’s hosted account at a Ripple gateway
250 |
# File 'lib/ripple-rest/generated-schemas.rb', line 250 property :source_tag, :UINT32 |
#state ⇒ String
The state of the payment from the perspective of the Ripple Ledger. Possible values are “validated” and “failed” and “new” if the payment has not been submitted yet
307 |
# File 'lib/ripple-rest/generated-schemas.rb', line 307 property :state, [:String, "^validated|failed|new$"] |
#timestamp ⇒ Time
The timestamp representing when the payment was validated and written into the Ripple ledger
327 |
# File 'lib/ripple-rest/generated-schemas.rb', line 327 property :timestamp, :Timestamp |
Instance Method Details
#account ⇒ Object
Gets Account object of this Payment’s source account
53 54 55 |
# File 'lib/ripple-rest/schemas.rb', line 53 def account @account end |
#account=(val) ⇒ Object
Sets source account and secret for this Payment
59 60 61 62 |
# File 'lib/ripple-rest/schemas.rb', line 59 def account= val @account = val self.source_account = val.address end |
#submit ⇒ String
Submits a payment
69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/ripple-rest/schemas.rb', line 69 def submit @account.require_secret hash = {} hash["payment"] = self.to_hash hash["secret"] = @account.secret hash["client_resource_id"] = client_resource_id = RippleRest.next_uuid source_account = self.to_hash[:source_account] RippleRest.post("v1/accounts/#{source_account}/payments", hash)["client_resource_id"] end |