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.



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

#bodyObject

Returns the value of attribute body.



111
112
113
# File 'lib/postproxy/types.rb', line 111

def body
  @body
end

#created_atObject

Returns the value of attribute created_at.



111
112
113
# File 'lib/postproxy/types.rb', line 111

def created_at
  @created_at
end

#idObject

Returns the value of attribute id.



111
112
113
# File 'lib/postproxy/types.rb', line 111

def id
  @id
end

#mediaObject

Returns the value of attribute media.



111
112
113
# File 'lib/postproxy/types.rb', line 111

def media
  @media
end

#platformsObject

Returns the value of attribute platforms.



111
112
113
# File 'lib/postproxy/types.rb', line 111

def platforms
  @platforms
end

#scheduled_atObject

Returns the value of attribute scheduled_at.



111
112
113
# File 'lib/postproxy/types.rb', line 111

def scheduled_at
  @scheduled_at
end

#statusObject

Returns the value of attribute status.



111
112
113
# File 'lib/postproxy/types.rb', line 111

def status
  @status
end

#threadObject

Returns the value of attribute thread.



111
112
113
# File 'lib/postproxy/types.rb', line 111

def thread
  @thread
end