ripple-rest 0.0.2 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (31) hide show
  1. data/README.md +8 -0
  2. data/lib/ripple-rest.rb +4 -8
  3. data/lib/ripple-rest/{schemas/json.rb → generated-schemas.rb} +154 -149
  4. data/lib/ripple-rest/{schemas/payments.rb → helpers.rb} +129 -22
  5. data/lib/ripple-rest/rest-object.rb +191 -0
  6. data/lib/ripple-rest/schemas.rb +82 -0
  7. data/lib/ripple-rest/version.rb +2 -2
  8. metadata +6 -43
  9. data/lib/ripple-rest/schemas/account.rb +0 -84
  10. data/lib/ripple-rest/schemas/account_settings.rb +0 -22
  11. data/lib/ripple-rest/schemas/amount.rb +0 -21
  12. data/lib/ripple-rest/schemas/balance.rb +0 -8
  13. data/lib/ripple-rest/schemas/json/AccountSettings.json +0 -63
  14. data/lib/ripple-rest/schemas/json/Amount.json +0 -28
  15. data/lib/ripple-rest/schemas/json/Balance.json +0 -23
  16. data/lib/ripple-rest/schemas/json/Currency.json +0 -7
  17. data/lib/ripple-rest/schemas/json/FloatString.json +0 -7
  18. data/lib/ripple-rest/schemas/json/Hash128.json +0 -7
  19. data/lib/ripple-rest/schemas/json/Hash256.json +0 -7
  20. data/lib/ripple-rest/schemas/json/Notification.json +0 -58
  21. data/lib/ripple-rest/schemas/json/Order.json +0 -82
  22. data/lib/ripple-rest/schemas/json/Payment.json +0 -98
  23. data/lib/ripple-rest/schemas/json/ResourceId.json +0 -7
  24. data/lib/ripple-rest/schemas/json/RippleAddress.json +0 -7
  25. data/lib/ripple-rest/schemas/json/Timestamp.json +0 -7
  26. data/lib/ripple-rest/schemas/json/Trustline.json +0 -58
  27. data/lib/ripple-rest/schemas/json/UINT32.json +0 -7
  28. data/lib/ripple-rest/schemas/json/URL.json +0 -7
  29. data/lib/ripple-rest/schemas/json/_generate.rb +0 -73
  30. data/lib/ripple-rest/schemas/notifications.rb +0 -19
  31. data/lib/ripple-rest/schemas/trustlines.rb +0 -40
data/README.md CHANGED
@@ -0,0 +1,8 @@
1
+ ripple-rest gem
2
+ ===============
3
+
4
+ [![Gem Version](https://badge.fury.io/rb/ripple-rest.svg)](http://badge.fury.io/rb/ripple-rest)
5
+
6
+ This is a client that interacts with the Ripple network using the Ripple REST APIs.
7
+
8
+ The documentation can be found at http://rubydoc.info/github/orzfly/ruby-ripple-rest/master/frames.
data/lib/ripple-rest.rb CHANGED
@@ -6,14 +6,10 @@ require 'bigdecimal'
6
6
  require 'rest-client'
7
7
  require 'ripple-rest/version'
8
8
  require 'ripple-rest/errors'
9
- require 'ripple-rest/schemas/json'
10
- require 'ripple-rest/schemas/account'
11
- require 'ripple-rest/schemas/account_settings'
12
- require 'ripple-rest/schemas/trustlines'
13
- require 'ripple-rest/schemas/balance'
14
- require 'ripple-rest/schemas/notifications'
15
- require 'ripple-rest/schemas/amount'
16
- require 'ripple-rest/schemas/payments'
9
+ require 'ripple-rest/rest-object'
10
+ require 'ripple-rest/generated-schemas'
11
+ require 'ripple-rest/schemas'
12
+ require 'ripple-rest/helpers'
17
13
 
18
14
  class << RippleRest
19
15
  # Set endpoint URI
@@ -1,450 +1,455 @@
1
- require 'autoparse'
2
-
3
1
  module RippleRest
4
- # @!group Private APIs
5
- # @api private
6
- def self.generate_schema(fn)
7
- RippleRest.const_set fn, AutoParse.generate(JSON.parse(File.read(File.join(File.join(File.dirname(__FILE__), "json"), "#{fn}.json"))), :uri => "#{fn}")
8
- end
9
- # @!endgroup
10
-
11
- generate_schema :Currency
12
- generate_schema :FloatString
13
- generate_schema :Hash128
14
- generate_schema :Hash256
15
- generate_schema :ResourceId
16
- generate_schema :RippleAddress
17
- generate_schema :Timestamp
18
- generate_schema :UINT32
19
- generate_schema :URL
20
-
21
- generate_schema :Order
22
- generate_schema :Balance
23
- generate_schema :Notification
24
- generate_schema :Payment
25
- generate_schema :Trustline
26
- generate_schema :AccountSettings
27
- generate_schema :Amount
28
-
2
+ RestTypeHelper.register_string :Hash256, "^$|^[A-Fa-f0-9]{64}$"
3
+ RestTypeHelper.register_string :Hash128, "^$|^[A-Fa-f0-9]{32}$"
4
+ RestTypeHelper.register_string :RippleAddress, "^r[1-9A-HJ-NP-Za-km-z]{25,33}$"
5
+ RestTypeHelper.register_string :ResourceId, "^(?!$|^[A-Fa-f0-9]{64})[ -~]{1,255}$"
6
+ RestTypeHelper.register_string :Currency, "^([a-zA-Z0-9]{3}|[A-Fa-f0-9]{40})$"
7
+
8
+ class Notification < RestObject; end
9
+ RestTypeHelper.register_object :Notification, Notification
10
+ class Order < RestObject; end
11
+ RestTypeHelper.register_object :Order, Order
12
+ class AccountSettings < RestObject; end
13
+ RestTypeHelper.register_object :AccountSettings, AccountSettings
14
+ class Payment < RestObject; end
15
+ RestTypeHelper.register_object :Payment, Payment
16
+ class Balance < RestObject; end
17
+ RestTypeHelper.register_object :Balance, Balance
18
+ class Amount < RestObject; end
19
+ RestTypeHelper.register_object :Amount, Amount
20
+ class Trustline < RestObject; end
21
+ RestTypeHelper.register_object :Trustline, Trustline
22
+
29
23
  # A
30
- class Notification < AutoParse::Instance
24
+ class Notification
31
25
  # @!attribute account
32
26
  # The Ripple address of the account to which the notification pertains
33
- # @return [String<RippleAddress>] +"^r[1-9A-HJ-NP-Za-km-z]{25,33}$"+
34
-
27
+ # @return [String<RippleAddress>]
28
+ property :account, :RippleAddress
35
29
 
36
30
  # @!attribute type
37
31
  # The resource type this notification corresponds to. Possible values are "payment", "order", "trustline", "accountsettings"
38
32
  # @return [String] +"^payment|order|trustline|accountsettings$"+
39
-
33
+ property :type, [:String, "^payment|order|trustline|accountsettings$"]
40
34
 
41
35
  # @!attribute direction
42
36
  # The direction of the transaction, from the perspective of the account being queried. Possible values are "incoming", "outgoing", and "passthrough"
43
37
  # @return [String] +"^incoming|outgoing|passthrough$"+
44
-
38
+ property :direction, [:String, "^incoming|outgoing|passthrough$"]
45
39
 
46
40
  # @!attribute state
47
41
  # The state of the transaction from the perspective of the Ripple Ledger. Possible values are "validated" and "failed"
48
42
  # @return [String] +"^validated|failed$"+
49
-
43
+ property :state, [:String, "^validated|failed$"]
50
44
 
51
45
  # @!attribute result
52
46
  # The rippled code indicating the success or failure type of the transaction. The code "tesSUCCESS" indicates that the transaction was successfully validated and written into the Ripple Ledger. All other codes will begin with the following prefixes: "tec", "tef", "tel", or "tej"
53
47
  # @return [String] +"te[cfjlms][A-Za-z_]+"+
54
-
48
+ property :result, [:String, "te[cfjlms][A-Za-z_]+"]
55
49
 
56
50
  # @!attribute ledger
57
51
  # The string representation of the index number of the ledger containing the validated or failed transaction. 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
58
52
  # @return [String] +"^[0-9]+$"+
59
-
53
+ property :ledger, [:String, "^[0-9]+$"]
60
54
 
61
55
  # @!attribute hash
62
56
  # The 256-bit hash of the transaction. This is used throughout the Ripple protocol as the unique identifier for the transaction
63
- # @return [String<Hash256>] +"^$|^[A-Fa-f0-9]{64}$"+
64
-
57
+ # @return [String<Hash256>]
58
+ property :hash, :Hash256
65
59
 
66
60
  # @!attribute timestamp
67
61
  # The timestamp representing when the transaction was validated and written into the Ripple ledger
68
- # @return [String<Timestamp>] +"^$|^[0-9]{4}-[0-1][0-9]-[0-3][0-9]T(2[0-3]|[01][0-9]):[0-5][0-9]:[0-5][0-9](Z|[+](2[0-3]|[01][0-9]):[0-5][0-9])$"+
69
-
62
+ # @return [Time]
63
+ property :timestamp, :Timestamp
70
64
 
71
65
  # @!attribute transaction_url
72
66
  # A URL that can be used to fetch the full resource this notification corresponds to
73
67
  # @return [String]
74
-
68
+ property :transaction_url, :String
75
69
 
76
70
  # @!attribute previous_notification_url
77
71
  # A URL that can be used to fetch the notification that preceded this one chronologically
78
72
  # @return [String]
79
-
73
+ property :previous_notification_url, :String
80
74
 
81
75
  # @!attribute next_notification_url
82
76
  # A URL that can be used to fetch the notification that followed this one chronologically
83
77
  # @return [String]
84
-
78
+ property :next_notification_url, :String
85
79
 
86
80
  end
87
81
  # A simplified Order object used by the ripple-rest API (note that "orders" are referred to elsewhere in the Ripple protocol as "offers")
88
- class Order < AutoParse::Instance
82
+ class Order
89
83
  # @!attribute account
90
84
  # The Ripple account address of the order's creator
91
- # @return [String<RippleAddress>] +"^r[1-9A-HJ-NP-Za-km-z]{25,33}$"+
92
-
85
+ # @return [String<RippleAddress>]
86
+ property :account, :RippleAddress
87
+ required :account
93
88
 
94
89
  # @!attribute buy
95
90
  # If set to true the order it indicates that the creator is looking to receive the base_amount in exchange for the counter_amount. If undefined or set to false it indicates that the creator is looking to sell the base_amount to receive the counter_amount
96
91
  # @return [Boolean]
97
-
92
+ property :buy, :Boolean
98
93
 
99
94
  # @!attribute base_amount
100
95
  # The amount of currency the seller_account is seeking to buy. If other orders take part of this one, this value will change to represent the amount left in the order. This may be specified along with the counter_amount OR exchange_rate but not both. When the order is parsed from the Ripple Ledger the base currency will be determined according to the Priority Ranking of Currencies (XRP,EUR,GBP,AUD,NZD,USD,CAD,CHF,JPY,CNY) and if neither currency is listed in the ranking the base currency will be the one that is alphabetically first
101
96
  # @return [Amount]
102
-
97
+ property :base_amount, :Amount
103
98
 
104
99
  # @!attribute counter_amount
105
100
  # The amount of currency being sold. If other orders take part of this one, this value will change to represent the amount left in the order. This may be specified along with the base_amount OR the exchange_rate but not both
106
101
  # @return [Amount]
107
-
102
+ property :counter_amount, :Amount
108
103
 
109
104
  # @!attribute exchange_rate
110
105
  # A string representation of the order price, defined as the cost one unit of the base currency in terms of the counter currency. This may be specified along with the base_amount OR the counter_amount but not both. If it is unspecified it will be computed automatically based on the counter_amount divided by the base_amount
111
- # @return [String<FloatString>]
112
-
106
+ # @return [BigDecimal]
107
+ property :exchange_rate, :FloatString
113
108
 
114
109
  # @!attribute expiration_timestamp
115
110
  # The ISO combined date and time string representing the point beyond which the order will no longer be considered active or valid
116
- # @return [String<Timestamp>] +"^$|^[0-9]{4}-[0-1][0-9]-[0-3][0-9]T(2[0-3]|[01][0-9]):[0-5][0-9]:[0-5][0-9](Z|[+](2[0-3]|[01][0-9]):[0-5][0-9])$"+
117
-
111
+ # @return [Time]
112
+ property :expiration_timestamp, :Timestamp
118
113
 
119
114
  # @!attribute ledger_timeout
120
115
  # A string representation of the number of ledger closes after submission during which the order should be considered active
121
116
  # @return [String] +"^[0-9]*$"+
122
-
117
+ property :ledger_timeout, [:String, "^[0-9]*$"]
123
118
 
124
119
  # @!attribute immediate_or_cancel
125
120
  # If set to true this order will only take orders that are available at the time of execution and will not create an entry in the Ripple Ledger
126
121
  # @return [Boolean]
127
-
122
+ property :immediate_or_cancel, :Boolean
128
123
 
129
124
  # @!attribute fill_or_kill
130
125
  # If set to true this order will only take orders that fill the base_amount and are available at the time of execution and will not create an entry in the Ripple Ledger
131
126
  # @return [Boolean]
132
-
127
+ property :fill_or_kill, :Boolean
133
128
 
134
129
  # @!attribute maximize_buy_or_sell
135
130
  # If set to true and it is a buy order it will buy up to the base_amount even if the counter_amount is exceeded, if it is a sell order it will sell up to the counter_amount even if the base_amount is exceeded
136
131
  # @return [Boolean]
137
-
132
+ property :maximize_buy_or_sell, :Boolean
138
133
 
139
134
  # @!attribute cancel_replace
140
135
  # If this is set to the sequence number of an outstanding order, that order will be cancelled and replaced with this one
141
136
  # @return [String] +"^d*$"+
142
-
137
+ property :cancel_replace, [:String, "^d*$"]
143
138
 
144
139
  # @!attribute sequence
145
140
  # The sequence number of this order from the perspective of the seller_account. The seller_account and the sequence number uniquely identify the order in the Ripple Ledger
146
141
  # @return [String] +"^[0-9]*$"+
147
-
142
+ property :sequence, [:String, "^[0-9]*$"]
148
143
 
149
144
  # @!attribute fee
150
145
  # The Ripple Network transaction fee, represented in whole XRP (NOT "drops", or millionths of an XRP, which is used elsewhere in the Ripple protocol) used to create the order
151
- # @return [String<FloatString>]
152
-
146
+ # @return [BigDecimal]
147
+ property :fee, :FloatString
153
148
 
154
149
  # @!attribute state
155
150
  # If the order is active the state will be "active". If this object represents a historical order the state will be "validated", "filled" if the order was removed because it was fully filled, "cancelled" if it was deleted by the owner, "expired" if it reached the expiration_timestamp, or "failed" if there was an error with the initial attempt to place the order
156
151
  # @return [String] +"^active|validated|filled|cancelled|expired|failed$"+
157
-
152
+ property :state, [:String, "^active|validated|filled|cancelled|expired|failed$"]
158
153
 
159
154
  # @!attribute ledger
160
155
  # The string representation of the index number of the ledger containing this order or, in the case of historical queries, of the transaction that modified this Order.
161
156
  # @return [String] +"^[0-9]+$"+
162
-
157
+ property :ledger, [:String, "^[0-9]+$"]
163
158
 
164
159
  # @!attribute hash
165
160
  # When returned as the result of a historical query this will be the hash of Ripple transaction that created, modified, or deleted this order. The transaction hash is used throughout the Ripple Protocol to uniquely identify a particular transaction
166
- # @return [String<Hash256>] +"^$|^[A-Fa-f0-9]{64}$"+
167
-
161
+ # @return [String<Hash256>]
162
+ property :hash, :Hash256
168
163
 
169
164
  # @!attribute previous
170
165
  # If the order was modified or partially filled this will be a full Order object. If the previous object also had a previous object that will be removed to reduce data complexity. Order changes can be walked backwards by querying the API for previous.hash repeatedly
171
166
  # @return [Order]
172
-
167
+ property :previous, :Order
173
168
 
174
169
  end
175
170
  # An object
176
- class AccountSettings < AutoParse::Instance
171
+ class AccountSettings
177
172
  # @!attribute account
178
173
  # The Ripple address of the account in question
179
- # @return [String<RippleAddress>] +"^r[1-9A-HJ-NP-Za-km-z]{25,33}$"+
180
-
174
+ # @return [String<RippleAddress>]
175
+ property :account, :RippleAddress
176
+ required :account
181
177
 
182
178
  # @!attribute regular_key
183
179
  # The hash of an optional additional public key that can be used for signing and verifying transactions
184
- # @return [String<RippleAddress>] +"^r[1-9A-HJ-NP-Za-km-z]{25,33}$"+
185
-
180
+ # @return [String<RippleAddress>]
181
+ property :regular_key, :RippleAddress
186
182
 
187
183
  # @!attribute url
188
184
  # The domain associated with this account. The ripple.txt file can be looked up to verify this information
189
- # @return [String<URL>] +"^(ftp://|http://|https://)?([A-Za-z0-9_]+:{0,1}[A-Za-z0-9_]*@)?(^([ \\t\\r\\n\\f])+)(:[0-9]+)?(/|/([[A-Za-z0-9_]#!:.?+=&%@!-\\/]))?$"+
190
-
185
+ # @return [URI]
186
+ property :url, :URL
191
187
 
192
188
  # @!attribute email_hash
193
189
  # The MD5 128-bit hash of the account owner's email address
194
- # @return [String<Hash128>] +"^$|^[A-Fa-f0-9]{32}$"+
195
-
190
+ # @return [String<Hash128>]
191
+ property :email_hash, :Hash128
196
192
 
197
193
  # @!attribute message_key
198
194
  # An optional public key, represented as hex, that can be set to allow others to send encrypted messages to the account owner
199
195
  # @return [String] +"^([0-9a-fA-F]{2}){0,33}$"+
200
-
196
+ property :message_key, [:String, "^([0-9a-fA-F]{2}){0,33}$"]
201
197
 
202
198
  # @!attribute transfer_rate
203
199
  # A number representation of the rate charged each time a holder of currency issued by this account transfers it. By default the rate is 100. A rate of 101 is a 1% charge on top of the amount being transferred. Up to nine decimal places are supported
204
200
  # @return [Float]
205
-
201
+ property :transfer_rate, :Float
206
202
 
207
203
  # @!attribute require_destination_tag
208
204
  # If set to true incoming payments will only be validated if they include a destination_tag. This may be used primarily by gateways that operate exclusively with hosted wallets
209
205
  # @return [Boolean]
210
-
206
+ property :require_destination_tag, :Boolean
211
207
 
212
208
  # @!attribute require_authorization
213
209
  # If set to true incoming trustlines will only be validated if this account first creates a trustline to the counterparty with the authorized flag set to true. This may be used by gateways to prevent accounts unknown to them from holding currencies they issue
214
210
  # @return [Boolean]
215
-
211
+ property :require_authorization, :Boolean
216
212
 
217
213
  # @!attribute disallow_xrp
218
214
  # If set to true incoming XRP payments will be allowed
219
215
  # @return [Boolean]
220
-
216
+ property :disallow_xrp, :Boolean
221
217
 
222
218
  # @!attribute transaction_sequence
223
219
  # A string representation of the last sequence number of a validated transaction created by this account
224
- # @return [String<UINT32>] +"^$|^(429496729[0-5]|42949672[0-8][0-9]|4294967[01][0-9]{2}|429496[0-6][0-9]{3}|42949[0-5][0-9]{4}|4294[0-8][0-9]{5}|429[0-3][0-9]{6}|42[0-8][0-9]{7}|4[01][0-9]{8}|[1-3][0-9]{9}|[1-9][0-9]{8}|[1-9][0-9]{7}|[1-9][0-9]{6}|[1-9][0-9]{5}|[1-9][0-9]{4}|[1-9][0-9]{3}|[1-9][0-9]{2}|[1-9][0-9]|[0-9])$"+
225
-
220
+ # @return [String<UINT32>]
221
+ property :transaction_sequence, :UINT32
226
222
 
227
223
  # @!attribute trustline_count
228
224
  # The number of trustlines owned by this account. This value does not include incoming trustlines where this account has not explicitly reciprocated trust
229
- # @return [String<UINT32>] +"^$|^(429496729[0-5]|42949672[0-8][0-9]|4294967[01][0-9]{2}|429496[0-6][0-9]{3}|42949[0-5][0-9]{4}|4294[0-8][0-9]{5}|429[0-3][0-9]{6}|42[0-8][0-9]{7}|4[01][0-9]{8}|[1-3][0-9]{9}|[1-9][0-9]{8}|[1-9][0-9]{7}|[1-9][0-9]{6}|[1-9][0-9]{5}|[1-9][0-9]{4}|[1-9][0-9]{3}|[1-9][0-9]{2}|[1-9][0-9]|[0-9])$"+
230
-
225
+ # @return [String<UINT32>]
226
+ property :trustline_count, :UINT32
231
227
 
232
228
  # @!attribute ledger
233
229
  # The string representation of the index number of the ledger containing these account settings or, in the case of historical queries, of the transaction that modified these settings
234
230
  # @return [String] +"^[0-9]+$"+
235
-
231
+ property :ledger, [:String, "^[0-9]+$"]
236
232
 
237
233
  # @!attribute hash
238
234
  # If this object was returned by a historical query this value will be the hash of the transaction that modified these settings. The transaction hash is used throughout the Ripple Protocol to uniquely identify a particular transaction
239
- # @return [String<Hash256>] +"^$|^[A-Fa-f0-9]{64}$"+
240
-
235
+ # @return [String<Hash256>]
236
+ property :hash, :Hash256
241
237
 
242
238
  end
243
239
  # A flattened Payment object used by the ripple-rest API
244
- class Payment < AutoParse::Instance
240
+ class Payment
245
241
  # @!attribute source_account
246
242
  # The Ripple account address of the Payment sender
247
- # @return [String<RippleAddress>] +"^r[1-9A-HJ-NP-Za-km-z]{25,33}$"+
248
-
243
+ # @return [String<RippleAddress>]
244
+ property :source_account, :RippleAddress
245
+ required :source_account
249
246
 
250
247
  # @!attribute source_tag
251
248
  # A string representing an unsigned 32-bit integer most commonly used to refer to a sender's hosted account at a Ripple gateway
252
- # @return [String<UINT32>] +"^$|^(429496729[0-5]|42949672[0-8][0-9]|4294967[01][0-9]{2}|429496[0-6][0-9]{3}|42949[0-5][0-9]{4}|4294[0-8][0-9]{5}|429[0-3][0-9]{6}|42[0-8][0-9]{7}|4[01][0-9]{8}|[1-3][0-9]{9}|[1-9][0-9]{8}|[1-9][0-9]{7}|[1-9][0-9]{6}|[1-9][0-9]{5}|[1-9][0-9]{4}|[1-9][0-9]{3}|[1-9][0-9]{2}|[1-9][0-9]|[0-9])$"+
253
-
249
+ # @return [String<UINT32>]
250
+ property :source_tag, :UINT32
254
251
 
255
252
  # @!attribute source_amount
256
253
  # An optional amount that can be specified to constrain cross-currency payments
257
254
  # @return [Amount]
258
-
255
+ property :source_amount, :Amount
259
256
 
260
257
  # @!attribute source_slippage
261
258
  # 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
262
- # @return [String<FloatString>]
263
-
259
+ # @return [BigDecimal]
260
+ property :source_slippage, :FloatString
264
261
 
265
262
  # @!attribute destination_account
266
263
  #
267
- # @return [String<RippleAddress>] +"^r[1-9A-HJ-NP-Za-km-z]{25,33}$"+
268
-
264
+ # @return [String<RippleAddress>]
265
+ property :destination_account, :RippleAddress
266
+ required :destination_account
269
267
 
270
268
  # @!attribute destination_tag
271
269
  # A string representing an unsigned 32-bit integer most commonly used to refer to a receiver's hosted account at a Ripple gateway
272
- # @return [String<UINT32>] +"^$|^(429496729[0-5]|42949672[0-8][0-9]|4294967[01][0-9]{2}|429496[0-6][0-9]{3}|42949[0-5][0-9]{4}|4294[0-8][0-9]{5}|429[0-3][0-9]{6}|42[0-8][0-9]{7}|4[01][0-9]{8}|[1-3][0-9]{9}|[1-9][0-9]{8}|[1-9][0-9]{7}|[1-9][0-9]{6}|[1-9][0-9]{5}|[1-9][0-9]{4}|[1-9][0-9]{3}|[1-9][0-9]{2}|[1-9][0-9]|[0-9])$"+
273
-
270
+ # @return [String<UINT32>]
271
+ property :destination_tag, :UINT32
274
272
 
275
273
  # @!attribute destination_amount
276
274
  # The amount the destination_account will receive
277
275
  # @return [Amount]
278
-
276
+ property :destination_amount, :Amount
277
+ required :destination_amount
279
278
 
280
279
  # @!attribute invoice_id
281
280
  # A 256-bit hash that can be used to identify a particular payment
282
- # @return [String<Hash256>] +"^$|^[A-Fa-f0-9]{64}$"+
281
+ # @return [String<Hash256>]
282
+ property :invoice_id, :Hash256
283
283
 
284
-
285
- # @!attribute paths
284
+ # @!attribute paths
286
285
  # A "stringified" version of the Ripple PathSet structure that users should treat as opaque
287
286
  # @return [String]
288
-
287
+ property :paths, :String
289
288
 
290
289
  # @!attribute partial_payment
291
290
  # 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
291
  # @return [Boolean]
293
-
292
+ property :partial_payment, :Boolean
294
293
 
295
294
  # @!attribute no_direct_ripple
296
295
  # 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
296
  # @return [Boolean]
298
-
297
+ property :no_direct_ripple, :Boolean
299
298
 
300
299
  # @!attribute direction
301
300
  # The direction of the payment, from the perspective of the account being queried. Possible values are "incoming", "outgoing", and "passthrough"
302
301
  # @return [String] +"^incoming|outgoing|passthrough$"+
303
-
302
+ property :direction, [:String, "^incoming|outgoing|passthrough$"]
304
303
 
305
304
  # @!attribute state
306
305
  # 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
306
  # @return [String] +"^validated|failed|new$"+
308
-
307
+ property :state, [:String, "^validated|failed|new$"]
309
308
 
310
309
  # @!attribute result
311
310
  # 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
311
  # @return [String] +"te[cfjlms][A-Za-z_]+"+
313
-
312
+ property :result, [:String, "te[cfjlms][A-Za-z_]+"]
314
313
 
315
314
  # @!attribute ledger
316
315
  # 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
316
  # @return [String] +"^[0-9]+$"+
318
-
317
+ property :ledger, [:String, "^[0-9]+$"]
319
318
 
320
319
  # @!attribute hash
321
320
  # The 256-bit hash of the payment. This is used throughout the Ripple protocol as the unique identifier for the transaction
322
- # @return [String<Hash256>] +"^$|^[A-Fa-f0-9]{64}$"+
323
-
321
+ # @return [String<Hash256>]
322
+ property :hash, :Hash256
324
323
 
325
324
  # @!attribute timestamp
326
325
  # The timestamp representing when the payment was validated and written into the Ripple ledger
327
- # @return [String<Timestamp>] +"^$|^[0-9]{4}-[0-1][0-9]-[0-3][0-9]T(2[0-3]|[01][0-9]):[0-5][0-9]:[0-5][0-9](Z|[+](2[0-3]|[01][0-9]):[0-5][0-9])$"+
328
-
326
+ # @return [Time]
327
+ property :timestamp, :Timestamp
329
328
 
330
329
  # @!attribute fee
331
330
  # 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
- # @return [String<FloatString>]
333
-
331
+ # @return [BigDecimal]
332
+ property :fee, :FloatString
334
333
 
335
334
  # @!attribute source_balance_changes
336
335
  # 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
- # @return [array]
338
-
336
+ # @return [Array<Amount>]
337
+ property :source_balance_changes, [:Array, :Amount]
339
338
 
340
339
  # @!attribute destination_balance_changes
341
340
  # 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
- # @return [array]
343
-
341
+ # @return [Array<Amount>]
342
+ property :destination_balance_changes, [:Array, :Amount]
344
343
 
345
344
  end
346
345
  # A simplified representation of an account Balance
347
- class Balance < AutoParse::Instance
346
+ class Balance
348
347
  # @!attribute value
349
348
  # The quantity of the currency, denoted as a string to retain floating point precision
350
349
  # @return [String]
351
-
350
+ property :value, :String
351
+ required :value
352
352
 
353
353
  # @!attribute currency
354
354
  # The currency expressed as a three-character code
355
- # @return [String<Currency>] +"^([a-zA-Z0-9]{3}|[A-Fa-f0-9]{40})$"+
356
-
355
+ # @return [String<Currency>]
356
+ property :currency, :Currency
357
+ required :currency
357
358
 
358
359
  # @!attribute counterparty
359
360
  # The Ripple account address of the currency's issuer or gateway, or an empty string if the currency is XRP
360
361
  # @return [String] +"^$|^r[1-9A-HJ-NP-Za-km-z]{25,33}$"+
361
-
362
+ property :counterparty, [:String, "^$|^r[1-9A-HJ-NP-Za-km-z]{25,33}$"]
362
363
 
363
364
  end
364
365
  # An Amount on the Ripple Protocol, used also for XRP in the ripple-rest API
365
- class Amount < AutoParse::Instance
366
+ class Amount
366
367
  # @!attribute value
367
368
  # The quantity of the currency, denoted as a string to retain floating point precision
368
369
  # @return [String]
369
-
370
+ property :value, :String
371
+ required :value
370
372
 
371
373
  # @!attribute currency
372
374
  # The currency expressed as a three-character code
373
- # @return [String<Currency>] +"^([a-zA-Z0-9]{3}|[A-Fa-f0-9]{40})$"+
374
-
375
+ # @return [String<Currency>]
376
+ property :currency, :Currency
377
+ required :currency
375
378
 
376
379
  # @!attribute issuer
377
380
  # The Ripple account address of the currency's issuer or gateway, or an empty string if the currency is XRP
378
381
  # @return [String] +"^$|^r[1-9A-HJ-NP-Za-km-z]{25,33}$"+
379
-
382
+ property :issuer, [:String, "^$|^r[1-9A-HJ-NP-Za-km-z]{25,33}$"]
380
383
 
381
384
  # @!attribute counterparty
382
385
  # The Ripple account address of the currency's issuer or gateway, or an empty string if the currency is XRP
383
386
  # @return [String] +"^$|^r[1-9A-HJ-NP-Za-km-z]{25,33}$"+
384
-
387
+ property :counterparty, [:String, "^$|^r[1-9A-HJ-NP-Za-km-z]{25,33}$"]
385
388
 
386
389
  end
387
390
  # A simplified Trustline object used by the ripple-rest API
388
- class Trustline < AutoParse::Instance
391
+ class Trustline
389
392
  # @!attribute account
390
393
  # The account from whose perspective this trustline is being viewed
391
- # @return [String<RippleAddress>] +"^r[1-9A-HJ-NP-Za-km-z]{25,33}$"+
392
-
394
+ # @return [String<RippleAddress>]
395
+ property :account, :RippleAddress
396
+ required :account
393
397
 
394
398
  # @!attribute counterparty
395
399
  # The other party in this trustline
396
- # @return [String<RippleAddress>] +"^r[1-9A-HJ-NP-Za-km-z]{25,33}$"+
397
-
400
+ # @return [String<RippleAddress>]
401
+ property :counterparty, :RippleAddress
398
402
 
399
403
  # @!attribute currency
400
404
  # The code of the currency in which this trustline denotes trust
401
- # @return [String<Currency>] +"^([a-zA-Z0-9]{3}|[A-Fa-f0-9]{40})$"+
402
-
405
+ # @return [String<Currency>]
406
+ property :currency, :Currency
403
407
 
404
408
  # @!attribute limit
405
409
  # The maximum value of the currency that the account may hold issued by the counterparty
406
- # @return [String<FloatString>]
407
-
410
+ # @return [BigDecimal]
411
+ property :limit, :FloatString
412
+ required :limit
408
413
 
409
414
  # @!attribute reciprocated_limit
410
415
  # The maximum value of the currency that the counterparty may hold issued by the account
411
- # @return [String<FloatString>]
412
-
416
+ # @return [BigDecimal]
417
+ property :reciprocated_limit, :FloatString
413
418
 
414
419
  # @!attribute authorized_by_account
415
420
  # Set to true if the account has explicitly authorized the counterparty to hold currency it issues. This is only necessary if the account's settings include require_authorization_for_incoming_trustlines
416
421
  # @return [Boolean]
417
-
422
+ property :authorized_by_account, :Boolean
418
423
 
419
424
  # @!attribute authorized_by_counterparty
420
425
  # Set to true if the counterparty has explicitly authorized the account to hold currency it issues. This is only necessary if the counterparty's settings include require_authorization_for_incoming_trustlines
421
426
  # @return [Boolean]
422
-
427
+ property :authorized_by_counterparty, :Boolean
423
428
 
424
429
  # @!attribute account_allows_rippling
425
430
  # If true it indicates that the account allows pairwise rippling out through this trustline
426
431
  # @return [Boolean]
427
-
432
+ property :account_allows_rippling, :Boolean
428
433
 
429
434
  # @!attribute counterparty_allows_rippling
430
435
  # If true it indicates that the counterparty allows pairwise rippling out through this trustline
431
436
  # @return [Boolean]
432
-
437
+ property :counterparty_allows_rippling, :Boolean
433
438
 
434
439
  # @!attribute ledger
435
440
  # The string representation of the index number of the ledger containing this trustline or, in the case of historical queries, of the transaction that modified this Trustline
436
441
  # @return [String] +"^[0-9]+$"+
437
-
442
+ property :ledger, [:String, "^[0-9]+$"]
438
443
 
439
444
  # @!attribute hash
440
445
  # If this object was returned by a historical query this value will be the hash of the transaction that modified this Trustline. The transaction hash is used throughout the Ripple Protocol to uniquely identify a particular transaction
441
- # @return [String<Hash256>] +"^$|^[A-Fa-f0-9]{64}$"+
442
-
446
+ # @return [String<Hash256>]
447
+ property :hash, :Hash256
443
448
 
444
449
  # @!attribute previous
445
450
  # If the trustline was changed this will be a full Trustline object representing the previous values. If the previous object also had a previous object that will be removed to reduce data complexity. Trustline changes can be walked backwards by querying the API for previous.hash repeatedly
446
451
  # @return [Trustline]
447
-
452
+ property :previous, :Trustline
448
453
 
449
454
  end
450
455
  end