Class: PostProxy::Post
Instance Attribute Summary collapse
-
#body ⇒ Object
Returns the value of attribute body.
-
#created_at ⇒ Object
Returns the value of attribute created_at.
-
#id ⇒ Object
Returns the value of attribute id.
-
#media ⇒ Object
Returns the value of attribute media.
-
#platforms ⇒ Object
Returns the value of attribute platforms.
-
#scheduled_at ⇒ Object
Returns the value of attribute scheduled_at.
-
#status ⇒ Object
Returns the value of attribute status.
-
#thread ⇒ Object
Returns the value of attribute thread.
Instance Method Summary collapse
-
#initialize(**attrs) ⇒ Post
constructor
A new instance of Post.
Methods inherited from Model
Constructor Details
#initialize(**attrs) ⇒ Post
Returns a new instance of Post.
113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 |
# File 'lib/postproxy/types.rb', line 113 def initialize(**attrs) @scheduled_at = nil @media = [] @platforms = [] @thread = [] super @scheduled_at = parse_time(@scheduled_at) @created_at = parse_time(@created_at) @media = (@media || []).map do |m| m.is_a?(Media) ? m : Media.new(**m.transform_keys(&:to_sym)) end @platforms = (@platforms || []).map do |p| p.is_a?(PlatformResult) ? p : PlatformResult.new(**p.transform_keys(&:to_sym)) end @thread = (@thread || []).map do |t| t.is_a?(ThreadChild) ? t : ThreadChild.new(**t.transform_keys(&:to_sym)) end end |
Instance Attribute Details
#body ⇒ Object
Returns the value of attribute body.
111 112 113 |
# File 'lib/postproxy/types.rb', line 111 def body @body end |
#created_at ⇒ Object
Returns the value of attribute created_at.
111 112 113 |
# File 'lib/postproxy/types.rb', line 111 def created_at @created_at end |
#id ⇒ Object
Returns the value of attribute id.
111 112 113 |
# File 'lib/postproxy/types.rb', line 111 def id @id end |
#media ⇒ Object
Returns the value of attribute media.
111 112 113 |
# File 'lib/postproxy/types.rb', line 111 def media @media end |
#platforms ⇒ Object
Returns the value of attribute platforms.
111 112 113 |
# File 'lib/postproxy/types.rb', line 111 def platforms @platforms end |
#scheduled_at ⇒ Object
Returns the value of attribute scheduled_at.
111 112 113 |
# File 'lib/postproxy/types.rb', line 111 def scheduled_at @scheduled_at end |
#status ⇒ Object
Returns the value of attribute status.
111 112 113 |
# File 'lib/postproxy/types.rb', line 111 def status @status end |
#thread ⇒ Object
Returns the value of attribute thread.
111 112 113 |
# File 'lib/postproxy/types.rb', line 111 def thread @thread end |