Class: AdvancedBilling::PaymentMethodExternal

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/advanced_billing/models/payment_method_external.rb

Overview

PaymentMethodExternal Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(details:, kind:, memo:, type:, additional_properties: {}) ⇒ PaymentMethodExternal

Returns a new instance of PaymentMethodExternal.



51
52
53
54
55
56
57
58
59
60
61
# File 'lib/advanced_billing/models/payment_method_external.rb', line 51

def initialize(details:, kind:, memo:, type:, additional_properties: {})
  @details = details
  @kind = kind
  @memo = memo
  @type = type

  # Add additional model properties to the instance.
  additional_properties.each do |_name, _value|
    instance_variable_set("@#{_name}", _value)
  end
end

Instance Attribute Details

#detailsString

TODO: Write general description for this method

Returns:

  • (String)


14
15
16
# File 'lib/advanced_billing/models/payment_method_external.rb', line 14

def details
  @details
end

#kindString

TODO: Write general description for this method

Returns:

  • (String)


18
19
20
# File 'lib/advanced_billing/models/payment_method_external.rb', line 18

def kind
  @kind
end

#memoString

TODO: Write general description for this method

Returns:

  • (String)


22
23
24
# File 'lib/advanced_billing/models/payment_method_external.rb', line 22

def memo
  @memo
end

#typeInvoiceEventPaymentMethod

TODO: Write general description for this method



26
27
28
# File 'lib/advanced_billing/models/payment_method_external.rb', line 26

def type
  @type
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/advanced_billing/models/payment_method_external.rb', line 64

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  details = hash.key?('details') ? hash['details'] : nil
  kind = hash.key?('kind') ? hash['kind'] : nil
  memo = hash.key?('memo') ? hash['memo'] : nil
  type = hash.key?('type') ? hash['type'] : nil

  # Clean out expected properties from Hash.
  names.each_value { |k| hash.delete(k) }

  # Create object from extracted values.
  PaymentMethodExternal.new(details: details,
                            kind: kind,
                            memo: memo,
                            type: type,
                            additional_properties: hash)
end

.namesObject

A mapping from model property names to API property names.



29
30
31
32
33
34
35
36
# File 'lib/advanced_billing/models/payment_method_external.rb', line 29

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['details'] = 'details'
  @_hash['kind'] = 'kind'
  @_hash['memo'] = 'memo'
  @_hash['type'] = 'type'
  @_hash
end

.nullablesObject

An array for nullable fields



44
45
46
47
48
49
# File 'lib/advanced_billing/models/payment_method_external.rb', line 44

def self.nullables
  %w[
    details
    memo
  ]
end

.optionalsObject

An array for optional fields



39
40
41
# File 'lib/advanced_billing/models/payment_method_external.rb', line 39

def self.optionals
  []
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:



86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# File 'lib/advanced_billing/models/payment_method_external.rb', line 86

def self.validate(value)
  if value.instance_of? self
    return (
      APIHelper.valid_type?(value.details,
                            ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.kind,
                              ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.memo,
                              ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.type,
                              ->(val) { InvoiceEventPaymentMethod.validate(val) })
    )
  end

  return false unless value.instance_of? Hash

  (
    APIHelper.valid_type?(value['details'],
                          ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['kind'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['memo'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['type'],
                            ->(val) { InvoiceEventPaymentMethod.validate(val) })
  )
end