Method: ShellCardManagementApIs::PayerAccess.from_hash

Defined in:
lib/shell_card_management_ap_is/models/payer_access.rb

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
# File 'lib/shell_card_management_ap_is/models/payer_access.rb', line 115

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.

  is_default = hash['IsDefault'] ||= false
  colco_id = hash.key?('ColcoId') ? hash['ColcoId'] : SKIP
  colco_code = hash.key?('ColcoCode') ? hash['ColcoCode'] : SKIP
  col_co_country_code =
    hash.key?('ColCoCountryCode') ? hash['ColCoCountryCode'] : SKIP
  payer_group_id = hash.key?('PayerGroupId') ? hash['PayerGroupId'] : SKIP
  payer_group = hash.key?('PayerGroup') ? hash['PayerGroup'] : SKIP
  payer_id = hash.key?('PayerId') ? hash['PayerId'] : SKIP
  payer_number = hash.key?('PayerNumber') ? hash['PayerNumber'] : SKIP
  payer_name = hash.key?('PayerName') ? hash['PayerName'] : SKIP

  # Create object from extracted values.

  PayerAccess.new(is_default,
                  colco_id,
                  colco_code,
                  col_co_country_code,
                  payer_group_id,
                  payer_group,
                  payer_id,
                  payer_number,
                  payer_name)
end