contentful_middleman 1.3.2 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: afab6f9f2082efc2316157faf338a513c2e6e6eb
4
- data.tar.gz: 40656a4aec70d29441724ade7b93ef12b48b7f79
3
+ metadata.gz: 68a030c2034591f7185811846ef7291c2d4737f5
4
+ data.tar.gz: f7a6f9ac89751ed18e9eceea27685a2afc96afa2
5
5
  SHA512:
6
- metadata.gz: 8cf2b26d03c3f463dce1bcb6ea57c5b8e0e76424752bfd00d0afdad350fc1ba9fadb70acfab4cf1d1eecad4ee6ea8e2473076eade4216431a3638a3a7b68c577
7
- data.tar.gz: 60c4bc8fe795b67fdd33188c9de8349aa09ece3f8168a0fecea667283fb122bf368789e66812db330cc0c07eff5c57176fb9f0dd2b789d8b994009e8869984f7
6
+ metadata.gz: 3bc49305a332c10297de0d15b0b55ef5c9ef398c7f1ecb94fcc9772656dbe004b8063e6186d652a26272d370ed47bfc16b8648342386b1001c4b31f01363362d
7
+ data.tar.gz: 988f0484835b53d7373df49c55e69301f3f7aea24908e875a7117cdcf9fb78a7cf7345bbb8b037eb0c989885e9351cdb5660caa29bcfd72c6b6a09d9922052c7
data/CHANGELOG.md CHANGED
@@ -1,6 +1,15 @@
1
1
  # Change Log
2
2
  ## Unreleased
3
3
 
4
+ ## 1.4.0
5
+
6
+ ### Added
7
+ * Add asset's `:description` to asset mapping[#82](https://github.com/contentful/contentful_middleman/pull/82)
8
+ * Add Page Size customization option when using `:all_entries`[#90](https://github.com/contentful/contentful_middleman/issues/90)
9
+
10
+ ### Fixed
11
+ * Fixed error when asset's `:file` field is `nil`[#85](https://github.com/contentful/contentful_middleman/issues/85)
12
+
4
13
  ## 1.3.2
5
14
  ### Fixed
6
15
  * Fixed Entry ID fetch on import task when having an ID field in the Content Type[#77](https://github.com/contentful/contentful_middleman/issues/77)
data/README.md CHANGED
@@ -49,17 +49,18 @@ activate :contentful do |f|
49
49
  end
50
50
  ```
51
51
 
52
- Parameter | Description
53
- ---------- | ------------
54
- space | Hash with an user choosen name for the space as key and the space id as value
55
- access_token | Contentful Delivery API access token
56
- cda_query | Hash describing query configuration. See [contentful.rb](https://github.com/contentful/contentful.rb) for more info (look for filter options there). Note that by default only 100 entries will be fetched, this can be configured to up to 1000 entries using the `limit` option. Example: `f.cda_query = { limit: 1000 }`
57
- content_types | Hash describing the mapping applied to entries of the imported content types
58
- use_preview_api | Boolean to toggle the used API. Set it to `false` to use `cdn.contentful.com` (default value). Set it to `true` to use `preview.contentful.com`. More info in [the documentation](https://www.contentful.com/developers/documentation/content-delivery-api/#preview-api)
59
- all_entries | Boolean to toggle multiple requests to the API for getting over 1000 entries. This uses a naive approach and can get rate limited. When using this, have in mind adding an `order` in your `:cda_query` . Default order is `order: 'sys.createdAt'`
60
- rebuild_on_webhook | Boolean to toggle Webhook server. Server will run in port 5678, and will be expecting to receive Contentful Webhook calls on `/receive`
61
- webhook_timeout | Integer (in seconds) for wait time after Webhook received for rebuilding. Only used if `:rebuild_on_webhook` is true. Defaults to 300 seconds
62
- webhook_controller | Class for handling Webhook response, defaults to `::ContentfulMiddleman::WebhookHandler`
52
+ Parameter | Description
53
+ ---------- | ------------
54
+ space | Hash with an user choosen name for the space as key and the space id as value
55
+ access_token | Contentful Delivery API access token
56
+ cda_query | Hash describing query configuration. See [contentful.rb](https://github.com/contentful/contentful.rb) for more info (look for filter options there). Note that by default only 100 entries will be fetched, this can be configured to up to 1000 entries using the `limit` option. Example: `f.cda_query = { limit: 1000 }`
57
+ content_types | Hash describing the mapping applied to entries of the imported content types
58
+ use_preview_api | Boolean to toggle the used API. Set it to `false` to use `cdn.contentful.com` (default value). Set it to `true` to use `preview.contentful.com`. More info in [the documentation](https://www.contentful.com/developers/documentation/content-delivery-api/#preview-api)
59
+ all_entries | Boolean to toggle multiple requests to the API for getting over 1000 entries. This uses a naive approach and can get rate limited. When using this, have in mind adding an `order` in your `:cda_query` . Default order is `order: 'sys.createdAt'`
60
+ all_entries_page_size | Integer amount of items per page for `:all_entries` requests, allowing for smaller page sizes on content heavy requests.
61
+ rebuild_on_webhook | Boolean to toggle Webhook server. Server will run in port 5678, and will be expecting to receive Contentful Webhook calls on `/receive`
62
+ webhook_timeout | Integer (in seconds) for wait time after Webhook received for rebuilding. Only used if `:rebuild_on_webhook` is true. Defaults to 300 seconds
63
+ webhook_controller | Class for handling Webhook response, defaults to `::ContentfulMiddleman::WebhookHandler`
63
64
 
64
65
  You can activate the extension multiple times to import entries from different spaces.
65
66
 
@@ -22,7 +22,7 @@ Gem::Specification.new do |s|
22
22
  s.add_dependency("middleman-core", ["~> 3.4"])
23
23
 
24
24
  # Additional dependencies
25
- s.add_dependency("contentful", '~> 0.8')
25
+ s.add_dependency("contentful", '~> 1.0')
26
26
  s.add_dependency("contentful-webhook-listener", '~> 0.1')
27
27
 
28
28
  s.add_development_dependency 'rubygems-tasks', '~> 0.2'
@@ -32,5 +32,6 @@ Gem::Specification.new do |s|
32
32
  s.add_development_dependency "rake"
33
33
  s.add_development_dependency "rspec"
34
34
  s.add_development_dependency "vcr"
35
- s.add_development_dependency "webmock"
35
+ s.add_development_dependency 'webmock', '~> 1', '>= 1.17.3'
36
+ s.add_development_dependency 'tins', '~> 1.6.0'
36
37
  end
@@ -34,6 +34,9 @@ module ContentfulMiddleman
34
34
  option :all_entries, false,
35
35
  'Allow multiple requests to the API for getting over 1000 entries'
36
36
 
37
+ option :all_entries_page_size, 1000,
38
+ 'Size of each page when querying for all entries'
39
+
37
40
  option :rebuild_on_webhook, false,
38
41
  "Run `middleman contentful --rebuild` upon receiving a Webhook on http://0.0.0.0:5678/receive"
39
42
 
@@ -46,9 +46,9 @@ module ContentfulMiddleman
46
46
  query[:order] = 'sys.createdAt' unless query.key?(:order)
47
47
  num_entries = client.entries(limit: 1).total
48
48
 
49
- ((num_entries / 1000) + 1).times do |i|
50
- query[:limit] = 1000
51
- query[:skip] = i * 1000
49
+ ((num_entries / options.all_entries_page_size) + 1).times do |i|
50
+ query[:limit] = options.all_entries_page_size
51
+ query[:skip] = i * options.all_entries_page_size
52
52
  page = client.entries(query)
53
53
  page.each { |entry| all << entry }
54
54
  end
@@ -52,9 +52,10 @@ module ContentfulMiddleman
52
52
  end
53
53
 
54
54
  def map_asset(asset)
55
- context = Context.new
55
+ context = Context.new
56
56
  context.title = asset.title
57
- context.url = asset.file.url
57
+ context.description = asset.description
58
+ context.url = asset.file.url unless asset.file.nil?
58
59
 
59
60
  context
60
61
  end
@@ -1,3 +1,3 @@
1
1
  module ContentfulMiddleman
2
- VERSION = "1.3.2"
2
+ VERSION = "1.4.0"
3
3
  end
@@ -11,8 +11,8 @@ class MapperDouble
11
11
  end
12
12
 
13
13
  describe ContentfulMiddleman::Instance do
14
- let(:extension) { ExtensionDouble.new }
15
- let(:options) { extension.options }
14
+ let(:options) { OptionsDouble.new }
15
+ let(:extension) { ExtensionDouble.new(options) }
16
16
  subject { described_class.new(extension) }
17
17
 
18
18
  describe 'instance methods' do
@@ -38,6 +38,18 @@ describe ContentfulMiddleman::Instance do
38
38
  subject.entries
39
39
  }
40
40
  end
41
+
42
+ it 'all_entries with a different page size' do
43
+ vcr('instance/entries_3') {
44
+ subject = described_class.new(ExtensionDouble.new(OptionsDouble.new(all_entries_page_size: 100, all_entries: true)))
45
+ client = subject.send(:client)
46
+
47
+ expect(client).to receive(:entries).with(limit: 1).and_call_original
48
+ expect(client).to receive(:entries).with(options.cda_query.merge(limit: 100, skip: 0, order: 'sys.createdAt')).and_call_original
49
+
50
+ subject.entries
51
+ }
52
+ end
41
53
  end
42
54
 
43
55
  it '#space_name' do
@@ -40,6 +40,7 @@ describe ContentfulMiddleman::Mapper::Base do
40
40
  :name=>"Doge",
41
41
  :image=> {
42
42
  :title=>"Doge",
43
+ :description=>"nice picture",
43
44
  :url=> "//images.contentful.com/cfexampleapi/1x0xpXu4pSGS4OukSyWGUK/cc1239c6385428ef26f4180190532818/doge.jpg"
44
45
  },
45
46
  :description=>"such json\nwow"
@@ -94,5 +95,24 @@ describe ContentfulMiddleman::Mapper::Base do
94
95
  expect { subject.map(context, entry) }.not_to raise_error
95
96
  expect(context.hashize).to eq(id: 'foo')
96
97
  end
98
+
99
+ it 'should not fail on missing asset file - #85' do
100
+ vcr('entries/nil_file') {
101
+ context = ContentfulMiddleman::Context.new
102
+ client = Contentful::Client.new(
103
+ space: '7f19o1co4hn7',
104
+ access_token: '<ACCESS_TOKEN>',
105
+ api_url: 'preview.contentful.com',
106
+ dynamic_entries: :auto
107
+ )
108
+
109
+ entry_with_nil_file = client.entries('sys.id' => '6C4T3KAZUWaysA6ooQOWiE').first
110
+
111
+ expect(entry_with_nil_file.one_media.file).to be_nil
112
+
113
+ expect { subject.map(context, entry_with_nil_file) }.not_to raise_error
114
+ expect(context.hashize[:oneMedia].keys.map(&:to_s)).not_to include('url')
115
+ }
116
+ end
97
117
  end
98
118
  end
@@ -0,0 +1,160 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://preview.contentful.com/spaces/7f19o1co4hn7/content_types?limit=1000
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - RubyContentfulGem/0.9.0
12
+ Authorization:
13
+ - Bearer <ACCESS_TOKEN>
14
+ Content-Type:
15
+ - application/vnd.contentful.delivery.v1+json
16
+ Accept-Encoding:
17
+ - gzip
18
+ Connection:
19
+ - close
20
+ Host:
21
+ - preview.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
+ - '1728000'
37
+ Cf-Cache-Name:
38
+ - content_delivery
39
+ Cf-Organization-Id:
40
+ - 4SsuxQCaMaemfIms52Jr8s
41
+ Cf-Space-Id:
42
+ - 7f19o1co4hn7
43
+ Content-Encoding:
44
+ - gzip
45
+ Content-Type:
46
+ - application/vnd.contentful.delivery.v1+json
47
+ Date:
48
+ - Tue, 19 Jul 2016 13:49:05 GMT
49
+ Etag:
50
+ - W/"fc29ab3a2f513fc6c7906826a270536c"
51
+ Server:
52
+ - Contentful
53
+ X-Content-Type-Options:
54
+ - nosniff
55
+ X-Contentful-Request-Id:
56
+ - 1c1ffa9b68c2630a8e97c94b8ad3f1e4
57
+ Content-Length:
58
+ - '621'
59
+ Connection:
60
+ - Close
61
+ body:
62
+ encoding: ASCII-8BIT
63
+ string: !binary |-
64
+ H4sIAAAAAAAAA+1XS4+bMBC+51cgn5sISBoet6jaPXVVqUkvrXLwwkS1AoZi
65
+ 70p0lf9eP2KwEdA9VKtqFQ4Jtscz/mbG3wwvC89DrGUo9V7EqxjwtgYxQrum
66
+ wS0Sc5cPUoZXHBdiPlQjdia1GPhqUJCScDEKfF9PEA6l1PhDadR6B2aUKVbj
67
+ TNoyEnrSOoycUJPmUJ8JPSNptH+EeXo+XA+9VxoHAiSXeKJTkFRBVm1+0kjC
68
+ Ms+le1dA9dMZ/FRRDpQr/dayViktQ35HedPaiw08E0Yqarx1VZk1gDnkO+kq
69
+ FPrBdulHyyA5BGH6MU6DzWqdJN9tPU91PrMh3Ky2sbuhqDJcqOABXX7bG5Qd
70
+ LpQTVhe4vSdQKJ9wwoW8wYUoLtVu6WXIPRcYyoFlDam5Rob6bSepro+3hOtE
71
+ VDvLtSWFOnsH5xhqyQR835aPVeFEFCmY5DdICCdcMLDjjRr49USaiUXhAPxY
72
+ TCxWIo1FgIzWsbwYwVVReICcYPeMxpVfKHgjy5P5/FbgHJfZN2jHGPD+flh3
73
+ YgR7iWk7gs6AfxDLc+g1xbhHeZvYOjYNXdkA/8I5zyIBxeUUV0Hl/XHAODMO
74
+ FXzaJ9b17aj+r65+v3QpeHSSKNcWuc4RZZT6ySqOt68jynUa+OkmXCVR7Gz4
75
+ V0R5Y0iZuF3qytcRlrgx5GR5uDGk7DTdkuMwZE8L44n1FU7QAB00fV1nIcvv
76
+ hMj/W4I1q7yy/ZAleAKhU4YnZNxu/x2UYquzH9KR5ir1vWC39eY7RS+bXyVm
77
+ mvuBUs/TFbvf0dd0OTfXDgyCO9MOCKPHxWXxB+T5B+KiDQAA
78
+ http_version:
79
+ recorded_at: Tue, 19 Jul 2016 13:49:05 GMT
80
+ - request:
81
+ method: get
82
+ uri: https://preview.contentful.com/spaces/7f19o1co4hn7/entries?sys.id=6C4T3KAZUWaysA6ooQOWiE
83
+ body:
84
+ encoding: US-ASCII
85
+ string: ''
86
+ headers:
87
+ User-Agent:
88
+ - RubyContentfulGem/0.9.0
89
+ Authorization:
90
+ - Bearer <ACCESS_TOKEN>
91
+ Content-Type:
92
+ - application/vnd.contentful.delivery.v1+json
93
+ Accept-Encoding:
94
+ - gzip
95
+ Connection:
96
+ - close
97
+ Host:
98
+ - preview.contentful.com
99
+ response:
100
+ status:
101
+ code: 200
102
+ message: OK
103
+ headers:
104
+ Access-Control-Allow-Headers:
105
+ - 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
106
+ Access-Control-Allow-Methods:
107
+ - GET,HEAD,OPTIONS
108
+ Access-Control-Allow-Origin:
109
+ - "*"
110
+ Access-Control-Expose-Headers:
111
+ - Etag
112
+ Access-Control-Max-Age:
113
+ - '1728000'
114
+ Cf-Cache-Name:
115
+ - content_delivery
116
+ Cf-Organization-Id:
117
+ - 4SsuxQCaMaemfIms52Jr8s
118
+ Cf-Space-Id:
119
+ - 7f19o1co4hn7
120
+ Content-Encoding:
121
+ - gzip
122
+ Content-Type:
123
+ - application/vnd.contentful.delivery.v1+json
124
+ Date:
125
+ - Tue, 19 Jul 2016 13:49:06 GMT
126
+ Etag:
127
+ - W/"eae0ff124df9052c96d03a5572af262c"
128
+ Server:
129
+ - Contentful
130
+ X-Content-Type-Options:
131
+ - nosniff
132
+ X-Contentful-Request-Id:
133
+ - 2be7b37d89298c04da417517aa7deb52
134
+ Content-Length:
135
+ - '764'
136
+ Connection:
137
+ - Close
138
+ body:
139
+ encoding: ASCII-8BIT
140
+ string: !binary |-
141
+ H4sIAAAAAAAAA91Wy3KbMBTd5ys8rBsPwhhi7yiTZOGmnsR2PU0nCwpyooIl
142
+ G5TMuBn/e/QALIgAp+MuWhY2EtLVfZxzj17Pej0j22XGuPfKXtmA7jaQjQwv
143
+ TYOdweb2n/gaSmiQsHkgRlmMNmxgikGC1ojyT6YcIwrX3OAPYVCarZ0iTso2
144
+ QciPKlbIScUXPiEmC5++IBwb/MzDw07H8Tz3eSYs1hagiIfjrsCIgJDYT9jl
145
+ URXPvnwXccqnPPAS03SnGDSkMce354OJd79YBrvMcwi5nS7RpbouJJhCTHPH
146
+ Thehr9jVxskOZR53BpjCF5QhgllqBkrcYQoDCiOPl9OwTOCcm+45GM3BYGyO
147
+ xsDpDx3nXo3zeRM1bWB7rGHfNi8qGxISBokAGMTni1nhaZl8Y4VgEh3wyAti
148
+ UETlnq8Ew96SpDHCj6obbPoGRig4KZq8LINUjyb788qf+ln8e2Zn/tTKHi++
149
+ b2/j7rSvA7wrHJX0kIBTAaKhSg2VGhoIGh6IoHOdLZHo7XaekV6LoAcFKizl
150
+ d3AFU4hPTOI65wQCpOfAs61vydPCnUCynPok3F5v48fj0q46+zdTr3P/AwE0
151
+ pj4viCwM/xXFMGCakvSYbisziAm9gxlJXoKfjFGajifsvWdlBGmAkjot87Zb
152
+ w2MrEotKTvDVBv66ekJLf3E9IzfBduKVBMqDlO41C8g/GFJZN4TD5DmCivBK
153
+ 4BSyeRBObT/Qiqd2pWyg+krlfaVLQkv4NoloDbSqMDVKaRcnKkaa5fQUMTeL
154
+ aukkTxGMZImU1tgWuCKx4tJUPEaLyAIwtt2+5VY0kznRJrPW2AR9y6lvaRDa
155
+ /D6XV14jtuy0LrllSxoE9xTVaNUu0No3ZFQV7apkvkl+VbLlmVHvxIfa8eS0
156
+ UYl975bhElTHBFNFWHX0UKKqCFn+5zJtyEz+tx3lPVDaLzgVKPwJO82LsTno
157
+ m1adai3sHDBCD/suGKmXYI4S/TX4g+yk5V24CQlsfn+2P3sDzwDRnecNAAA=
158
+ http_version:
159
+ recorded_at: Tue, 19 Jul 2016 13:49:06 GMT
160
+ recorded_with: VCR 3.0.1
@@ -0,0 +1,334 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://cdn.contentful.com/spaces/cfexampleapi/content_types?limit=1000
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - RubyContentfulGem/1.0.0
12
+ Authorization:
13
+ - Bearer b4c0n73n7fu1
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
+ - Etag
36
+ Access-Control-Max-Age:
37
+ - '86400'
38
+ Cache-Control:
39
+ - max-age=0
40
+ Content-Encoding:
41
+ - gzip
42
+ Content-Type:
43
+ - application/vnd.contentful.delivery.v1+json
44
+ Etag:
45
+ - W/"350eabdacba992e492dc357c85bc5365"
46
+ Server:
47
+ - nginx
48
+ X-Content-Type-Options:
49
+ - nosniff
50
+ X-Contentful-Request-Id:
51
+ - 58b-1360343827
52
+ Content-Length:
53
+ - '897'
54
+ Accept-Ranges:
55
+ - bytes
56
+ Date:
57
+ - Wed, 07 Sep 2016 22:51:13 GMT
58
+ Via:
59
+ - 1.1 varnish
60
+ Age:
61
+ - '113'
62
+ Connection:
63
+ - close
64
+ X-Served-By:
65
+ - cache-gru7127-GRU
66
+ X-Cache:
67
+ - HIT
68
+ X-Cache-Hits:
69
+ - '1'
70
+ X-Timer:
71
+ - S1473288673.495879,VS0,VE0
72
+ Vary:
73
+ - Accept-Encoding
74
+ body:
75
+ encoding: ASCII-8BIT
76
+ string: !binary |-
77
+ H4sIAAAAAAAAA+1YS1PbMBC+8ytSnxuPZZuQ+AahTDOlvSSndjgotgKayI/a
78
+ CiVl+O+V5MiWbOWBYaCl+GRpJe1+q93VJ90f9XpWsS6soHfPflmDrjPEWtZp
79
+ nsO1xfoePvIxNKWQsH5ftIolzljDEQ2CY0xZCzhO2YEpivmKP8SK5boNNUJV
80
+ kcGQ65Ijyk7FGN4hOqVRlzhZWlxp/TH1yXK2MXoqVmwMwBHHEy7QHYwzgmCG
81
+ OSz5PVT/Amj5WZs5kCqLVVaM04SihAqlypwwR5Ci6JT7wnId4PWdQd89mblu
82
+ 4A8C4NrDY/e7OmGVRdqEQd856QN3BvwADIJjxx6OHG1Cjm5xgdOE78PG1spo
83
+ K8JFRuD6AiMiACcwrs0rW6x3rECyIlSEOc5ouaT1FaW/7MpAa8FXqveRe0bb
84
+ qdJHmho+plL1TTVASOQ2ztCd6lgeQ2kICf6NuOU0XyF1C60c/Vzh3CxjqOGc
85
+ CNkCkkKfmLLAZDsiZaadNiAieIkKLYgqSJdtkZ4vmt0qqLZxCqq28DGwNJ0y
86
+ 91Rciuen63iekmaG3DLfs1BkYSC2+2pfehicFqYkzc1OG7dF0mkGc7RQaDvm
87
+ 2bx2YDDMUUEvcoySyAzujMl7pgFbS9ZLAdRDUSmSnxKai8pefkrZM+zrHOf0
88
+ JmIngbacSHpWTc6MUgn9nFU3fd4LZcSB2AhebE90JuoRtGjUKQltwk6Aa9QI
89
+ +OdB1yp/XavY7XZwTPQ64NoJ3Q0djuF1I7ZkTE7aor83F0+LAlElFzeRW1bg
90
+ TWb+wwQK0NFkHi6i8XIQO/5qMp0WcPJF5UByaw7kVH7fcfsumAEv8N3A82zH
91
+ Ge3kVHsnKJwKdOVUmNb1sUGqkhUhsnS+GqNqZ90LU6qQ0eVmtZT5OjbIqoRl
92
+ tFCw0268qlVKH0Or6kPkjSXlzSqGqkefeK/xbeB5O3OQXYRGLG9n4DgATuAO
93
+ 7CEYbrvXeB1z8LMG6j0JDVROve0Z2dy5ch3UBsh03H1v21ll2sJuuVjbZUD4
94
+ fnOrihZ7tzmQBXejUuXzULeyvDMWWjW7QRA1lXtuu6bnouZdV11PPGbVr0kN
95
+ cqa59I2dCVF6/QRW1njp8mx/pBf45ktXdSL4gecGANhD72TbieB2PBHOFUjN
96
+ l64zmC8/VID/X1729o+EbtWtVThe/dFm90WRpcjV0cPRH4Dbx6LOFwAA
97
+ http_version:
98
+ recorded_at: Wed, 07 Sep 2016 22:51:13 GMT
99
+ - request:
100
+ method: get
101
+ uri: https://cdn.contentful.com/spaces/cfexampleapi/entries?limit=1
102
+ body:
103
+ encoding: US-ASCII
104
+ string: ''
105
+ headers:
106
+ User-Agent:
107
+ - RubyContentfulGem/1.0.0
108
+ Authorization:
109
+ - Bearer b4c0n73n7fu1
110
+ Content-Type:
111
+ - application/vnd.contentful.delivery.v1+json
112
+ Accept-Encoding:
113
+ - gzip
114
+ Connection:
115
+ - close
116
+ Host:
117
+ - cdn.contentful.com
118
+ response:
119
+ status:
120
+ code: 200
121
+ message: OK
122
+ headers:
123
+ Access-Control-Allow-Headers:
124
+ - 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
125
+ Access-Control-Allow-Methods:
126
+ - GET,HEAD,OPTIONS
127
+ Access-Control-Allow-Origin:
128
+ - "*"
129
+ Access-Control-Expose-Headers:
130
+ - Etag
131
+ - Etag
132
+ Access-Control-Max-Age:
133
+ - '86400'
134
+ Cache-Control:
135
+ - max-age=0
136
+ Content-Type:
137
+ - application/vnd.contentful.delivery.v1+json
138
+ Etag:
139
+ - '"4963aeacd9e2ea8dbda07d7686f127a0"'
140
+ Server:
141
+ - nginx
142
+ X-Content-Type-Options:
143
+ - nosniff
144
+ X-Contentful-Request-Id:
145
+ - 4c3-1778517209
146
+ Content-Length:
147
+ - '827'
148
+ Accept-Ranges:
149
+ - bytes
150
+ Date:
151
+ - Wed, 07 Sep 2016 22:51:13 GMT
152
+ Via:
153
+ - 1.1 varnish
154
+ Age:
155
+ - '0'
156
+ Connection:
157
+ - close
158
+ X-Served-By:
159
+ - cache-gru7126-GRU
160
+ X-Cache:
161
+ - MISS
162
+ X-Cache-Hits:
163
+ - '0'
164
+ X-Timer:
165
+ - S1473288673.695781,VS0,VE163
166
+ Vary:
167
+ - Accept-Encoding
168
+ body:
169
+ encoding: ASCII-8BIT
170
+ string: |
171
+ {
172
+ "sys": {
173
+ "type": "Array"
174
+ },
175
+ "total": 10,
176
+ "skip": 0,
177
+ "limit": 1,
178
+ "items": [
179
+ {
180
+ "sys": {
181
+ "space": {
182
+ "sys": {
183
+ "type": "Link",
184
+ "linkType": "Space",
185
+ "id": "cfexampleapi"
186
+ }
187
+ },
188
+ "id": "5ETMRzkl9KM4omyMwKAOki",
189
+ "type": "Entry",
190
+ "createdAt": "2014-02-21T13:42:57.752Z",
191
+ "updatedAt": "2014-08-23T14:42:35.207Z",
192
+ "revision": 3,
193
+ "contentType": {
194
+ "sys": {
195
+ "type": "Link",
196
+ "linkType": "ContentType",
197
+ "id": "1t9IbcfdCk6m04uISSsaIK"
198
+ }
199
+ },
200
+ "locale": "en-US"
201
+ },
202
+ "fields": {
203
+ "name": "London",
204
+ "center": {
205
+ "lon": -0.12548719999995228,
206
+ "lat": 51.508515
207
+ }
208
+ }
209
+ }
210
+ ]
211
+ }
212
+ http_version:
213
+ recorded_at: Wed, 07 Sep 2016 22:51:13 GMT
214
+ - request:
215
+ method: get
216
+ uri: https://cdn.contentful.com/spaces/cfexampleapi/entries?limit=100&order=sys.createdAt&skip=0
217
+ body:
218
+ encoding: US-ASCII
219
+ string: ''
220
+ headers:
221
+ User-Agent:
222
+ - RubyContentfulGem/1.0.0
223
+ Authorization:
224
+ - Bearer b4c0n73n7fu1
225
+ Content-Type:
226
+ - application/vnd.contentful.delivery.v1+json
227
+ Accept-Encoding:
228
+ - gzip
229
+ Connection:
230
+ - close
231
+ Host:
232
+ - cdn.contentful.com
233
+ response:
234
+ status:
235
+ code: 200
236
+ message: OK
237
+ headers:
238
+ Access-Control-Allow-Headers:
239
+ - 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
240
+ Access-Control-Allow-Methods:
241
+ - GET,HEAD,OPTIONS
242
+ Access-Control-Allow-Origin:
243
+ - "*"
244
+ Access-Control-Expose-Headers:
245
+ - Etag
246
+ - Etag
247
+ Access-Control-Max-Age:
248
+ - '86400'
249
+ Cache-Control:
250
+ - max-age=0
251
+ Content-Encoding:
252
+ - gzip
253
+ Content-Type:
254
+ - application/vnd.contentful.delivery.v1+json
255
+ Etag:
256
+ - W/"b303c1577831b85822538c1896d73aab"
257
+ Server:
258
+ - nginx
259
+ X-Content-Type-Options:
260
+ - nosniff
261
+ X-Contentful-Request-Id:
262
+ - 58b-1360345546
263
+ Content-Length:
264
+ - '1958'
265
+ Accept-Ranges:
266
+ - bytes
267
+ Date:
268
+ - Wed, 07 Sep 2016 22:51:14 GMT
269
+ Via:
270
+ - 1.1 varnish
271
+ Age:
272
+ - '0'
273
+ Connection:
274
+ - close
275
+ X-Served-By:
276
+ - cache-gru7126-GRU
277
+ X-Cache:
278
+ - MISS
279
+ X-Cache-Hits:
280
+ - '0'
281
+ X-Timer:
282
+ - S1473288674.033998,VS0,VE173
283
+ Vary:
284
+ - Accept-Encoding
285
+ body:
286
+ encoding: ASCII-8BIT
287
+ string: !binary |-
288
+ H4sIAAAAAAAAA+1aW3ObRhu+z69QuelFK7QnTrpTVMdxXdVNJddJ+nUyCFYS
289
+ FgICKLbSyX/vu4DwgtFhZKXxZ5fxeMRhYffd53nPf79otZRklSjd1t/wE07S
290
+ VcThTOnFsb1S4NqXH8UzaZjaPlzHKDtN5l4EZ/mJ7y28NLuXn3spX4g3/pm9
291
+ MX9v7TPZp5LIdsS31k/kF6XJiAvZxfWkfvGCuSImcHcoPlwbFZMeZm+sPeC5
292
+ Yj3OhN/ai8jnduSJZa2PL+XvbKH5oeRjgpUdOHYqvbCcyUmQxiv5hhNzO+Vu
293
+ TwhCIQjTNtLbx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HcoM
326
+ ba1Q8mD27TaOJfvAc4RmOqZX8l5fm3212sRRiMdmfsrf9N4OTW+I3vUHl/qb
327
+ wdW0A7RzTQIhCJsgzDCyqM4cZ6I5poVd4rodIXs1Cg6weQQxM2vplI99OFd0
328
+ gtYGlpzDOj6Yc5tW00g3sWrZkSt/lzm19eqelL2737f6UMKxvQlXWsh7Q5pT
329
+ EEcydw2tosch3TTSU7t3c8X6i+F0ufhI+Pxy0bFcGzkuBq5B2mtsugahjHLT
330
+ 0myEXB3jjpjPB+jp/EA0FN1+mMTgrx1GQgjU7luwfUgIX65zVzZ8cPtgEu67
331
+ ugNJmc3rL/j/5cWXF/8A5DPmDKMuAAA=
332
+ http_version:
333
+ recorded_at: Wed, 07 Sep 2016 22:51:14 GMT
334
+ recorded_with: VCR 3.0.3
data/spec/spec_helper.rb CHANGED
@@ -47,19 +47,21 @@ class OptionsDouble
47
47
  content_types: {},
48
48
  use_preview_api: false,
49
49
  all_entries: false,
50
+ all_entries_page_size: 1000,
50
51
  rebuild_on_webhook: false,
51
52
  webhook_timeout: 300,
52
53
  webhook_controller: ::ContentfulMiddleman::WebhookHandler
53
54
  }
54
55
 
55
- def initialize(options = DEFAULT_OPTIONS)
56
+ def initialize(options = {})
57
+ options = DEFAULT_OPTIONS.merge(options)
56
58
  options.each do |field, value|
57
59
  define_singleton_method(field.to_sym) do
58
60
  value
59
61
  end
60
62
 
61
- define_singleton_method("#{field}=".to_sym) do |value|
62
- options[field] = value
63
+ define_singleton_method("#{field}=".to_sym) do |v|
64
+ options[field] = v
63
65
  end
64
66
  end
65
67
  end
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: 1.3.2
4
+ version: 1.4.0
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: 2016-02-22 00:00:00.000000000 Z
12
+ date: 2016-09-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: middleman-core
@@ -31,14 +31,14 @@ dependencies:
31
31
  requirements:
32
32
  - - "~>"
33
33
  - !ruby/object:Gem::Version
34
- version: '0.8'
34
+ version: '1.0'
35
35
  type: :runtime
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
39
  - - "~>"
40
40
  - !ruby/object:Gem::Version
41
- version: '0.8'
41
+ version: '1.0'
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: contentful-webhook-listener
44
44
  requirement: !ruby/object:Gem::Requirement
@@ -155,16 +155,36 @@ dependencies:
155
155
  name: webmock
156
156
  requirement: !ruby/object:Gem::Requirement
157
157
  requirements:
158
+ - - "~>"
159
+ - !ruby/object:Gem::Version
160
+ version: '1'
158
161
  - - ">="
159
162
  - !ruby/object:Gem::Version
160
- version: '0'
163
+ version: 1.17.3
161
164
  type: :development
162
165
  prerelease: false
163
166
  version_requirements: !ruby/object:Gem::Requirement
164
167
  requirements:
168
+ - - "~>"
169
+ - !ruby/object:Gem::Version
170
+ version: '1'
165
171
  - - ">="
166
172
  - !ruby/object:Gem::Version
167
- version: '0'
173
+ version: 1.17.3
174
+ - !ruby/object:Gem::Dependency
175
+ name: tins
176
+ requirement: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - "~>"
179
+ - !ruby/object:Gem::Version
180
+ version: 1.6.0
181
+ type: :development
182
+ prerelease: false
183
+ version_requirements: !ruby/object:Gem::Requirement
184
+ requirements:
185
+ - - "~>"
186
+ - !ruby/object:Gem::Version
187
+ version: 1.6.0
168
188
  description: Load blog posts and other managed content into Middleman
169
189
  email:
170
190
  - sascha@contentful.com
@@ -219,9 +239,11 @@ files:
219
239
  - spec/fixtures/space_hash_fixtures/.foo-space-hash
220
240
  - spec/fixtures/space_hash_fixtures/.foobar-space-hash
221
241
  - spec/fixtures/space_hash_fixtures/.my_space-space-hash
242
+ - spec/fixtures/vcr_fixtures/entries/nil_file.yml
222
243
  - spec/fixtures/vcr_fixtures/helpers/preview.yml
223
244
  - spec/fixtures/vcr_fixtures/instance/entries_1.yml
224
245
  - spec/fixtures/vcr_fixtures/instance/entries_2.yml
246
+ - spec/fixtures/vcr_fixtures/instance/entries_3.yml
225
247
  - spec/fixtures/vcr_fixtures/mappers/entries.yml
226
248
  - spec/fixtures/vcr_fixtures/mappers/entries_localized.yml
227
249
  - spec/fixtures/vcr_fixtures/tools/preview_helper.yml
@@ -254,7 +276,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
254
276
  version: '0'
255
277
  requirements: []
256
278
  rubyforge_project:
257
- rubygems_version: 2.5.0
279
+ rubygems_version: 2.5.1
258
280
  signing_key:
259
281
  specification_version: 4
260
282
  summary: Include mangablable content from the Contentful CMS and API into your Middleman
@@ -278,9 +300,11 @@ test_files:
278
300
  - spec/fixtures/space_hash_fixtures/.foo-space-hash
279
301
  - spec/fixtures/space_hash_fixtures/.foobar-space-hash
280
302
  - spec/fixtures/space_hash_fixtures/.my_space-space-hash
303
+ - spec/fixtures/vcr_fixtures/entries/nil_file.yml
281
304
  - spec/fixtures/vcr_fixtures/helpers/preview.yml
282
305
  - spec/fixtures/vcr_fixtures/instance/entries_1.yml
283
306
  - spec/fixtures/vcr_fixtures/instance/entries_2.yml
307
+ - spec/fixtures/vcr_fixtures/instance/entries_3.yml
284
308
  - spec/fixtures/vcr_fixtures/mappers/entries.yml
285
309
  - spec/fixtures/vcr_fixtures/mappers/entries_localized.yml
286
310
  - spec/fixtures/vcr_fixtures/tools/preview_helper.yml