contentful 2.0.1 → 2.0.2

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: adb51bf63992e8954100bf135c6a03ae27470131
4
- data.tar.gz: daaad9d76c496da15b3118caccd6d0c6060cbcbe
3
+ metadata.gz: a960ca1aedbe17e69082ec7d178fead3cdd5f20b
4
+ data.tar.gz: 037c897ba9cd30398b8b69568170a15e26613aca
5
5
  SHA512:
6
- metadata.gz: 489539c127176b6169dd2da6dc5c0a054e64e02eec27885644b38ac036c26d8dcf43296125a450884fd41a91161806f729e602864de9eaaeb26b63da8627ebaf
7
- data.tar.gz: 131a32ea047617743fe160a713d4e4442464c3179949eb11845b10a012415bd380295521dbeb28a319dbd341e0db2e2dfe5eabd7fd1204c2dc098b30bea6a681
6
+ metadata.gz: fcd77594eb1ee64762267caaa90c17f87a3bd8cf266fe3366f3e18cc406174b7f800e78a730ef4606f4b1786dd6d0aa0b729f2199a13e37de11fb28cc4db1c02
7
+ data.tar.gz: ad74de5177e0c9880e78afe4a2ae2df55ff5ea537a45ac0a1dac58d9857aa8dd44d63bf5ec512130d8f5aee950b547a397df1ce20c98f7e29e9948c6067b77d0
data/.travis.yml CHANGED
@@ -1,5 +1,6 @@
1
1
  language: ruby
2
2
  rvm:
3
+ - 2.4.0
3
4
  - 2.3.1
4
5
  - 2.2.1
5
6
  - 2.1.2
data/CHANGELOG.md CHANGED
@@ -2,6 +2,11 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 2.0.2
6
+
7
+ ### Fixed
8
+ * Asset File Mapping now uses `#internal_resource_locale` to use `Resource#sys[:locale]` if available [jekyll-contentful-data-import #46](https://github.com/contentful/jekyll-contentful-data-import/issues/46)
9
+
5
10
  ## 2.0.1
6
11
 
7
12
  ### Fixed
@@ -76,7 +76,7 @@ module Contentful
76
76
  @fields[locale][:file] = ::Contentful::File.new(file_json[locale.to_s] || {})
77
77
  end
78
78
  else
79
- @fields[default_locale][:file] = ::Contentful::File.new(file_json)
79
+ @fields[internal_resource_locale][:file] = ::Contentful::File.new(file_json)
80
80
  end
81
81
  end
82
82
 
@@ -1,5 +1,5 @@
1
1
  # Contentful Namespace
2
2
  module Contentful
3
3
  # Gem Version
4
- VERSION = '2.0.1'
4
+ VERSION = '2.0.2'
5
5
  end
data/spec/asset_spec.rb CHANGED
@@ -141,5 +141,19 @@ describe Contentful::Asset do
141
141
  expect(asset.fields('es')[:file].file_name).to eq 'Flag_of_Spain.svg'
142
142
  }
143
143
  end
144
+
145
+ it 'properly serializes files for non-default locales on localized requests - jekyll-contentful-data-import #46' do
146
+ vcr('assets/issues_jekyll_46') {
147
+ client = create_client(
148
+ space: 'bht13amj0fva',
149
+ access_token: 'bb703a05e107148bed6ee246a9f6b3678c63fed7335632eb68fe1b689c801534',
150
+ )
151
+
152
+ asset = client.assets('sys.id' => '14bZJKTr6AoaGyeg4kYiWq', locale: 'es').first
153
+
154
+ expect(asset.file).to be_a ::Contentful::File
155
+ expect(asset.file.file_name).to eq 'Flag_of_Spain.svg'
156
+ }
157
+ end
144
158
  end
145
159
  end
@@ -0,0 +1,115 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://cdn.contentful.com/spaces/bht13amj0fva/assets?locale=es&sys.id=14bZJKTr6AoaGyeg4kYiWq
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - RubyContentfulGem/2.0.1
12
+ Authorization:
13
+ - Bearer bb703a05e107148bed6ee246a9f6b3678c63fed7335632eb68fe1b689c801534
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
+ response:
23
+ status:
24
+ code: 200
25
+ message: OK
26
+ headers:
27
+ Access-Control-Allow-Headers:
28
+ - 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
29
+ Access-Control-Allow-Methods:
30
+ - GET,HEAD,OPTIONS
31
+ Access-Control-Allow-Origin:
32
+ - "*"
33
+ Access-Control-Expose-Headers:
34
+ - Etag
35
+ Access-Control-Max-Age:
36
+ - '86400'
37
+ Cache-Control:
38
+ - max-age=0
39
+ Content-Type:
40
+ - application/vnd.contentful.delivery.v1+json
41
+ Etag:
42
+ - '"fd221ef596081681476844e76626d81e"'
43
+ Server:
44
+ - Contentful
45
+ X-Content-Type-Options:
46
+ - nosniff
47
+ X-Contentful-Request-Id:
48
+ - 94c2a00df9e2c852f0d971f0bf6447cd
49
+ Content-Length:
50
+ - '901'
51
+ Accept-Ranges:
52
+ - bytes
53
+ Date:
54
+ - Wed, 19 Apr 2017 13:30:46 GMT
55
+ Via:
56
+ - 1.1 varnish
57
+ Age:
58
+ - '0'
59
+ Connection:
60
+ - close
61
+ X-Served-By:
62
+ - cache-lax8647-LAX
63
+ X-Cache:
64
+ - MISS
65
+ X-Cache-Hits:
66
+ - '0'
67
+ X-Timer:
68
+ - S1492608646.119094,VS0,VE415
69
+ Vary:
70
+ - Accept-Encoding
71
+ body:
72
+ encoding: ASCII-8BIT
73
+ string: |
74
+ {
75
+ "sys": {
76
+ "type": "Array"
77
+ },
78
+ "total": 1,
79
+ "skip": 0,
80
+ "limit": 100,
81
+ "items": [
82
+ {
83
+ "sys": {
84
+ "space": {
85
+ "sys": {
86
+ "type": "Link",
87
+ "linkType": "Space",
88
+ "id": "bht13amj0fva"
89
+ }
90
+ },
91
+ "id": "14bZJKTr6AoaGyeg4kYiWq",
92
+ "type": "Asset",
93
+ "createdAt": "2016-10-05T14:31:36.082Z",
94
+ "updatedAt": "2016-10-05T14:31:36.082Z",
95
+ "revision": 1,
96
+ "locale": "es"
97
+ },
98
+ "fields": {
99
+ "title": "ES Title",
100
+ "description": "ES Description",
101
+ "file": {
102
+ "url": "//assets.contentful.com/bht13amj0fva/14bZJKTr6AoaGyeg4kYiWq/5501c98c296af77b9acba1146ea3e211/Flag_of_Spain.svg",
103
+ "details": {
104
+ "size": 60255
105
+ },
106
+ "fileName": "Flag_of_Spain.svg",
107
+ "contentType": "image/svg+xml"
108
+ }
109
+ }
110
+ }
111
+ ]
112
+ }
113
+ http_version:
114
+ recorded_at: Wed, 19 Apr 2017 13:30:46 GMT
115
+ recorded_with: VCR 3.0.3
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: contentful
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.1
4
+ version: 2.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Contentful GmbH (Jan Lelis)
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2017-04-06 00:00:00.000000000 Z
13
+ date: 2017-04-19 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: http
@@ -433,6 +433,7 @@ files:
433
433
  - spec/fixtures/vcr_cassettes/asset/select_one_field.yml
434
434
  - spec/fixtures/vcr_cassettes/asset/select_only_sys.yml
435
435
  - spec/fixtures/vcr_cassettes/assets/issues_129.yml
436
+ - spec/fixtures/vcr_cassettes/assets/issues_jekyll_46.yml
436
437
  - spec/fixtures/vcr_cassettes/bad_request.yml
437
438
  - spec/fixtures/vcr_cassettes/content_type.yml
438
439
  - spec/fixtures/vcr_cassettes/entries.yml
@@ -541,6 +542,7 @@ test_files:
541
542
  - spec/fixtures/vcr_cassettes/asset/select_one_field.yml
542
543
  - spec/fixtures/vcr_cassettes/asset/select_only_sys.yml
543
544
  - spec/fixtures/vcr_cassettes/assets/issues_129.yml
545
+ - spec/fixtures/vcr_cassettes/assets/issues_jekyll_46.yml
544
546
  - spec/fixtures/vcr_cassettes/bad_request.yml
545
547
  - spec/fixtures/vcr_cassettes/content_type.yml
546
548
  - spec/fixtures/vcr_cassettes/entries.yml