Class: Cryptopay::ChannelUpdateParams

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

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ ChannelUpdateParams

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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

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

Class Method Details

.build_from_hash(data) ⇒ Cryptopay::ChannelUpdateParams

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:



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

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

Instance Method Details

#customer_idObject

The internal ID of your customer that the channel relates to



55
56
57
# File 'lib/cryptopay/models/channel_update_params.rb', line 55

def customer_id
  @attributes[:customer_id]
end

#descriptionObject

Channel description



46
47
48
# File 'lib/cryptopay/models/channel_update_params.rb', line 46

def description
  @attributes[:description]
end

#inspectObject



83
84
85
# File 'lib/cryptopay/models/channel_update_params.rb', line 83

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



61
62
63
64
65
66
67
68
69
# File 'lib/cryptopay/models/channel_update_params.rb', line 61

def invalid_properties
  properties = []

  if !status.nil? && !%w[enabled disabled].include?(status)
    properties.push('invalid value for status, must be one of "enabled", "disabled"')
  end

  properties
end

#nameObject

Channel name



41
42
43
# File 'lib/cryptopay/models/channel_update_params.rb', line 41

def name
  @attributes[:name]
end

#statusObject



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

def status
  @attributes[:status]
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



79
80
81
# File 'lib/cryptopay/models/channel_update_params.rb', line 79

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



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

def valid?
  invalid_properties.empty?
end