Class: Cryptopay::ChannelsConfig

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

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ ChannelsConfig

Initializes the object

Parameters:

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

    Model attributes in the form of hash



30
31
32
# File 'lib/cryptopay/models/channels_config.rb', line 30

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

Class Method Details

.build_from_hash(data) ⇒ Cryptopay::ChannelsConfig

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:



23
24
25
26
# File 'lib/cryptopay/models/channels_config.rb', line 23

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

Instance Method Details

#enabledObject



34
35
36
# File 'lib/cryptopay/models/channels_config.rb', line 34

def enabled
  @attributes[:enabled]
end

#inspectObject



60
61
62
# File 'lib/cryptopay/models/channels_config.rb', line 60

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



40
41
42
43
44
45
46
# File 'lib/cryptopay/models/channels_config.rb', line 40

def invalid_properties
  properties = []

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

  properties
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



56
57
58
# File 'lib/cryptopay/models/channels_config.rb', line 56

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



50
51
52
# File 'lib/cryptopay/models/channels_config.rb', line 50

def valid?
  invalid_properties.empty?
end