Method: AdvancedBilling::ListPublicKeysResponse.from_hash

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

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/advanced_billing/models/list_public_keys_response.rb', line 53

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.

  # Parameter is an array, so we need to iterate through it

  chargify_js_keys = nil
  unless hash['chargify_js_keys'].nil?
    chargify_js_keys = []
    hash['chargify_js_keys'].each do |structure|
      chargify_js_keys << (PublicKey.from_hash(structure) if structure)
    end
  end

  chargify_js_keys = SKIP unless hash.key?('chargify_js_keys')
  meta = ListPublicKeysMeta.from_hash(hash['meta']) if hash['meta']

  # Clean out expected properties from Hash.

  names.each_value { |k| hash.delete(k) }

  # Create object from extracted values.

  ListPublicKeysResponse.new(chargify_js_keys: chargify_js_keys,
                             meta: meta,
                             additional_properties: hash)
end