File: attachment.rb

package info (click to toggle)
mikutter 5.0.4%2Bdfsg1-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 9,700 kB
  • sloc: ruby: 21,307; sh: 181; makefile: 19
file content (36 lines) | stat: -rw-r--r-- 1,034 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
module Plugin::Mastodon
  class AttachmentMeta < Diva::Model
    #register :mastodon_attachment_meta, name: "Mastodon添付メディア メタ情報(Mastodon)"

    field.int :width
    field.int :height
    field.string :size
    field.string :aspect
  end

  class AttachmentMetaSet < Diva::Model
    #register :mastodon_attachment_meta, name: "Mastodon添付メディア メタ情報セット(Mastodon)"

    field.has :original, AttachmentMeta
    field.has :small, AttachmentMeta
  end

  # https://github.com/tootsuite/documentation/blob/master/Using-the-API/API.md#attachment
  class Attachment < Diva::Model
    #register :mastodon_attachment, name: "Mastodon添付メディア(Mastodon)"

    field.string :id, required: true
    field.string :type, required: true
    field.uri :url
    field.uri :remote_url
    field.uri :preview_url, required: true
    field.uri :text_url
    field.string :description

    field.has :meta, AttachmentMetaSet

    def inspect
      "mastodon-attachment(#{remote_url})"
    end
  end
end