class EVEApi::Alliance

Alliance CREST object

Constants

BASE_URI

CREST alliances endpoint

Attributes

href[RW]
id[RW]
id_str[RW]
info[RW]
name[RW]
short_name[RW]

Public Class Methods

new(args) click to toggle source
# File lib/eveapi/alliance.rb, line 14
def initialize(args)
  case args
  when String, Fixnum
    @id = args.to_i
    @href = BASE_URI + id.to_s + '/'
  when Hash
    @href = args[:href]
    @short_name = args[:short_name]
    @name = args[:name]
    @id = args[:id]
  end
end

Public Instance Methods

corporations() click to toggle source

Show corporations belonging to the Alliance

@return [Array] List of corporations

# File lib/eveapi/alliance.rb, line 37
def corporations
  info[:corporations]
end
find() click to toggle source

Get Alliance from CREST by ID

@return [Alliance] Alliance object

# File lib/eveapi/alliance.rb, line 44
def find
  @short_name = info[:short_name]
  @name = info[:name]
  self
end
to_h() click to toggle source

Converts {Alliance} to {Hash}

@return [Hash] Alliance in {Hash} format

# File lib/eveapi/alliance.rb, line 53
def to_h
  h = {}
  instance_variables.each do |var|
    name = var.to_s.gsub(/^@/, '').to_sym
    value = send name
    h[name] = value
  end
  h
end