lib/ghost_rb/resources/post.rb in ghost_rb-0.2.0 vs lib/ghost_rb/resources/post.rb in ghost_rb-0.2.5
- old
+ new
@@ -4,20 +4,20 @@
module Resources
# @author Rene Hernandez
# @since 0.1
class Post < BaseResource
attr_accessor :id, :title, :slug, :html, :page,
- :status, :published_at, :created_at, :author_id,
- :visibility, :featured, :plaintext, :author, :tags
+ :status, :published_at, :created_at, :author,
+ :visibility, :featured, :plaintext, :tags
alias page? page
alias featured? featured
- def self.generate(hash)
- inst = super(hash)
- inst.author = User.generate(hash[:author]) if hash.key?(:author)
- inst.tags = hash[:tags].map { |t| Tag.generate(t) } if hash.key?(:tags)
+ 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
end
end