Class: GhostRb::Resources::Post

Inherits:
BaseResource show all
Defined in:
lib/ghost_rb/resources/post.rb

Overview

Author:

  • Rene Hernandez

Since:

  • 0.1

Instance Attribute Summary collapse

Class Method Summary collapse

Methods inherited from BaseResource

hash_value?

Methods included from Support::Hydratable

#hydrate

Instance Attribute Details

#authorObject

Since:

  • 0.1



8
9
10
# File 'lib/ghost_rb/resources/post.rb', line 8

def author
  @author
end

#created_atObject

Since:

  • 0.1



8
9
10
# File 'lib/ghost_rb/resources/post.rb', line 8

def created_at
  @created_at
end

Since:

  • 0.1



8
9
10
# File 'lib/ghost_rb/resources/post.rb', line 8

def featured
  @featured
end

#htmlObject

Since:

  • 0.1



8
9
10
# File 'lib/ghost_rb/resources/post.rb', line 8

def html
  @html
end

#idObject

Since:

  • 0.1



8
9
10
# File 'lib/ghost_rb/resources/post.rb', line 8

def id
  @id
end

#pageObject Also known as: page?

Since:

  • 0.1



8
9
10
# File 'lib/ghost_rb/resources/post.rb', line 8

def page
  @page
end

#plaintextObject

Since:

  • 0.1



8
9
10
# File 'lib/ghost_rb/resources/post.rb', line 8

def plaintext
  @plaintext
end

#published_atObject

Since:

  • 0.1



8
9
10
# File 'lib/ghost_rb/resources/post.rb', line 8

def published_at
  @published_at
end

#slugObject

Since:

  • 0.1



8
9
10
# File 'lib/ghost_rb/resources/post.rb', line 8

def slug
  @slug
end

#statusObject

Since:

  • 0.1



8
9
10
# File 'lib/ghost_rb/resources/post.rb', line 8

def status
  @status
end

#tagsObject

Since:

  • 0.1



8
9
10
# File 'lib/ghost_rb/resources/post.rb', line 8

def tags
  @tags
end

#titleObject

Since:

  • 0.1



8
9
10
# File 'lib/ghost_rb/resources/post.rb', line 8

def title
  @title
end

#visibilityObject

Since:

  • 0.1



8
9
10
# File 'lib/ghost_rb/resources/post.rb', line 8

def visibility
  @visibility
end

Class Method Details

.generate(data) ⇒ Object

Since:

  • 0.1



16
17
18
19
20
21
22
# File 'lib/ghost_rb/resources/post.rb', line 16

def self.generate(data)
  inst = super(data)
  inst.author = User.generate(data[:author]) if hash_value?(data, :author)
  inst.tags = data[:tags].map { |t| Tag.generate(t) } if data.key?(:tags)

  inst
end