Class: E621ExportDownloader::Models::PostReplacement

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(record) ⇒ PostReplacement

Returns a new instance of PostReplacement.



55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/e621_export_downloader/models/post_replacement.rb', line 55

def initialize(record)
  @record       = T.let(record, T::Hash[String, String])
  @approver_id  = T.let(T.must(record["approver_id"]).empty? ? nil : record["approver_id"].to_i, T.nilable(Integer))
  @created_at   = T.let(DateTime.parse(record["created_at"]), DateTime)
  @creator_id   = T.let(record["creator_id"].to_i, Integer)
  @file_ext     = T.let(T.must(record["file_ext"]), String)
  @file_name    = T.let(T.must(record["file_name"]), String)
  @file_size    = T.let(record["file_size"].to_i, Integer)
  @id           = T.let(record["id"].to_i, Integer)
  @image_height = T.let(record["image_height"].to_i, Integer)
  @image_width  = T.let(record["image_width"].to_i, Integer)
  @md5          = T.let(T.must(record["md5"]), String)
  @post_id      = T.let(record["post_id"].to_i, Integer)
  @reason       = T.let(T.must(record["reason"]), String)
  @source       = T.let(T.must(record["source"]).empty? ? nil : record["source"], T.nilable(String))
  @status       = T.let(T.must(record["status"]), String)
  @updated_at   = T.let(DateTime.parse(record["updated_at"]), DateTime)
end

Instance Attribute Details

#approver_idObject (readonly)

Returns the value of attribute approver_id.



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

def approver_id
  @approver_id
end

#created_atObject (readonly)

Returns the value of attribute created_at.



13
14
15
# File 'lib/e621_export_downloader/models/post_replacement.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/post_replacement.rb', line 16

def creator_id
  @creator_id
end

#file_extObject (readonly)

Returns the value of attribute file_ext.



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

def file_ext
  @file_ext
end

#file_nameObject (readonly)

Returns the value of attribute file_name.



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

def file_name
  @file_name
end

#file_sizeObject (readonly)

Returns the value of attribute file_size.



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

def file_size
  @file_size
end

#idObject (readonly)

Returns the value of attribute id.



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

def id
  @id
end

#image_heightObject (readonly)

Returns the value of attribute image_height.



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

def image_height
  @image_height
end

#image_widthObject (readonly)

Returns the value of attribute image_width.



34
35
36
# File 'lib/e621_export_downloader/models/post_replacement.rb', line 34

def image_width
  @image_width
end

#md5Object (readonly)

Returns the value of attribute md5.



37
38
39
# File 'lib/e621_export_downloader/models/post_replacement.rb', line 37

def md5
  @md5
end

#post_idObject (readonly)

Returns the value of attribute post_id.



40
41
42
# File 'lib/e621_export_downloader/models/post_replacement.rb', line 40

def post_id
  @post_id
end

#reasonObject (readonly)

Returns the value of attribute reason.



43
44
45
# File 'lib/e621_export_downloader/models/post_replacement.rb', line 43

def reason
  @reason
end

#sourceObject (readonly)

Returns the value of attribute source.



46
47
48
# File 'lib/e621_export_downloader/models/post_replacement.rb', line 46

def source
  @source
end

#statusObject (readonly)

Returns the value of attribute status.



49
50
51
# File 'lib/e621_export_downloader/models/post_replacement.rb', line 49

def status
  @status
end

#updated_atObject (readonly)

Returns the value of attribute updated_at.



52
53
54
# File 'lib/e621_export_downloader/models/post_replacement.rb', line 52

def updated_at
  @updated_at
end

Instance Method Details

#to_json(*_args) ⇒ Object



75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# File 'lib/e621_export_downloader/models/post_replacement.rb', line 75

def to_json(*_args)
  {
    approver_id:  @approver_id,
    created_at:   @created_at,
    creator_id:   @creator_id,
    file_ext:     @file_ext,
    file_name:    @file_name,
    file_size:    @file_size,
    id:           @id,
    image_height: @image_height,
    image_width:  @image_width,
    md5:          @md5,
    post_id:      @post_id,
    reason:       @reason,
    source:       @source,
    status:       @status,
    updated_at:   @updated_at,
  }.to_json
end