jekyll-hoffnung3000 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 03bcf1d94588d0d0458bec00ffd80b3254f2c1e0733684de4467ee8cb5d7e0b9
4
- data.tar.gz: 141c75475dd4513bd770feb7de114cd463bfd094a7ee263592b1d3786d67fc14
3
+ metadata.gz: 3c5a4f59df3c87b08e68a6dfb503901c8ba059546a7002caa386ef75409b5c74
4
+ data.tar.gz: 9b1756b27919c814b03b6765b09352949c70006b945c09c23b63d2ead8dea52b
5
5
  SHA512:
6
- metadata.gz: 790003e1337977499dc70bd343a145fbd1a1832e9931343649fbe6c66797789c2936758a86213969e2c290654b323a4956ea48e57eb5507568b1e6b7ef5a2198
7
- data.tar.gz: 940d1062ffe6c568f99771d40fe3ea96f437a9f7e997039f40816938c9171016bb84ee27a58cf907761aeb07a9eade8b272c154d5c7c9429cf9edcdcd3f99757
6
+ metadata.gz: 62b94a67b662ccc94fda0b786a60dfd8402e5bbf8e01667ec15372faa366294e866ec1aa099525a0d33b6f9a484a54f0e554fde2f4a7ee26f1ed531bf4a36771
7
+ data.tar.gz: 2acfc4d543a46fa75e3f5c80b2b53cc32d1835042b9bf132b18c210196641b5cbd202d07e74ee104b6d53e8fcba8ef48178687df924d3fa71826e34bfb1d5bd7
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- jekyll-hoffnung3000 (0.1.2)
4
+ jekyll-hoffnung3000 (0.1.3)
5
5
  http (~> 4.4.1)
6
6
  json (~> 2.5.1)
7
7
  ruby-jq (~> 0.2.1)
data/README.md CHANGED
@@ -40,7 +40,7 @@ With this config set you can use the command line to fetch event data which will
40
40
  $ bundle exec jekyll hoffnung3000 events
41
41
  ```
42
42
 
43
- Events are formatted into the following way as array of JSON objects:
43
+ Events are formatted in the following way as array of JSON objects:
44
44
 
45
45
  ```json
46
46
  [
@@ -54,10 +54,9 @@ Events are formatted into the following way as array of JSON objects:
54
54
  },
55
55
  "organiser": {
56
56
  "name": "Name of Organiser",
57
- "about": null
58
57
  },
59
58
  "venue": {
60
- "id": null,
59
+ "id": 1,
61
60
  "name": "museum of neoliberalism [online location]",
62
61
  "description": "A small, free museum about how an obscure and extreme ideological cult of the 1970s rose to power and now shapes our lives in dramatic and often terrible ways......",
63
62
  "area": "London"
@@ -76,6 +75,23 @@ Events are formatted into the following way as array of JSON objects:
76
75
  ]
77
76
  ```
78
77
 
78
+ Places are formatted in the following way as array of JSON objects:
79
+
80
+ ```json
81
+ [
82
+ {
83
+ "id": 1,
84
+ "title": "Place name",
85
+ "description": "Description of this place",
86
+ "street": "1 Street",
87
+ "cityCode": "XXX123",
88
+ "city": "City",
89
+ "country": "Country",
90
+ "imageUrl": "https://image-url/medium.jpg"
91
+ }
92
+ ]
93
+ ```
94
+
79
95
  ## Development
80
96
 
81
97
  After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
Binary file
@@ -2,7 +2,7 @@ require "http"
2
2
  require "jq"
3
3
  require "json"
4
4
 
5
- FORMAT_STRING =
5
+ FORMAT_STRING_EVENTS =
6
6
  ".data[] |
7
7
  {
8
8
  title: .title,
@@ -16,11 +16,10 @@ FORMAT_STRING =
16
16
  organiser:
17
17
  {
18
18
  name: .animal.userName,
19
- about: .organiser_biog
20
19
  },
21
- venue:
20
+ place:
22
21
  {
23
- id: null,
22
+ id: .place.id,
24
23
  name: .place.title,
25
24
  description: .place.description,
26
25
  area: .place.city
@@ -31,6 +30,20 @@ FORMAT_STRING =
31
30
  }
32
31
  ".freeze
33
32
 
33
+ FORMAT_STRING_PLACES =
34
+ ".data[] |
35
+ {
36
+ id: .id,
37
+ title: .title,
38
+ description: .description,
39
+ street: .street,
40
+ cityCode: .cityCode,
41
+ city: .city,
42
+ country: .country,
43
+ imageUrl:.images[0].mediumImageUrl
44
+ }
45
+ ".freeze
46
+
34
47
  def write_data(data, file_name)
35
48
  Dir.mkdir("_data") unless Dir.exist?("_data")
36
49
  File.write(format("_data/%s.json", file_name), JSON.generate(data))
@@ -60,7 +73,16 @@ module Jekyll
60
73
  config = check_config(Jekyll.configuration({}))
61
74
  response = HTTP.get(format("%s/api/events", config["hoffnung3000"]["url"]))
62
75
  jq = JQ(response.body, parse_json: true)
63
- write_data(jq.search(FORMAT_STRING), "events")
76
+ write_data(jq.search(FORMAT_STRING_EVENTS), "events")
77
+ end
78
+ end
79
+ c.command(:places) do |f|
80
+ f.description "Fetch all places and write to _data folder as places.json."
81
+ f.action do |_args, _options|
82
+ config = check_config(Jekyll.configuration({}))
83
+ response = HTTP.get(format("%s/api/places", config["hoffnung3000"]["url"]))
84
+ jq = JQ(response.body, parse_json: true)
85
+ write_data(jq.search(FORMAT_STRING_PLACES), "places")
64
86
  end
65
87
  end
66
88
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Jekyll
4
4
  module Hoffnung3000
5
- VERSION = "0.1.2"
5
+ VERSION = "0.1.3"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-hoffnung3000
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - sandreae
@@ -69,8 +69,7 @@ files:
69
69
  - Rakefile
70
70
  - bin/console
71
71
  - bin/setup
72
- - jekyll-hoffnung3000-0.1.0.gem
73
- - jekyll-hoffnung3000-0.1.1.gem
72
+ - jekyll-hoffnung3000-0.1.2.gem
74
73
  - jekyll-hoffnung3000.gemspec
75
74
  - lib/jekyll/commands/hoffnung3000.rb
76
75
  - lib/jekyll/hoffnung3000.rb
Binary file
Binary file