Method: AdvancedBilling::BackportInvoiceEvent.validate
- Defined in:
- lib/advanced_billing/models/backport_invoice_event.rb
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 |
# File 'lib/advanced_billing/models/backport_invoice_event.rb', line 100 def self.validate(value) if value.instance_of? self return ( APIHelper.valid_type?(value.id, ->(val) { val.instance_of? Integer }) and APIHelper.valid_type?(value., ->(val) { val.instance_of? DateTime }) and APIHelper.valid_type?(value.invoice, ->(val) { Invoice.validate(val) }, is_model_hash: true) and APIHelper.valid_type?(value.event_type, ->(val) { InvoiceEventType.validate(val) }) and APIHelper.valid_type?(value.event_data, ->(val) { Invoice.validate(val) }, is_model_hash: true) ) end return false unless value.instance_of? Hash ( APIHelper.valid_type?(value['id'], ->(val) { val.instance_of? Integer }) and APIHelper.valid_type?(value['timestamp'], ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value['invoice'], ->(val) { Invoice.validate(val) }, is_model_hash: true) and APIHelper.valid_type?(value['event_type'], ->(val) { InvoiceEventType.validate(val) }) and APIHelper.valid_type?(value['event_data'], ->(val) { Invoice.validate(val) }, is_model_hash: true) ) end |