Class: Factorix::API::Image

Inherits:
Data
  • Object
show all
Defined in:
lib/factorix/api/image.rb,
lib/factorix/api/image.rb,
sig/factorix/api/image.rbs

Overview

Image object from MOD Portal API

Represents a MOD screenshot or image

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id:, thumbnail:, url:) ⇒ Image

Create Image from API response hash

Parameters:

  • id (String) —

    image ID

  • thumbnail (String) —

    thumbnail URL

  • url (String) —

    full-size image URL

  • id: (String)
  • thumbnail: (String)
  • url: (String)


28
29
30
31
32
# File 'lib/factorix/api/image.rb', line 28

def initialize(id:, thumbnail:, url:)
  thumbnail = URI(thumbnail)
  url = URI(url)
  super
end

Instance Attribute Details

#id ⇒ String (readonly)

Returns image ID.

Returns:

  • (String) —

    image ID



15
16
17
# File 'lib/factorix/api/image.rb', line 15

def id
  @id
end

#thumbnail ⇒ URI::HTTPS (readonly)

Returns thumbnail URL.

Returns:

  • (URI::HTTPS) —

    thumbnail URL



15
16
17
# File 'lib/factorix/api/image.rb', line 15

def thumbnail
  @thumbnail
end

#url ⇒ URI::HTTPS (readonly)

Returns full-size image URL.

Returns:

  • (URI::HTTPS) —

    full-size image URL



15
16
17
# File 'lib/factorix/api/image.rb', line 15

def url
  @url
end