Implementation of a generic backend of eshop in Crystal
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
419 B

6 years ago
6 years ago
6 years ago
  1. require "json"
  2. enum Country
  3. FR,
  4. NL,
  5. DE,
  6. IT,
  7. EI,
  8. GB,
  9. end
  10. class Address
  11. JSON.mapping(
  12. name: String,
  13. address1: String,
  14. address2: {type: String, nilable: true},
  15. postcode: String,
  16. city: String,
  17. country: Country,
  18. is_default: {type: Bool, default: false},
  19. )
  20. def <=> (other : Address)
  21. self.to_json<=>other.to_json
  22. end
  23. end