Class: PostProxy::Post

Inherits:
Model
  • Object
show all
Defined in:
lib/postproxy/types.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Model

#to_h

Constructor Details

#initialize(**attrs) ⇒ Post

Returns a new instance of Post.



137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
# File 'lib/postproxy/types.rb', line 137

def initialize(**attrs)
  @scheduled_at = nil
  @media = []
  @platforms = []
  @thread = []
  @queue_id = nil
  @queue_priority = nil
  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

#bodyObject

Returns the value of attribute body.



134
135
136
# File 'lib/postproxy/types.rb', line 134

def body
  @body
end

#created_atObject

Returns the value of attribute created_at.



134
135
136
# File 'lib/postproxy/types.rb', line 134

def created_at
  @created_at
end

#idObject

Returns the value of attribute id.



134
135
136
# File 'lib/postproxy/types.rb', line 134

def id
  @id
end

#mediaObject

Returns the value of attribute media.



134
135
136
# File 'lib/postproxy/types.rb', line 134

def media
  @media
end

#platformsObject

Returns the value of attribute platforms.



134
135
136
# File 'lib/postproxy/types.rb', line 134

def platforms
  @platforms
end

#queue_idObject

Returns the value of attribute queue_id.



134
135
136
# File 'lib/postproxy/types.rb', line 134

def queue_id
  @queue_id
end

#queue_priorityObject

Returns the value of attribute queue_priority.



134
135
136
# File 'lib/postproxy/types.rb', line 134

def queue_priority
  @queue_priority
end

#scheduled_atObject

Returns the value of attribute scheduled_at.



134
135
136
# File 'lib/postproxy/types.rb', line 134

def scheduled_at
  @scheduled_at
end

#statusObject

Returns the value of attribute status.



134
135
136
# File 'lib/postproxy/types.rb', line 134

def status
  @status
end

#threadObject

Returns the value of attribute thread.



134
135
136
# File 'lib/postproxy/types.rb', line 134

def thread
  @thread
end