This PR adds the option to snakify_keys we receive when calling MangoPay endpoints. This allows us to map objects params 1:1 in the db, without transform them to follow ruby's convention. For example:
This change requires activesupport, but adding this gem as dependency lead to bump the minimum ruby version to 2.2.2, idk if this can be a problem.
I've added a bunch of tests and everything seems to be working good. Let me know if further explanations or tests are required
This PR adds the option to snakify_keys we receive when calling MangoPay endpoints. This allows us to map objects params 1:1 in the db, without transform them to follow ruby's convention. For example:
default:
=> {"Id"=>"206880768", "UserId"=>"206880767", "CreationDate"=>1697803982, "ProcessedDate"=>nil, "Status"=>"VALIDATION_ASKED", "Reason"=>nil, "Message"=>nil, "Ubos"=>[{"Id"=>"206880769", "CreationDate"=>1697803982, "LastName"=>"Doe", "FirstName"=>"John", "Birthday"=>1300186358, "Nationality"=>"FR", "Address"=>{"AddressLine1"=>"6 Parvis Notre-Dame", "AddressLine2"=>"Pl. Jean-Paul II", "City"=>"Paris", "Region"=>"", "PostalCode"=>"75004", "Country"=>"FR"}, "Birthplace"=>{"City"=>"Paris", "Country"=>"FR"}, "IsActive"=>true}]}
snakify_keys = true:
=> {"id"=>"206880772", "user_id"=>"206880771", "creation_date"=>1697803989, "processed_date"=>nil, "status"=>"VALIDATION_ASKED", "reason"=>nil, "message"=>nil, "ubos"=>[{"id"=>"206880773", "creation_date"=>1697803990, "last_name"=>"Doe", "first_name"=>"John", "birthday"=>1300186358, "nationality"=>"FR", "address"=>{"address_line1"=>"6 Parvis Notre-Dame", "address_line2"=>"Pl. Jean-Paul II", "city"=>"Paris", "region"=>"", "postal_code"=>"75004", "country"=>"FR"}, "birthplace"=>{"city"=>"Paris", "country"=>"FR"}, "is_active"=>true}]}
This change requires
activesupport
, but adding this gem as dependency lead to bump the minimum ruby version to2.2.2
, idk if this can be a problem. I've added a bunch of tests and everything seems to be working good. Let me know if further explanations or tests are required