Class: Cryptopay::ExchangeTransferParams

Inherits:
Object
  • Object
show all
Defined in:
lib/cryptopay/models/exchange_transfer_params.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ ExchangeTransferParams

Initializes the object

Parameters:

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

    Model attributes in the form of hash



43
44
45
# File 'lib/cryptopay/models/exchange_transfer_params.rb', line 43

def initialize(attributes = {})
  @attributes = ENCODER.sanitize(attributes)
end

Class Method Details

.build_from_hash(data) ⇒ Cryptopay::ExchangeTransferParams

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:



36
37
38
39
# File 'lib/cryptopay/models/exchange_transfer_params.rb', line 36

def self.build_from_hash(data)
  attributes = ENCODER.build_from_hash(data)
  new(attributes)
end

Instance Method Details

#charged_amountObject

Amount to be converted



53
54
55
# File 'lib/cryptopay/models/exchange_transfer_params.rb', line 53

def charged_amount
  @attributes[:charged_amount]
end

#charged_currencyObject

Account currency the funds to be converted from



48
49
50
# File 'lib/cryptopay/models/exchange_transfer_params.rb', line 48

def charged_currency
  @attributes[:charged_currency]
end

#custom_idObject

Exchange transaction reference ID in your system



68
69
70
# File 'lib/cryptopay/models/exchange_transfer_params.rb', line 68

def custom_id
  @attributes[:custom_id]
end

#force_commitObject

Is ‘false` if omitted. Set `true` to turn off two-step exchange. Set `false` for two-step exchange and commit it within 30 seconds



73
74
75
# File 'lib/cryptopay/models/exchange_transfer_params.rb', line 73

def force_commit
  @attributes[:force_commit]
end

#inspectObject



103
104
105
# File 'lib/cryptopay/models/exchange_transfer_params.rb', line 103

def inspect
  "#<#{self.class}:0x#{object_id.to_s(16)}> JSON: " + JSON.pretty_generate(to_hash)
end

#invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



79
80
81
82
83
84
85
86
87
88
89
# File 'lib/cryptopay/models/exchange_transfer_params.rb', line 79

def invalid_properties
  properties = []

  properties.push('invalid value for "charged_currency", charged_currency cannot be nil.') if charged_currency.nil?

  if received_currency.nil?
    properties.push('invalid value for "received_currency", received_currency cannot be nil.')
  end

  properties
end

#received_amountObject

Amount to be received upon exchange execution



63
64
65
# File 'lib/cryptopay/models/exchange_transfer_params.rb', line 63

def received_amount
  @attributes[:received_amount]
end

#received_currencyObject

Account currency the funds to be converted to



58
59
60
# File 'lib/cryptopay/models/exchange_transfer_params.rb', line 58

def received_currency
  @attributes[:received_currency]
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



99
100
101
# File 'lib/cryptopay/models/exchange_transfer_params.rb', line 99

def to_hash
  ENCODER.to_hash(@attributes)
end

#valid?Boolean

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

Returns:

  • (Boolean)

    true if the model is valid



93
94
95
# File 'lib/cryptopay/models/exchange_transfer_params.rb', line 93

def valid?
  invalid_properties.empty?
end