Class: E621ExportDownloader::Models::WikiPage

Inherits:
Object
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/e621_export_downloader/models/wiki_page.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(record) ⇒ WikiPage

Returns a new instance of WikiPage.



34
35
36
37
38
39
40
41
42
43
44
# File 'lib/e621_export_downloader/models/wiki_page.rb', line 34

def initialize(record)
  @record = T.let(record, T::Hash[String, String])
  @body = T.let(T.must(record["body"]).gsub("\r\n", "\n"), String)
  @created_at = T.let(DateTime.parse(record["created_at"]), DateTime)
  @creator_id = T.let(T.must(record["creator_id"]).empty? ? nil : record["creator_id"].to_i, T.nilable(Integer))
  @id = T.let(record["id"].to_i, Integer)
  @is_locked = T.let(record["is_locked"] == "t", T::Boolean)
  @title = T.let(T.must(record["title"]), String)
  @updated_at = T.let(T.must(record["updated_at"]).empty? ? nil : DateTime.parse(record["updated_at"]), T.nilable(DateTime))
  @uploader_id = T.let(T.must(record["uploader_id"]).empty? ? nil : record["uploader_id"].to_i, T.nilable(Integer))
end

Instance Attribute Details

#bodyObject (readonly)

Returns the value of attribute body.



10
11
12
# File 'lib/e621_export_downloader/models/wiki_page.rb', line 10

def body
  @body
end

#created_atObject (readonly)

Returns the value of attribute created_at.



13
14
15
# File 'lib/e621_export_downloader/models/wiki_page.rb', line 13

def created_at
  @created_at
end

#creator_idObject (readonly)

Returns the value of attribute creator_id.



16
17
18
# File 'lib/e621_export_downloader/models/wiki_page.rb', line 16

def creator_id
  @creator_id
end

#idObject (readonly)

Returns the value of attribute id.



19
20
21
# File 'lib/e621_export_downloader/models/wiki_page.rb', line 19

def id
  @id
end

#is_lockedObject (readonly)

Returns the value of attribute is_locked.



22
23
24
# File 'lib/e621_export_downloader/models/wiki_page.rb', line 22

def is_locked
  @is_locked
end

#titleObject (readonly)

Returns the value of attribute title.



25
26
27
# File 'lib/e621_export_downloader/models/wiki_page.rb', line 25

def title
  @title
end

#updated_atObject (readonly)

Returns the value of attribute updated_at.



28
29
30
# File 'lib/e621_export_downloader/models/wiki_page.rb', line 28

def updated_at
  @updated_at
end

#uploader_idObject (readonly)

Returns the value of attribute uploader_id.



31
32
33
# File 'lib/e621_export_downloader/models/wiki_page.rb', line 31

def uploader_id
  @uploader_id
end

Instance Method Details

#to_json(*_args) ⇒ Object



47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/e621_export_downloader/models/wiki_page.rb', line 47

def to_json(*_args)
  {
    body:        @body,
    created_at:  @created_at,
    creator_id:  @creator_id,
    id:          @id,
    is_locked:   @is_locked,
    title:       @title,
    updated_at:  @updated_at,
    uploader_id: @uploader_id,
  }.to_json
end