Class: Rev::Comment

Inherits:
ApiSerializable show all
Defined in:
lib/rev-api/models/order.rb

Overview

Order comment, containing author, creation timestamp and text

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from ApiSerializable

#to_hash, #to_json

Constructor Details

#initialize(fields) ⇒ Comment

Returns a new instance of Comment.

Parameters:

  • fields (Hash)

    hash of comment fields parsed from JSON API response



45
46
47
48
49
# File 'lib/rev-api/models/order.rb', line 45

def initialize(fields)
  super fields
  @timestamp = Date.iso8601(fields['timestamp'])
  @text = fields['text'] ? fields['text'] : String.new # right now API gives no 'text' field if text is empty
end

Instance Attribute Details

#byObject (readonly)

Returns the value of attribute by.



42
43
44
# File 'lib/rev-api/models/order.rb', line 42

def by
  @by
end

#textObject (readonly)

Returns the value of attribute text.



42
43
44
# File 'lib/rev-api/models/order.rb', line 42

def text
  @text
end

#timestampObject (readonly)

Returns the value of attribute timestamp.



42
43
44
# File 'lib/rev-api/models/order.rb', line 42

def timestamp
  @timestamp
end