Class: Cryptopay::CoinDestinationTag

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

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ CoinDestinationTag

Initializes the object

Parameters:

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

    Model attributes in the form of hash



32
33
34
# File 'lib/cryptopay/models/coin_destination_tag.rb', line 32

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

Class Method Details

.build_from_hash(data) ⇒ Cryptopay::CoinDestinationTag

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:



25
26
27
28
# File 'lib/cryptopay/models/coin_destination_tag.rb', line 25

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

Instance Method Details

#inspectObject



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

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



46
47
48
49
50
51
52
53
54
# File 'lib/cryptopay/models/coin_destination_tag.rb', line 46

def invalid_properties
  properties = []

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

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

  properties
end

#nameObject



40
41
42
# File 'lib/cryptopay/models/coin_destination_tag.rb', line 40

def name
  @attributes[:name]
end

#requiredObject



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

def required
  @attributes[:required]
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



64
65
66
# File 'lib/cryptopay/models/coin_destination_tag.rb', line 64

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



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

def valid?
  invalid_properties.empty?
end