class WeebSh::WeebImage

Represents an image for toph

Attributes

account[R]

@return [String] the ID of the uploader

author[R]

@return [String] the ID of the uploader

hidden[R]

@return [true, false] whether or not this image can only be seen by the uploader

hidden?[R]

@return [true, false] whether or not this image can only be seen by the uploader

mime_type[R]

@return [String] the mime type of the image

nsfw[R]

@return [true, false] whether or not this image is nsfw

nsfw?[R]

@return [true, false] whether or not this image is nsfw

source[R]

@return [String, nil] the source of the image

tags[R]

@return [Array<String>] the tags on image

uploader[R]

@return [String] the ID of the uploader

Public Class Methods

new(data, interface) click to toggle source

@!visibility private

# File lib/weeb/data.rb, line 104
def initialize(data, interface)
  @interface = interface
  @id = data['id']
  @type = data['type']
  @nsfw = data['nsfw']
  @file_type = data['fileType']
  @mime_type = data['mimeType']
  @url = data['url']
  @hidden = data['hidden']
  @file_type = data['fileType']
  @source = data['source'] || nil
  @account = data['account']
  @tags = data['tags'].map { |r| Tag.new(r, interface) }
end

Public Instance Methods

add_tag(tag) click to toggle source

Add a tag to the image @param tag [String, Tag] the affected tag

# File lib/weeb/data.rb, line 133
def add_tag(tag)
  @interface.add_tags_to_image(self, [tag])
end
add_tags(tags) click to toggle source

Add tags to the image @param tags [Array<String, Tag>] the affected tags

# File lib/weeb/data.rb, line 121
def add_tags(tags)
  @interface.add_tags_to_image(self, tags)
end
delete() click to toggle source

Delete this image

# File lib/weeb/data.rb, line 144
def delete
  @interface.delete_image(self)
end
Also aliased as: remove
inspect() click to toggle source

@!visibility private

# File lib/weeb/data.rb, line 150
def inspect
  "#<WeebSh::WeebImage @url=#{@url.inspect} @type=#{@type.inspect} @nsfw=#{@nsfw.inspect}>"
end
remove()
Alias for: delete
remove_tag(tag) click to toggle source

Remove a tag to the image @param tag [String, Tag] the affected tag

# File lib/weeb/data.rb, line 139
def remove_tag(tag)
  @interface.remove_tags_to_image(self, [tag])
end
remove_tags(tags) click to toggle source

Remove tags from the image @param tags [Array<String, Tag>] the affected tags

# File lib/weeb/data.rb, line 127
def remove_tags(tags)
  @interface.remove_tags_to_image(self, tags)
end