Class: Mudbase::WalletTransaction

Inherits:
ApiModelBase show all
Defined in:
lib/mudbase/models/wallet_transaction.rb

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ApiModelBase

_deserialize, #_to_hash, #to_body, #to_s

Constructor Details

#initialize(attributes = {}) ⇒ WalletTransaction

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash



164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
# File 'lib/mudbase/models/wallet_transaction.rb', line 164

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `Mudbase::WalletTransaction` initialize method"
  end

  # check to see if the attribute exists and convert string to symbol for hash key
  acceptable_attribute_map = self.class.acceptable_attribute_map
  attributes = attributes.each_with_object({}) { |(k, v), h|
    if (!acceptable_attribute_map.key?(k.to_sym))
      fail ArgumentError, "`#{k}` is not a valid attribute in `Mudbase::WalletTransaction`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
    end
    h[k.to_sym] = v
  }

  if attributes.key?(:'_id')
    self._id = attributes[:'_id']
  end

  if attributes.key?(:'tx_hash')
    self.tx_hash = attributes[:'tx_hash']
  end

  if attributes.key?(:'main_tx_hash')
    self.main_tx_hash = attributes[:'main_tx_hash']
  end

  if attributes.key?(:'address')
    self.address = attributes[:'address']
  end

  if attributes.key?(:'chain')
    self.chain = attributes[:'chain']
  end

  if attributes.key?(:'from')
    self.from = attributes[:'from']
  end

  if attributes.key?(:'to')
    self.to = attributes[:'to']
  end

  if attributes.key?(:'from_address')
    self.from_address = attributes[:'from_address']
  end

  if attributes.key?(:'to_address')
    self.to_address = attributes[:'to_address']
  end

  if attributes.key?(:'amount')
    self.amount = attributes[:'amount']
  end

  if attributes.key?(:'currency')
    self.currency = attributes[:'currency']
  end

  if attributes.key?(:'type')
    self.type = attributes[:'type']
  end

  if attributes.key?(:'status')
    self.status = attributes[:'status']
  end

  if attributes.key?(:'main_tx_status')
    self.main_tx_status = attributes[:'main_tx_status']
  end

  if attributes.key?(:'confirmations')
    self.confirmations = attributes[:'confirmations']
  end

  if attributes.key?(:'block_number')
    self.block_number = attributes[:'block_number']
  end

  if attributes.key?(:'block_hash')
    self.block_hash = attributes[:'block_hash']
  end

  if attributes.key?(:'network_fee')
    self.network_fee = attributes[:'network_fee']
  end

  if attributes.key?(:'main_tx_confirmed_at')
    self.main_tx_confirmed_at = attributes[:'main_tx_confirmed_at']
  end

  if attributes.key?(:'created_at')
    self.created_at = attributes[:'created_at']
  end

  if attributes.key?(:'updated_at')
    self.updated_at = attributes[:'updated_at']
  end

  if attributes.key?(:'token_transfers')
    if (value = attributes[:'token_transfers']).is_a?(Array)
      self.token_transfers = value
    end
  end
end

Instance Attribute Details

#_idObject

Returns the value of attribute _id.



18
19
20
# File 'lib/mudbase/models/wallet_transaction.rb', line 18

def _id
  @_id
end

#addressObject

Returns the value of attribute address.



24
25
26
# File 'lib/mudbase/models/wallet_transaction.rb', line 24

def address
  @address
end

#amountObject

Transaction amount (string to handle large numbers)



37
38
39
# File 'lib/mudbase/models/wallet_transaction.rb', line 37

def amount
  @amount
end

#block_hashObject

Returns the value of attribute block_hash.



51
52
53
# File 'lib/mudbase/models/wallet_transaction.rb', line 51

def block_hash
  @block_hash
end

#block_numberObject

Returns the value of attribute block_number.



49
50
51
# File 'lib/mudbase/models/wallet_transaction.rb', line 49

def block_number
  @block_number
end

#chainObject

Returns the value of attribute chain.



26
27
28
# File 'lib/mudbase/models/wallet_transaction.rb', line 26

def chain
  @chain
end

#confirmationsObject

Returns the value of attribute confirmations.



47
48
49
# File 'lib/mudbase/models/wallet_transaction.rb', line 47

def confirmations
  @confirmations
end

#created_atObject

Returns the value of attribute created_at.



58
59
60
# File 'lib/mudbase/models/wallet_transaction.rb', line 58

def created_at
  @created_at
end

#currencyObject

Returns the value of attribute currency.



39
40
41
# File 'lib/mudbase/models/wallet_transaction.rb', line 39

def currency
  @currency
end

#fromObject

Returns the value of attribute from.



28
29
30
# File 'lib/mudbase/models/wallet_transaction.rb', line 28

def from
  @from
end

#from_addressObject

Returns the value of attribute from_address.



32
33
34
# File 'lib/mudbase/models/wallet_transaction.rb', line 32

def from_address
  @from_address
end

#main_tx_confirmed_atObject

Returns the value of attribute main_tx_confirmed_at.



56
57
58
# File 'lib/mudbase/models/wallet_transaction.rb', line 56

def main_tx_confirmed_at
  @main_tx_confirmed_at
end

#main_tx_hashObject

Returns the value of attribute main_tx_hash.



22
23
24
# File 'lib/mudbase/models/wallet_transaction.rb', line 22

def main_tx_hash
  @main_tx_hash
end

#main_tx_statusObject

Returns the value of attribute main_tx_status.



45
46
47
# File 'lib/mudbase/models/wallet_transaction.rb', line 45

def main_tx_status
  @main_tx_status
end

#network_feeObject

Network fee (string to handle large numbers)



54
55
56
# File 'lib/mudbase/models/wallet_transaction.rb', line 54

def network_fee
  @network_fee
end

#statusObject

Returns the value of attribute status.



43
44
45
# File 'lib/mudbase/models/wallet_transaction.rb', line 43

def status
  @status
end

#toObject

Returns the value of attribute to.



30
31
32
# File 'lib/mudbase/models/wallet_transaction.rb', line 30

def to
  @to
end

#to_addressObject

Returns the value of attribute to_address.



34
35
36
# File 'lib/mudbase/models/wallet_transaction.rb', line 34

def to_address
  @to_address
end

#token_transfersObject

Parsed token transfer list (incoming and outgoing) when available



63
64
65
# File 'lib/mudbase/models/wallet_transaction.rb', line 63

def token_transfers
  @token_transfers
end

#tx_hashObject

Returns the value of attribute tx_hash.



20
21
22
# File 'lib/mudbase/models/wallet_transaction.rb', line 20

def tx_hash
  @tx_hash
end

#typeObject

Returns the value of attribute type.



41
42
43
# File 'lib/mudbase/models/wallet_transaction.rb', line 41

def type
  @type
end

#updated_atObject

Returns the value of attribute updated_at.



60
61
62
# File 'lib/mudbase/models/wallet_transaction.rb', line 60

def updated_at
  @updated_at
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



116
117
118
# File 'lib/mudbase/models/wallet_transaction.rb', line 116

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



121
122
123
# File 'lib/mudbase/models/wallet_transaction.rb', line 121

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# File 'lib/mudbase/models/wallet_transaction.rb', line 88

def self.attribute_map
  {
    :'_id' => :'_id',
    :'tx_hash' => :'txHash',
    :'main_tx_hash' => :'mainTxHash',
    :'address' => :'address',
    :'chain' => :'chain',
    :'from' => :'from',
    :'to' => :'to',
    :'from_address' => :'fromAddress',
    :'to_address' => :'toAddress',
    :'amount' => :'amount',
    :'currency' => :'currency',
    :'type' => :'type',
    :'status' => :'status',
    :'main_tx_status' => :'mainTxStatus',
    :'confirmations' => :'confirmations',
    :'block_number' => :'blockNumber',
    :'block_hash' => :'blockHash',
    :'network_fee' => :'networkFee',
    :'main_tx_confirmed_at' => :'mainTxConfirmedAt',
    :'created_at' => :'createdAt',
    :'updated_at' => :'updatedAt',
    :'token_transfers' => :'tokenTransfers'
  }
end

.build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
# File 'lib/mudbase/models/wallet_transaction.rb', line 352

def self.build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  attributes = attributes.transform_keys(&:to_sym)
  transformed_hash = {}
  openapi_types.each_pair do |key, type|
    if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
      transformed_hash["#{key}"] = nil
    elsif type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that the attribute
      # is documented as an array but the input is not
      if attributes[attribute_map[key]].is_a?(Array)
        transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
      end
    elsif !attributes[attribute_map[key]].nil?
      transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
    end
  end
  new(transformed_hash)
end

.openapi_nullableObject

List of attributes with nullable: true



154
155
156
157
158
159
160
# File 'lib/mudbase/models/wallet_transaction.rb', line 154

def self.openapi_nullable
  Set.new([
    :'block_number',
    :'block_hash',
    :'main_tx_confirmed_at',
  ])
end

.openapi_typesObject

Attribute type mapping.



126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
# File 'lib/mudbase/models/wallet_transaction.rb', line 126

def self.openapi_types
  {
    :'_id' => :'String',
    :'tx_hash' => :'String',
    :'main_tx_hash' => :'String',
    :'address' => :'String',
    :'chain' => :'String',
    :'from' => :'String',
    :'to' => :'String',
    :'from_address' => :'String',
    :'to_address' => :'String',
    :'amount' => :'String',
    :'currency' => :'String',
    :'type' => :'String',
    :'status' => :'String',
    :'main_tx_status' => :'String',
    :'confirmations' => :'Integer',
    :'block_number' => :'Integer',
    :'block_hash' => :'String',
    :'network_fee' => :'String',
    :'main_tx_confirmed_at' => :'Time',
    :'created_at' => :'Time',
    :'updated_at' => :'Time',
    :'token_transfers' => :'Array<WalletTransactionTokenTransfersInner>'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
# File 'lib/mudbase/models/wallet_transaction.rb', line 310

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      _id == o._id &&
      tx_hash == o.tx_hash &&
      main_tx_hash == o.main_tx_hash &&
      address == o.address &&
      chain == o.chain &&
      from == o.from &&
      to == o.to &&
      from_address == o.from_address &&
      to_address == o.to_address &&
      amount == o.amount &&
      currency == o.currency &&
      type == o.type &&
      status == o.status &&
      main_tx_status == o.main_tx_status &&
      confirmations == o.confirmations &&
      block_number == o.block_number &&
      block_hash == o.block_hash &&
      network_fee == o.network_fee &&
      main_tx_confirmed_at == o.main_tx_confirmed_at &&
      created_at == o.created_at &&
      updated_at == o.updated_at &&
      token_transfers == o.token_transfers
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


339
340
341
# File 'lib/mudbase/models/wallet_transaction.rb', line 339

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



345
346
347
# File 'lib/mudbase/models/wallet_transaction.rb', line 345

def hash
  [_id, tx_hash, main_tx_hash, address, chain, from, to, from_address, to_address, amount, currency, type, status, main_tx_status, confirmations, block_number, block_hash, network_fee, main_tx_confirmed_at, created_at, updated_at, token_transfers].hash
end

#list_invalid_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properties with the reasons



271
272
273
274
275
# File 'lib/mudbase/models/wallet_transaction.rb', line 271

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  invalid_properties
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



374
375
376
377
378
379
380
381
382
383
384
385
386
# File 'lib/mudbase/models/wallet_transaction.rb', line 374

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    if value.nil?
      is_nullable = self.class.openapi_nullable.include?(attr)
      next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
    end

    hash[param] = _to_hash(value)
  end
  hash
end

#valid?Boolean

Check to see if the all the properties in the model are valid

Returns:

  • (Boolean)

    true if the model is valid



279
280
281
282
283
284
285
286
# File 'lib/mudbase/models/wallet_transaction.rb', line 279

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  status_validator = EnumAttributeValidator.new('String', ["pending", "completed", "failed"])
  return false unless status_validator.valid?(@status)
  main_tx_status_validator = EnumAttributeValidator.new('String', ["pending", "confirmed", "failed"])
  return false unless main_tx_status_validator.valid?(@main_tx_status)
  true
end