Class: Tinycms::Posts::Mapper

Inherits:
Object
  • Object
show all
Defined in:
lib/tinycms/posts/mapper.rb

Class Method Summary collapse

Class Method Details

.map(response_body) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/tinycms/posts/mapper.rb', line 6

def self.map(response_body)
  Post.new(
    id: response_body["id"],
    title: response_body["title"],
    author: ::Tinycms::Authors::Mapper.map(response_body["author"]),
    content: response_body["content"],
    content_plain_text: response_body["content_plain_text"],
    slug: response_body["slug"],
    created_at: Time.zone.parse(response_body["created_at"]),
    updated_at: Time.zone.parse(response_body["updated_at"])
  )
end