Class: CybridApiBank::InternalFeeChargeBankModel

Inherits:
Object
  • Object
show all
Defined in:
lib/cybrid_api_bank_ruby/models/internal_fee_charge_bank_model.rb

Overview

Response body for fee_charges.

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ InternalFeeChargeBankModel

Initializes the object

Parameters:

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

    Model attributes in the form of hash



128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
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
# File 'lib/cybrid_api_bank_ruby/models/internal_fee_charge_bank_model.rb', line 128

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

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

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

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

  if attributes.key?(:'type')
    self.type = attributes[:'type']
  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?(:'asset')
    self.asset = attributes[:'asset']
  end

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

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

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

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

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

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

Instance Attribute Details

#amountObject

The fee amount in cents.



38
39
40
# File 'lib/cybrid_api_bank_ruby/models/internal_fee_charge_bank_model.rb', line 38

def amount
  @amount
end

#assetObject

The fee amount asset code.



35
36
37
# File 'lib/cybrid_api_bank_ruby/models/internal_fee_charge_bank_model.rb', line 35

def asset
  @asset
end

#created_atObject

ISO8601 datetime the entity was created at.



29
30
31
# File 'lib/cybrid_api_bank_ruby/models/internal_fee_charge_bank_model.rb', line 29

def created_at
  @created_at
end

#destination_account_guidObject

The destination account identifier.



44
45
46
# File 'lib/cybrid_api_bank_ruby/models/internal_fee_charge_bank_model.rb', line 44

def 
  @destination_account_guid
end

#environmentObject

The platform environment.



20
21
22
# File 'lib/cybrid_api_bank_ruby/models/internal_fee_charge_bank_model.rb', line 20

def environment
  @environment
end

#exchange_order_guidObject

The exchange order identifier. Required when type is platform_assignment.



53
54
55
# File 'lib/cybrid_api_bank_ruby/models/internal_fee_charge_bank_model.rb', line 53

def exchange_order_guid
  @exchange_order_guid
end

#failure_codeObject

The failure code if the entity is in a failed state.



50
51
52
# File 'lib/cybrid_api_bank_ruby/models/internal_fee_charge_bank_model.rb', line 50

def failure_code
  @failure_code
end

#guidObject

Auto-generated unique identifier for the entity.



23
24
25
# File 'lib/cybrid_api_bank_ruby/models/internal_fee_charge_bank_model.rb', line 23

def guid
  @guid
end

#source_account_guidObject

The source account identifier.



41
42
43
# File 'lib/cybrid_api_bank_ruby/models/internal_fee_charge_bank_model.rb', line 41

def 
  @source_account_guid
end

#stateObject

The state of the entity.



47
48
49
# File 'lib/cybrid_api_bank_ruby/models/internal_fee_charge_bank_model.rb', line 47

def state
  @state
end

#typeObject

The type of the entity.



26
27
28
# File 'lib/cybrid_api_bank_ruby/models/internal_fee_charge_bank_model.rb', line 26

def type
  @type
end

#updated_atObject

ISO8601 datetime the entity was last updated at.



32
33
34
# File 'lib/cybrid_api_bank_ruby/models/internal_fee_charge_bank_model.rb', line 32

def updated_at
  @updated_at
end

Class Method Details

.acceptable_attributesObject

Returns all the JSON keys this model knows about



96
97
98
# File 'lib/cybrid_api_bank_ruby/models/internal_fee_charge_bank_model.rb', line 96

def self.acceptable_attributes
  attribute_map.values
end

.attribute_mapObject

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



78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# File 'lib/cybrid_api_bank_ruby/models/internal_fee_charge_bank_model.rb', line 78

def self.attribute_map
  {
    :'environment' => :'environment',
    :'guid' => :'guid',
    :'type' => :'type',
    :'created_at' => :'created_at',
    :'updated_at' => :'updated_at',
    :'asset' => :'asset',
    :'amount' => :'amount',
    :'source_account_guid' => :'source_account_guid',
    :'destination_account_guid' => :'destination_account_guid',
    :'state' => :'state',
    :'failure_code' => :'failure_code',
    :'exchange_order_guid' => :'exchange_order_guid'
  }
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



490
491
492
# File 'lib/cybrid_api_bank_ruby/models/internal_fee_charge_bank_model.rb', line 490

def self.build_from_hash(attributes)
  new.build_from_hash(attributes)
end

.openapi_nullableObject

List of attributes with nullable: true



119
120
121
122
123
124
# File 'lib/cybrid_api_bank_ruby/models/internal_fee_charge_bank_model.rb', line 119

def self.openapi_nullable
  Set.new([
    :'failure_code',
    :'exchange_order_guid'
  ])
end

.openapi_typesObject

Attribute type mapping.



101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
# File 'lib/cybrid_api_bank_ruby/models/internal_fee_charge_bank_model.rb', line 101

def self.openapi_types
  {
    :'environment' => :'String',
    :'guid' => :'String',
    :'type' => :'String',
    :'created_at' => :'Time',
    :'updated_at' => :'Time',
    :'asset' => :'String',
    :'amount' => :'Integer',
    :'source_account_guid' => :'String',
    :'destination_account_guid' => :'String',
    :'state' => :'String',
    :'failure_code' => :'String',
    :'exchange_order_guid' => :'String'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
# File 'lib/cybrid_api_bank_ruby/models/internal_fee_charge_bank_model.rb', line 458

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      environment == o.environment &&
      guid == o.guid &&
      type == o.type &&
      created_at == o.created_at &&
      updated_at == o.updated_at &&
      asset == o.asset &&
      amount == o.amount &&
       == o. &&
       == o. &&
      state == o.state &&
      failure_code == o.failure_code &&
      exchange_order_guid == o.exchange_order_guid
end

#_deserialize(type, value) ⇒ Object

Deserializes the data based on type

Parameters:

  • string

    type Data type

  • string

    value Value to be deserialized

Returns:

  • (Object)

    Deserialized data



521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
# File 'lib/cybrid_api_bank_ruby/models/internal_fee_charge_bank_model.rb', line 521

def _deserialize(type, value)
  case type.to_sym
  when :Time
    Time.parse(value)
  when :Date
    Date.parse(value)
  when :String
    value.to_s
  when :Integer
    value.to_i
  when :Float
    value.to_f
  when :Boolean
    if value.to_s =~ /\A(true|t|yes|y|1)\z/i
      true
    else
      false
    end
  when :Object
    # generic object (usually a Hash), return directly
    value
  when /\AArray<(?<inner_type>.+)>\z/
    inner_type = Regexp.last_match[:inner_type]
    value.map { |v| _deserialize(inner_type, v) }
  when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
    k_type = Regexp.last_match[:k_type]
    v_type = Regexp.last_match[:v_type]
    {}.tap do |hash|
      value.each do |k, v|
        hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
      end
    end
  else # model
    # models (e.g. Pet) or oneOf
    klass = CybridApiBank.const_get(type)
    klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
  end
end

#_to_hash(value) ⇒ Hash

Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value

Parameters:

  • value (Object)

    Any valid value

Returns:

  • (Hash)

    Returns the value in the form of hash



592
593
594
595
596
597
598
599
600
601
602
603
604
# File 'lib/cybrid_api_bank_ruby/models/internal_fee_charge_bank_model.rb', line 592

def _to_hash(value)
  if value.is_a?(Array)
    value.compact.map { |v| _to_hash(v) }
  elsif value.is_a?(Hash)
    {}.tap do |hash|
      value.each { |k, v| hash[k] = _to_hash(v) }
    end
  elsif value.respond_to? :to_hash
    value.to_hash
  else
    value
  end
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



497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
# File 'lib/cybrid_api_bank_ruby/models/internal_fee_charge_bank_model.rb', line 497

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  attributes = attributes.transform_keys(&:to_sym)
  self.class.openapi_types.each_pair do |key, type|
    if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
      self.send("#{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[self.class.attribute_map[key]].is_a?(Array)
        self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
    end
  end

  self
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


477
478
479
# File 'lib/cybrid_api_bank_ruby/models/internal_fee_charge_bank_model.rb', line 477

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



483
484
485
# File 'lib/cybrid_api_bank_ruby/models/internal_fee_charge_bank_model.rb', line 483

def hash
  [environment, guid, type, created_at, updated_at, asset, amount, , , state, failure_code, exchange_order_guid].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



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
268
269
270
271
272
273
274
275
276
277
278
279
# File 'lib/cybrid_api_bank_ruby/models/internal_fee_charge_bank_model.rb', line 192

def list_invalid_properties
  invalid_properties = Array.new
  if @environment.nil?
    invalid_properties.push('invalid value for "environment", environment cannot be nil.')
  end

  if @guid.nil?
    invalid_properties.push('invalid value for "guid", guid cannot be nil.')
  end

  if @guid.to_s.length > 32
    invalid_properties.push('invalid value for "guid", the character length must be smaller than or equal to 32.')
  end

  if @guid.to_s.length < 32
    invalid_properties.push('invalid value for "guid", the character length must be great than or equal to 32.')
  end

  if @type.nil?
    invalid_properties.push('invalid value for "type", type cannot be nil.')
  end

  if @created_at.nil?
    invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
  end

  if @updated_at.nil?
    invalid_properties.push('invalid value for "updated_at", updated_at cannot be nil.')
  end

  if @asset.nil?
    invalid_properties.push('invalid value for "asset", asset cannot be nil.')
  end

  if @asset.to_s.length > 16
    invalid_properties.push('invalid value for "asset", the character length must be smaller than or equal to 16.')
  end

  if @asset.to_s.length < 1
    invalid_properties.push('invalid value for "asset", the character length must be great than or equal to 1.')
  end

  if @amount.nil?
    invalid_properties.push('invalid value for "amount", amount cannot be nil.')
  end

  if @amount < 0
    invalid_properties.push('invalid value for "amount", must be greater than or equal to 0.')
  end

  if @source_account_guid.nil?
    invalid_properties.push('invalid value for "source_account_guid", source_account_guid cannot be nil.')
  end

  if @source_account_guid.to_s.length > 32
    invalid_properties.push('invalid value for "source_account_guid", the character length must be smaller than or equal to 32.')
  end

  if @source_account_guid.to_s.length < 32
    invalid_properties.push('invalid value for "source_account_guid", the character length must be great than or equal to 32.')
  end

  if @destination_account_guid.nil?
    invalid_properties.push('invalid value for "destination_account_guid", destination_account_guid cannot be nil.')
  end

  if @destination_account_guid.to_s.length > 32
    invalid_properties.push('invalid value for "destination_account_guid", the character length must be smaller than or equal to 32.')
  end

  if @destination_account_guid.to_s.length < 32
    invalid_properties.push('invalid value for "destination_account_guid", the character length must be great than or equal to 32.')
  end

  if @state.nil?
    invalid_properties.push('invalid value for "state", state cannot be nil.')
  end

  if !@exchange_order_guid.nil? && @exchange_order_guid.to_s.length > 32
    invalid_properties.push('invalid value for "exchange_order_guid", the character length must be smaller than or equal to 32.')
  end

  if !@exchange_order_guid.nil? && @exchange_order_guid.to_s.length < 32
    invalid_properties.push('invalid value for "exchange_order_guid", the character length must be great than or equal to 32.')
  end

  invalid_properties
end

#to_bodyHash

to_body is an alias to to_hash (backward compatibility)

Returns:

  • (Hash)

    Returns the object in the form of hash



568
569
570
# File 'lib/cybrid_api_bank_ruby/models/internal_fee_charge_bank_model.rb', line 568

def to_body
  to_hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



574
575
576
577
578
579
580
581
582
583
584
585
586
# File 'lib/cybrid_api_bank_ruby/models/internal_fee_charge_bank_model.rb', line 574

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

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



562
563
564
# File 'lib/cybrid_api_bank_ruby/models/internal_fee_charge_bank_model.rb', line 562

def to_s
  to_hash.to_s
end

#valid?Boolean

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

Returns:

  • (Boolean)

    true if the model is valid



283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
# File 'lib/cybrid_api_bank_ruby/models/internal_fee_charge_bank_model.rb', line 283

def valid?
  return false if @environment.nil?
  environment_validator = EnumAttributeValidator.new('String', ["sandbox", "production"])
  return false unless environment_validator.valid?(@environment)
  return false if @guid.nil?
  return false if @guid.to_s.length > 32
  return false if @guid.to_s.length < 32
  return false if @type.nil?
  type_validator = EnumAttributeValidator.new('String', ["platform_assignment"])
  return false unless type_validator.valid?(@type)
  return false if @created_at.nil?
  return false if @updated_at.nil?
  return false if @asset.nil?
  return false if @asset.to_s.length > 16
  return false if @asset.to_s.length < 1
  return false if @amount.nil?
  return false if @amount < 0
  return false if @source_account_guid.nil?
  return false if @source_account_guid.to_s.length > 32
  return false if @source_account_guid.to_s.length < 32
  return false if @destination_account_guid.nil?
  return false if @destination_account_guid.to_s.length > 32
  return false if @destination_account_guid.to_s.length < 32
  return false if @state.nil?
  state_validator = EnumAttributeValidator.new('String', ["storing", "pending", "completed", "failed"])
  return false unless state_validator.valid?(@state)
  failure_code_validator = EnumAttributeValidator.new('String', ["non_sufficient_funds"])
  return false unless failure_code_validator.valid?(@failure_code)
  return false if !@exchange_order_guid.nil? && @exchange_order_guid.to_s.length > 32
  return false if !@exchange_order_guid.nil? && @exchange_order_guid.to_s.length < 32
  true
end