Class: Me2API::Comment

Inherits:
Model
  • Object
show all
Defined in:
lib/me2api/model/comment.rb

Constant Summary

Constants inherited from Model

Model::FROM_OR_TO_REGEX

Instance Method Summary collapse

Methods inherited from Model

#[]=, #id, #iso8601_time, #method_missing, #type, #underscore, wrap

Constructor Details

#initialize(post_id, hash, options = {}) ⇒ Comment

Returns a new instance of Comment.



5
6
7
8
9
10
# File 'lib/me2api/model/comment.rb', line 5

def initialize(post_id, hash, options = {})
  super(hash)
  
  self[:post_id] = post_id
  self[:post_permalink] = options[:post_permalink]
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Me2API::Model

Instance Method Details

#pub_dateObject



12
13
14
15
16
17
# File 'lib/me2api/model/comment.rb', line 12

def pub_date
  unless self[:pub_date].is_a?(Time)
    self[:pub_date] = Time.parse(self[:pub_date])
  end
  self[:pub_date]
end