Skip to content
This repository has been archived by the owner on May 8, 2024. It is now read-only.

Expose revision in system data #52

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/jekyll-contentful-data-import/mappers/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ def map_entry_metadata
'id' => entry.sys.fetch(:id, nil),
'created_at' => entry.sys.fetch(:created_at, nil),
'updated_at' => entry.sys.fetch(:updated_at, nil),
'content_type_id' => content_type.nil? ? nil : content_type.id
'content_type_id' => content_type.nil? ? nil : content_type.id,
'revision' => entry.sys.fetch(:revision, nil)
}
end

Expand Down
15 changes: 10 additions & 5 deletions spec/jekyll-contentful/mappers/base_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ def initialize(id)
'id' => 'foo',
'created_at' => nil,
'updated_at' => nil,
'content_type_id' => 'content_type'
'content_type_id' => 'content_type',
'revision' => nil
}
}
expect(subject.map).to eq expected
Expand All @@ -109,7 +110,8 @@ def initialize(id)
'id' => 'foo',
'created_at' => nil,
'updated_at' => nil,
'content_type_id' => 'content_type'
'content_type_id' => 'content_type',
'revision' => nil
},
'asset' => {
'sys' => {
Expand All @@ -133,7 +135,8 @@ def initialize(id)
'id' => 'baz',
'created_at' => nil,
'updated_at' => nil,
'content_type_id' => 'content_type'
'content_type_id' => 'content_type',
'revision' => nil
},
},
'array' => [
Expand Down Expand Up @@ -164,7 +167,8 @@ def initialize(id)
'id' => 'foo',
'created_at' => nil,
'updated_at' => nil,
'content_type_id' => 'content_type'
'content_type_id' => 'content_type',
'revision' => nil
},
'foo' => {
'en-US' => 'bar',
Expand Down Expand Up @@ -201,7 +205,8 @@ def initialize(id)
'id' => 'foo',
'created_at' => nil,
'updated_at' => nil,
'content_type_id' => 'content_type'
'content_type_id' => 'content_type',
'revision' => nil
},
'asset' => {
"en-US" => {
Expand Down
18 changes: 12 additions & 6 deletions spec/jekyll-contentful/serializer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
'id' => 'foo',
'created_at' => nil,
'updated_at' => nil,
'content_type_id' => 'content_type'
'content_type_id' => 'content_type',
'revision' => nil
}
}
]
Expand All @@ -48,7 +49,8 @@
'id' => 'foo',
'created_at' => nil,
'updated_at' => nil,
'content_type_id' => 'content_type'
'content_type_id' => 'content_type',
'revision' => nil
},
'foobar' => 'bar'
}
Expand All @@ -73,14 +75,16 @@
'id' => 'foo',
'created_at' => nil,
'updated_at' => nil,
'content_type_id' => 'content_type'
'content_type_id' => 'content_type',
'revision' => nil
},
'foobar' => {
'sys' => {
'id' => 'foobar',
'created_at' => nil,
'updated_at' => nil,
'content_type_id' => 'content_type'
'content_type_id' => 'content_type',
'revision' => nil
},
'baz' => 1
}
Expand All @@ -103,7 +107,8 @@
'id' => 'foo',
'created_at' => nil,
'updated_at' => nil,
'content_type_id' => 'content_type'
'content_type_id' => 'content_type',
'revision' => nil
},
'foobar' => 'bar'
},
Expand All @@ -112,7 +117,8 @@
'id' => 'bar',
'created_at' => nil,
'updated_at' => nil,
'content_type_id' => 'content_type'
'content_type_id' => 'content_type',
'revision' => nil
},
'foobar' => 'baz'
}
Expand Down