contentful_middleman 2.1.2 → 2.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
  SHA1:
3
- metadata.gz: ee66e9f9a3bd4d95df237d74d9e4e112e2bf3ea3
4
- data.tar.gz: 59ce9a704e69c4b5b0c96f82dd5b4e6debe15a92
3
+ metadata.gz: a4e1ca29530fe1fccd43b993eaa8851f74d806aa
4
+ data.tar.gz: 7b0e5e24f95b21aec66d8c30599483f9eb75e6bc
5
5
  SHA512:
6
- metadata.gz: ac290f4886ea33f87d16b720f9e8ced955524b883a2c7351a4684effb3bae691d015a8d95431ee04e37065d211a26e88fe2333d1c359ef2dbbef20fd83336dcc
7
- data.tar.gz: df49b31585e907db09bff424e86c51a3608ce40a97fc4aa9a8e295682e20a277cbcf6ffab7fe731c592bf4e70d67b7b253f769f7ab5f14404f18be5266caa88e
6
+ metadata.gz: d9285bf41c9aafbfdde8b803d89df58fab1a5b03d916a705d4ceee176398be1d123cb3013e1540ce6cb1718d81fb7c872950725deecc3c1655da0c7daeb02e29
7
+ data.tar.gz: dd322ff7267683d0b2b9ed502a6cb075e172dd75d0036ec0989dd9cc89df221e39ba40e10a68456e43735c6c704ab83a73d5dd11d729abcf9b8f704d59cf97a3
data/CHANGELOG.md CHANGED
@@ -1,6 +1,10 @@
1
1
  # Change Log
2
2
  ## Unreleased
3
3
 
4
+ ## 2.1.3
5
+ ### Fixed
6
+ * `#map_location` properly maps locations
7
+
4
8
  ## 2.1.2
5
9
  ### Fixed
6
10
  * `localize` helpers now properly serialized nested resources [#131](https://github.com/contentful/contentful_middleman/pull/131)
@@ -116,11 +116,15 @@ module ContentfulMiddleman
116
116
  end
117
117
 
118
118
  def map_location(location)
119
- location.properties
119
+ context = Context.new
120
+ context.lat = location.lat
121
+ context.lon = location.lon
122
+
123
+ context
120
124
  end
121
125
 
122
126
  def map_link(link)
123
- context = Context.new
127
+ context = Context.new
124
128
  context.id = link.id
125
129
 
126
130
  context
@@ -1,3 +1,3 @@
1
1
  module ContentfulMiddleman
2
- VERSION = "2.1.2"
2
+ VERSION = "2.1.3"
3
3
  end
@@ -211,6 +211,39 @@ describe ContentfulMiddleman::Mapper::Base do
211
211
  expect(context.hashize).to eq(expected)
212
212
  }
213
213
  end
214
+
215
+ it 'properly maps locations' do
216
+ vcr('entries/locations') {
217
+ client = Contentful::Client.new(
218
+ space: 'v0h47qlgo3zl',
219
+ access_token: '1cf2a0b198872451f2cfba5ff45342327bf11259382232ec2962012625d8b29d',
220
+ dynamic_entries: :auto
221
+ )
222
+
223
+ entry = client.entries('sys.id' => '4ik8UErhRmIwomiQs8EUkI', content_type: 'destination', select: ['fields.name', 'fields.coordinates']).first
224
+
225
+ context = ContentfulMiddleman::Context.new
226
+
227
+ subject.map(context, entry)
228
+
229
+ expected = {
230
+ _meta: {
231
+ content_type_id: 'destination',
232
+ updated_at: '2017-08-21T20:52:53+00:00',
233
+ created_at: '2017-08-21T20:52:18+00:00',
234
+ id: '4ik8UErhRmIwomiQs8EUkI'
235
+ },
236
+ id: '4ik8UErhRmIwomiQs8EUkI',
237
+ name: 'Jamaica',
238
+ coordinates: {
239
+ lat: 18.109581,
240
+ lon: -77.297508
241
+ }
242
+ }
243
+
244
+ expect(context.hashize).to eq(expected)
245
+ }
246
+ end
214
247
  end
215
248
  end
216
249
 
@@ -0,0 +1,197 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://cdn.contentful.com/spaces/v0h47qlgo3zl/content_types?limit=1000
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ X-Contentful-User-Agent:
11
+ - sdk contentful.rb/2.1.2; platform ruby/2.4.1; os macOS/16;
12
+ Authorization:
13
+ - Bearer 1cf2a0b198872451f2cfba5ff45342327bf11259382232ec2962012625d8b29d
14
+ Content-Type:
15
+ - application/vnd.contentful.delivery.v1+json
16
+ Accept-Encoding:
17
+ - gzip
18
+ Connection:
19
+ - close
20
+ Host:
21
+ - cdn.contentful.com
22
+ User-Agent:
23
+ - http.rb/2.2.2
24
+ response:
25
+ status:
26
+ code: 200
27
+ message: OK
28
+ headers:
29
+ Access-Control-Allow-Headers:
30
+ - Accept,Accept-Language,Authorization,Cache-Control,Content-Length,Content-Range,Content-Type,DNT,Destination,Expires,If-Match,If-Modified-Since,If-None-Match,Keep-Alive,Last-Modified,Origin,Pragma,Range,User-Agent,X-Http-Method-Override,X-Mx-ReqToken,X-Requested-With,X-Contentful-Version,X-Contentful-Content-Type,X-Contentful-Organization,X-Contentful-Skip-Transformation,X-Contentful-User-Agent,X-Contentful-Enable-Experimental-Feature
31
+ Access-Control-Allow-Methods:
32
+ - GET,HEAD,OPTIONS
33
+ Access-Control-Allow-Origin:
34
+ - "*"
35
+ Access-Control-Expose-Headers:
36
+ - Etag
37
+ Access-Control-Max-Age:
38
+ - '86400'
39
+ Cache-Control:
40
+ - max-age=0
41
+ Content-Encoding:
42
+ - gzip
43
+ Content-Type:
44
+ - application/vnd.contentful.delivery.v1+json
45
+ Etag:
46
+ - W/"e197dc22822d338bf0d2ce6c09709bde"
47
+ Server:
48
+ - Contentful
49
+ X-Content-Type-Options:
50
+ - nosniff
51
+ X-Contentful-Request-Id:
52
+ - 664601ad45bd5b26f176e079a76dc5c5
53
+ Content-Length:
54
+ - '1320'
55
+ Accept-Ranges:
56
+ - bytes
57
+ Date:
58
+ - Mon, 21 Aug 2017 21:10:22 GMT
59
+ Via:
60
+ - 1.1 varnish
61
+ Age:
62
+ - '647'
63
+ Connection:
64
+ - close
65
+ X-Served-By:
66
+ - cache-gru17121-GRU
67
+ X-Cache:
68
+ - HIT
69
+ X-Cache-Hits:
70
+ - '1'
71
+ X-Timer:
72
+ - S1503349822.441890,VS0,VE0
73
+ Vary:
74
+ - Accept-Encoding
75
+ body:
76
+ encoding: ASCII-8BIT
77
+ string: !binary |-
78
+ H4sIAAAAAAA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YUaWnYJLRyS3rRsp3VoYXrO2a7QYvTIyOJcgZqPAYYywDgikteOSBZJkgUkxmxKor1t6lAGW5Dkr0eoT5RJbglH8vWcswoN3m26np8293pZnk5VWftbWXPelexDmIWT9ALdoaZ0eJJqCjITb7f8ZTco01aZa9CyDB1qlH0CnQeGoEhW9hNUb9H3nnKzY89yjZEz/gMAZY6NkSsmc7mC8vBBAIVDHCkqyiQ3q0m8SQhKL5luWVMWlyI1rrL8OhN2QUn7pLdVmK2oP4Fn2cEZuBQFtRfmnsTUEGVC31HwpiEJW+gICjS5Qy8sdkpItjSmRwT82hFwZcelon9lnypzKHcpQbD8kql9Fb2TlreusxyY861VhjpmLiARYdvtHO/Ag9df1sgYO2Kqo4eXXFJN65i0UCYtDjLpevRDr8APHZgR3ups+RiuckaPtsYDzxx5A8uwh8O21pgMcI0zd9D0ROXhFyoNYRAU4cijYO2ScXhVBT3iG9veoyHtVPuC5pOUhGHXKINnEOI76JcTIOFapbJ8mFijMDTVobrZCU1VMcNh3lT5YWuXa0oetBtO25dkcK+VAzjQZD02W1FeU8re091RsfD7YiJeRE4JKrnqujU9Q61G3p+buTMbQ3n7nDWkfgvePn+62F/JiXYHWlcn9ye/AaMusbDWMwAA
79
+ http_version:
80
+ recorded_at: Mon, 21 Aug 2017 21:10:22 GMT
81
+ - request:
82
+ method: get
83
+ uri: https://cdn.contentful.com/spaces/v0h47qlgo3zl/entries?content_type=destination&select=fields.name,fields.coordinates,sys&sys.id=4ik8UErhRmIwomiQs8EUkI
84
+ body:
85
+ encoding: US-ASCII
86
+ string: ''
87
+ headers:
88
+ X-Contentful-User-Agent:
89
+ - sdk contentful.rb/2.1.2; platform ruby/2.4.1; os macOS/16;
90
+ Authorization:
91
+ - Bearer 1cf2a0b198872451f2cfba5ff45342327bf11259382232ec2962012625d8b29d
92
+ Content-Type:
93
+ - application/vnd.contentful.delivery.v1+json
94
+ Accept-Encoding:
95
+ - gzip
96
+ Connection:
97
+ - close
98
+ Host:
99
+ - cdn.contentful.com
100
+ User-Agent:
101
+ - http.rb/2.2.2
102
+ response:
103
+ status:
104
+ code: 200
105
+ message: OK
106
+ headers:
107
+ Access-Control-Allow-Headers:
108
+ - Accept,Accept-Language,Authorization,Cache-Control,Content-Length,Content-Range,Content-Type,DNT,Destination,Expires,If-Match,If-Modified-Since,If-None-Match,Keep-Alive,Last-Modified,Origin,Pragma,Range,User-Agent,X-Http-Method-Override,X-Mx-ReqToken,X-Requested-With,X-Contentful-Version,X-Contentful-Content-Type,X-Contentful-Organization,X-Contentful-Skip-Transformation,X-Contentful-User-Agent,X-Contentful-Enable-Experimental-Feature
109
+ Access-Control-Allow-Methods:
110
+ - GET,HEAD,OPTIONS
111
+ Access-Control-Allow-Origin:
112
+ - "*"
113
+ Access-Control-Expose-Headers:
114
+ - Etag
115
+ Access-Control-Max-Age:
116
+ - '86400'
117
+ Cache-Control:
118
+ - max-age=0
119
+ Content-Type:
120
+ - application/vnd.contentful.delivery.v1+json
121
+ Etag:
122
+ - '"eae576de5f982e6c6c53edeb0901ff0d"'
123
+ Server:
124
+ - Contentful
125
+ X-Content-Type-Options:
126
+ - nosniff
127
+ X-Contentful-Request-Id:
128
+ - 56bd6c18854e6642c860d7b9eaf76d34
129
+ Content-Length:
130
+ - '813'
131
+ Accept-Ranges:
132
+ - bytes
133
+ Date:
134
+ - Mon, 21 Aug 2017 21:10:23 GMT
135
+ Via:
136
+ - 1.1 varnish
137
+ Age:
138
+ - '0'
139
+ Connection:
140
+ - close
141
+ X-Served-By:
142
+ - cache-gru17122-GRU
143
+ X-Cache:
144
+ - MISS
145
+ X-Cache-Hits:
146
+ - '0'
147
+ X-Timer:
148
+ - S1503349823.030537,VS0,VE151
149
+ Vary:
150
+ - Accept-Encoding
151
+ body:
152
+ encoding: ASCII-8BIT
153
+ string: |
154
+ {
155
+ "sys": {
156
+ "type": "Array"
157
+ },
158
+ "total": 1,
159
+ "skip": 0,
160
+ "limit": 100,
161
+ "items": [
162
+ {
163
+ "fields": {
164
+ "name": "Jamaica",
165
+ "coordinates": {
166
+ "lon": -77.297508,
167
+ "lat": 18.109581
168
+ }
169
+ },
170
+ "sys": {
171
+ "space": {
172
+ "sys": {
173
+ "type": "Link",
174
+ "linkType": "Space",
175
+ "id": "v0h47qlgo3zl"
176
+ }
177
+ },
178
+ "id": "4ik8UErhRmIwomiQs8EUkI",
179
+ "type": "Entry",
180
+ "createdAt": "2017-08-21T20:52:18.320Z",
181
+ "updatedAt": "2017-08-21T20:52:53.500Z",
182
+ "revision": 2,
183
+ "contentType": {
184
+ "sys": {
185
+ "type": "Link",
186
+ "linkType": "ContentType",
187
+ "id": "destination"
188
+ }
189
+ },
190
+ "locale": "en-US"
191
+ }
192
+ }
193
+ ]
194
+ }
195
+ http_version:
196
+ recorded_at: Mon, 21 Aug 2017 21:10:23 GMT
197
+ recorded_with: VCR 3.0.3
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: contentful_middleman
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.2
4
+ version: 2.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sascha Konietzke
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-08-17 00:00:00.000000000 Z
12
+ date: 2017-08-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: middleman-core
@@ -258,6 +258,7 @@ files:
258
258
  - spec/fixtures/vcr_fixtures/client.yml
259
259
  - spec/fixtures/vcr_fixtures/entries/localized_references.yml
260
260
  - spec/fixtures/vcr_fixtures/entries/localized_references_localized_assets.yml
261
+ - spec/fixtures/vcr_fixtures/entries/locations.yml
261
262
  - spec/fixtures/vcr_fixtures/entries/nil_file.yml
262
263
  - spec/fixtures/vcr_fixtures/entries/repeated_entry.yml
263
264
  - spec/fixtures/vcr_fixtures/helpers/preview.yml
@@ -324,6 +325,7 @@ test_files:
324
325
  - spec/fixtures/vcr_fixtures/client.yml
325
326
  - spec/fixtures/vcr_fixtures/entries/localized_references.yml
326
327
  - spec/fixtures/vcr_fixtures/entries/localized_references_localized_assets.yml
328
+ - spec/fixtures/vcr_fixtures/entries/locations.yml
327
329
  - spec/fixtures/vcr_fixtures/entries/nil_file.yml
328
330
  - spec/fixtures/vcr_fixtures/entries/repeated_entry.yml
329
331
  - spec/fixtures/vcr_fixtures/helpers/preview.yml