Method: AdvancedBilling::ListProformaInvoicesMeta.from_hash

Defined in:
lib/advanced_billing/models/list_proforma_invoices_meta.rb

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# File 'lib/advanced_billing/models/list_proforma_invoices_meta.rb', line 67

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  total_count = hash.key?('total_count') ? hash['total_count'] : SKIP
  current_page = hash.key?('current_page') ? hash['current_page'] : SKIP
  total_pages = hash.key?('total_pages') ? hash['total_pages'] : SKIP
  status_code = hash.key?('status_code') ? hash['status_code'] : SKIP

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

  # Create object from extracted values.
  ListProformaInvoicesMeta.new(total_count: total_count,
                               current_page: current_page,
                               total_pages: total_pages,
                               status_code: status_code,
                               additional_properties: hash)
end