Class: Nexus::Invision::Resources::Topic

Inherits:
T::Struct
  • Object
show all
Extended by:
T::Sig
Includes:
ValueObject
Defined in:
lib/nexus/invision/resources/topic.rb

Class Method Summary collapse

Methods included from ValueObject

#class, #eql?, #serialize

Class Method Details

.from_response(response) ⇒ Object



39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/nexus/invision/resources/topic.rb', line 39

def from_response(response)
  Resources::Topic.new(
    id: response["id"],
    title: response["title"],
    first_post: response["firstPost"]&.then do |fp|
      Resources::Post.from_response(fp)
    end,
    last_post: response["lastPost"]&.then do |lp|
      Resources::Post.from_response(lp)
    end,
  )
end