Method: AdvancedBilling::ListComponentsFilter.from_hash

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

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/advanced_billing/models/list_components_filter.rb', line 56

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  ids = hash.key?('ids') ? hash['ids'] : SKIP
  use_site_exchange_rate =
    hash.key?('use_site_exchange_rate') ? hash['use_site_exchange_rate'] : SKIP

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

  # Create object from extracted values.
  ListComponentsFilter.new(ids: ids,
                           use_site_exchange_rate: use_site_exchange_rate,
                           additional_properties: hash)
end