Class: Adam::Image

Inherits:
Object
  • Object
show all
Defined in:
lib/adam/image.rb

Constant Summary collapse

@@character_portrait_uri =
"http://image.eveonline.com/Character/"
@@corporation_logo_uri =
"http://image.eveonline.com/Corporation/"
@@alliance_logo_uri =
"http://image.eveonline.com/Alliance/"

Class Method Summary collapse

Class Method Details

.alliance_logo(options = {}) ⇒ Object

Retrieves a alliance logo.

Parameters:

  • options - A hash with these keys:

    • id - An integer describing an EVE Online character id.

    • size - An integer describing what size to retrieve. Valid sizes are 32, 64 or 128.

Raises:

  • (ArgumentError)


48
49
50
51
52
53
54
55
# File 'lib/adam/image.rb', line 48

def self.(options = {})
  id    = options.fetch(:id)
  size  = options.fetch(:size)
  
  raise ArgumentError, "Valid sizes are 32, 64 or 128" unless [32, 64, 128].include?(size)
  
  request(@@alliance_logo_uri + "#{id}_#{size}.png")
end

.character_portrait(options = {}) ⇒ Object

Retrieves a character portrait.

Parameters:

  • options - A hash with these keys:

    • id - An integer describing an EVE Online character id.

    • size - An integer describing what size to retrieve. Valid sizes are 32, 64, 128 or 256.

Raises:

  • (ArgumentError)


18
19
20
21
22
23
24
25
# File 'lib/adam/image.rb', line 18

def self.character_portrait(options = {})
  id    = options.fetch(:id)
  size  = options.fetch(:size)
  
  raise ArgumentError, "Valid sizes are 32, 64, 128 or 256" unless [32, 64, 128, 256].include?(size)
  
  request(@@character_portrait_uri + "#{id}_#{size}.jpg")
end

.corporation_logo(options = {}) ⇒ Object

Retrieves a corporation logo.

Parameters:

  • options - A hash with these keys:

    • id - An integer describing an EVE Online character id.

    • size - An integer describing what size to retrieve. Valid sizes are 32, 64, 128 or 256.

Raises:

  • (ArgumentError)


33
34
35
36
37
38
39
40
# File 'lib/adam/image.rb', line 33

def self.(options = {})
  id    = options.fetch(:id)
  size  = options.fetch(:size)
  
  raise ArgumentError, "Valid sizes are 32, 64, 128 or 256" unless [32, 64, 128, 256].include?(size)
  
  request(@@corporation_logo_uri + "#{id}_#{size}.png")
end