Implementation of a generic backend of eshop in Crystal
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

24 linhas
419 B

6 anos atrás
6 anos atrás
6 anos atrás
  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