class Eve::Trust::IgbInterface

Attributes

request[R]

Public Class Methods

new(request) click to toggle source
# File lib/eve/trust/igb_interface.rb, line 7
def initialize(request)
  @request = request
end

Public Instance Methods

alliance_id() click to toggle source
# File lib/eve/trust/igb_interface.rb, line 37
def alliance_id; igb_variable_get(:alliance_id); end
alliance_name() click to toggle source
# File lib/eve/trust/igb_interface.rb, line 36
def alliance_name; igb_variable_get(:alliance_name); end
char_id() click to toggle source
# File lib/eve/trust/igb_interface.rb, line 33
def char_id; igb_variable_get(:char_id); end
char_name() click to toggle source
# File lib/eve/trust/igb_interface.rb, line 32
def char_name; igb_variable_get(:char_name); end
constellation_id() click to toggle source

The IGB does not yet supply the proper headers for this method, so it will always return nil. However, if CCP implements it as written, this method should magically start working.

# File lib/eve/trust/igb_interface.rb, line 56
def constellation_id; igb_variable_get(:constellation_id, "The IGB does not yet supply :constellation_id headers, so this will always be nil"); end
constellation_name() click to toggle source
# File lib/eve/trust/igb_interface.rb, line 39
def constellation_name; igb_variable_get(:constellation_name); end
corp_id() click to toggle source
# File lib/eve/trust/igb_interface.rb, line 35
def corp_id; igb_variable_get(:corp_id); end
corp_name() click to toggle source
# File lib/eve/trust/igb_interface.rb, line 34
def corp_name; igb_variable_get(:corp_name); end
corp_role() click to toggle source
# File lib/eve/trust/igb_interface.rb, line 40
def corp_role; igb_variable_get(:corp_role); end
igb?() click to toggle source
# File lib/eve/trust/igb_interface.rb, line 15
def igb?
  request.user_agent && (request.user_agent[/eve\-minibrowser/i] || request.user_agent[/EVE\-IGB/])
end
militia_id() click to toggle source

The IGB does not yet supply the proper headers for this method, so it will always return nil. However, if CCP implements it as written, this method should magically start working.

# File lib/eve/trust/igb_interface.rb, line 50
def militia_id; igb_variable_get(:militia_id, "The IGB does not yet supply :militia_id headers, so this will always be nil"); end
militia_name() click to toggle source

The IGB does not yet supply the proper headers for this method, so it will always return nil. However, if CCP implements it as written, this method should magically start working.

# File lib/eve/trust/igb_interface.rb, line 47
def militia_name; igb_variable_get(:militia_name, "The IGB does not yet supply :militia_name headers, so this will always be nil"); end
nearest_location() click to toggle source

Removed from Dominion, so always returns nil

# File lib/eve/trust/igb_interface.rb, line 68
def nearest_location
  igb_variable_get('nearest_location',
        "The nearest_location headers have been removed from the IGB as of Dominion, so this always returns nil.")
end
region_id() click to toggle source

The IGB does not yet supply the proper headers for this method, so it will always return nil. However, if CCP implements it as written, this method should magically start working.

# File lib/eve/trust/igb_interface.rb, line 53
def region_id; igb_variable_get(:region_id, "The IGB does not yet supply :region_id headers, so this will always be nil"); end
region_name() click to toggle source
# File lib/eve/trust/igb_interface.rb, line 38
def region_name; igb_variable_get(:region_name); end
server_ip() click to toggle source
# File lib/eve/trust/igb_interface.rb, line 31
def server_ip; igb_variable_get(:server_ip); end
ship_id() click to toggle source

The IGB does not yet supply the proper headers for this method, so it will always return nil. However, if CCP implements it as written, this method should magically start working.

# File lib/eve/trust/igb_interface.rb, line 62
def ship_id; igb_variable_get(:ship_id, "The IGB does not yet supply :ship_id headers, so this will always be nil"); end
solar_system_id() click to toggle source

The IGB does not yet supply the proper headers for this method, so it will always return nil. However, if CCP implements it as written, this method should magically start working.

# File lib/eve/trust/igb_interface.rb, line 59
def solar_system_id; igb_variable_get(:solar_system_id, "The IGB does not yet supply :solar_system_id headers, so this will always be nil"); end
solar_system_name() click to toggle source
# File lib/eve/trust/igb_interface.rb, line 43
def solar_system_name; igb_variable_get(:solar_system_name); end
station_id() click to toggle source
# File lib/eve/trust/igb_interface.rb, line 41
def station_id; igb_variable_get(:station_id); end
station_name() click to toggle source
# File lib/eve/trust/igb_interface.rb, line 42
def station_name; igb_variable_get(:station_name); end
system_security() click to toggle source

The IGB does not yet supply the proper headers for this method, so it will always return nil. However, if CCP implements it as written, this method should magically start working.

# File lib/eve/trust/igb_interface.rb, line 65
def system_security; igb_variable_get(:system_security, "The IGB does not yet supply :system_security headers, so this will always be nil"); end
trusted() click to toggle source
# File lib/eve/trust/igb_interface.rb, line 30
def trusted; igb_variable_get(:trusted); end
trusted?() click to toggle source
# File lib/eve/trust/igb_interface.rb, line 11
def trusted?
  trusted
end
validation_string() click to toggle source

Validation string (HTTP_EVE_VALIDATION_STRING) is only a wishlist item, and is not actually implemented in the IGB yet. However, if CCP implements it as written, this method should magically start working.

# File lib/eve/trust/igb_interface.rb, line 21
def validation_string
return @validation_string if @validation_string
  @validation_string ||= request.headers['HTTP_EVE_VALIDATION_STRING'] || request.headers['HTTP_EVE_VALIDATIONSTRING']
  unless @validation_string
    warn "Validation string (HTTP_EVE_VALIDATION_STRING) is only a request, and is not implemented yet"
  end
  @validation_string
end

Private Instance Methods

igb_variable_get(method_name, warning = nil) click to toggle source
# File lib/eve/trust/igb_interface.rb, line 79
def igb_variable_get(method_name, warning = nil)
  memoized_igb_variables(method_name)[warning] ||= begin
    return_value = (
      v = headers["HTTP_EVE_#{method_name.to_s.camelize.upcase}"] || nil
      v = (YAML::load(v) rescue v) unless v.nil?
      v
    )
    warn warning if return_value.nil? && warning
    return_value
  end
end
memoized_igb_variables(method_name = nil) click to toggle source
# File lib/eve/trust/igb_interface.rb, line 74
def memoized_igb_variables(method_name = nil)
  @memoized_igb_variables ||= {}
  @memoized_igb_variables[method_name] ||= {}
end