| 1 |
module Plugin::Mastodon |
| 2 |
|
| 3 |
class Card < Diva::Model |
| 4 |
register :mastodon_card, name: Plugin[:mastodon]._('Mastodonカード') |
| 5 |
|
| 6 |
field.uri :url, required: true |
| 7 |
field.string :title, required: true |
| 8 |
field.string :description, required: true |
| 9 |
field.uri :image |
| 10 |
field.string :type, required: true |
| 11 |
field.string :author_name |
| 12 |
field.uri :author_url |
| 13 |
field.string :provider_name |
| 14 |
field.uri :provider_url |
| 15 |
field.string :html |
| 16 |
field.int :width |
| 17 |
field.int :height |
| 18 |
|
| 19 |
def path |
| 20 |
"/#{CGI.escape(url)}" |
| 21 |
end |
| 22 |
|
| 23 |
def inspect |
| 24 |
"mastodon-card(#{name})" |
| 25 |
end |
| 26 |
end |
| 27 |
end |