Class: Cryptopay::SubscriptionListResult

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

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ SubscriptionListResult

Initializes the object



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

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

Class Method Details

.build_from_hash(data) ⇒ Cryptopay::SubscriptionListResult

Builds the object from hash



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

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

Instance Method Details

#dataObject



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

def data
  @attributes[:data]
end

#inspectObject



78
79
80
# File 'lib/cryptopay/models/subscription_list_result.rb', line 78

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?



46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/cryptopay/models/subscription_list_result.rb', line 46

def invalid_properties
  properties = []

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

  data&.each_with_index do |item, index|
    item.invalid_properties.each do |prop|
      properties.push("invalid value for \"data.#{index}\": #{prop}")
    end
  end

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

  meta&.invalid_properties&.each do |prop|
    properties.push("invalid value for \"meta\": #{prop}")
  end

  properties
end

#metaObject



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

def meta
  @attributes[:meta]
end

#to_hashHash

Returns the object in the form of hash



74
75
76
# File 'lib/cryptopay/models/subscription_list_result.rb', line 74

def to_hash
  ENCODER.to_hash(@attributes)
end

#valid?Boolean

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



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

def valid?
  invalid_properties.empty?
end