⌚ OpenOpeningstijden main server application
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.

node.rb 1.9KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. # frozen_string_literal: true
  2. module Hours
  3. module Serializers
  4. ##
  5. # Represent a Node as JSON
  6. class Node < JSONAPI::Serializable::Resource
  7. type 'node'
  8. attributes :name, :lat, :lon, :status
  9. id { @object.node_id }
  10. attribute :raw_opening_hours do
  11. 'Mo-We 10:00-18:00; Th 10:00-21:00; Fr 10:00-18:00; Sa 09:30-17:30; '\
  12. 'PH closed; Su 12:00-17:00 open "Koopzondag"'
  13. end
  14. attribute :week_stable do
  15. false
  16. end
  17. attribute :open_this_week do
  18. [
  19. {
  20. from: '1989-11-06T09:00:00.000Z',
  21. to: '1989-11-06T17:00:00.000Z',
  22. unknown: false
  23. },
  24. {
  25. to: '1989-11-07T17:00:00.000Z',
  26. unknown: false,
  27. from: '1989-11-07T09:00:00.000Z'
  28. },
  29. {
  30. unknown: false,
  31. to: '1989-11-08T17:00:00.000Z',
  32. from: '1989-11-08T09:00:00.000Z'
  33. },
  34. {
  35. from: '1989-11-09T09:00:00.000Z',
  36. to: '1989-11-09T20:00:00.000Z',
  37. unknown: false
  38. },
  39. {
  40. to: '1989-11-10T17:00:00.000Z',
  41. unknown: false,
  42. from: '1989-11-10T09:00:00.000Z'
  43. },
  44. {
  45. to: '1989-11-11T16:30:00.000Z',
  46. unknown: false,
  47. from: '1989-11-11T08:30:00.000Z'
  48. },
  49. {
  50. comment: 'Koopzondag',
  51. to: '1989-11-12T16:00:00.000Z',
  52. unknown: false,
  53. from: '1989-11-12T11:00:00.000Z'
  54. }
  55. ]
  56. end
  57. attribute :address do
  58. {
  59. postcode: '6511RA',
  60. city: 'Nijmegen',
  61. housenumber: '1',
  62. street: 'Burchtstraat'
  63. }
  64. end
  65. link :self do
  66. # TODO: move into an URL-helper
  67. "/nodes/#{@object.node_id}"
  68. end
  69. meta do
  70. { copyright: 'OpenStreetMap-contributors' }
  71. end
  72. end
  73. end
  74. end