class EVEApi::Character

Character class

Constants

METHODS

Character methods known to work

Attributes

alliance_id[RW]
alliance_name[RW]
character_id[RW]
client[RW]
corporation_id[RW]
corporation_name[RW]
faction_id[RW]
faction_name[RW]
key_id[RW]
name[RW]
vcode[RW]

Public Class Methods

new(args = {}) click to toggle source
# File lib/eveapi/character.rb, line 16
def initialize(args = {})
  @key_id           = args[:key_id]
  @vcode            = args[:vcode]
  @name             = args[:name]
  @character_id     = args[:character_id]
  @corporation_name = args[:corporation_name]
  @corporation_id   = args[:corporation_id]
  @alliance_id      = args[:alliance_id]
  @alliance_name    = args[:alliance_name]
  @faction_id       = args[:faction_id]
  @faction_name     = args[:faction_name]
end

Private Instance Methods

client_method(method_name) click to toggle source

Converts the {Character} method name to {Client} method name

@param [Symbol] method_name Character method name @return [Symbol] {Client} method name

# File lib/eveapi/character.rb, line 60
def client_method(method_name)
  "char_#{method_name}".to_sym
end
process_args(args = {}) click to toggle source

Process arguments for Client method

@param [Hash] args = {} Client method arguments

# File lib/eveapi/character.rb, line 68
def process_args(args = {})
  args.each_pair do |k, v|
    fail ArgumentError unless client.respond_to?(k)
    client.instance_variable_set("@#{k}".to_sym, v)
  end
end
send_client_method(method_name, args = {}) click to toggle source

Send a method to a {Client} instance

@param [String] method_name Method name @param [Hash] args = {} Method arguments

# File lib/eveapi/character.rb, line 80
def send_client_method(method_name, args = {})
  process_args(args)
  client.send(client_method(method_name))
end