Sha256: 910135ee1344f32c4d5991060842506149e525072d79e1762b1c0aca9fbb2bac
Contents?: true
Size: 1.2 KB
Versions: 3
Compression:
Stored size: 1.2 KB
Contents
module EveOnline class Character attr_reader :options def initialize(options = {}) @options = options end def as_json(*args) { character_id: character_id, character_name: character_name, corporation_id: corporation_id, corporation_name: corporation_name, alliance_id: alliance_id, alliance_name: alliance_name, faction_id: faction_id, faction_name: faction_name } end def character_id @character_id ||= options.fetch('@characterID').to_i end def character_name @character_name ||= options.fetch('@name', nil) || options.fetch('@characterName') end def corporation_id @corporation_id ||= options.fetch('@corporationID').to_i end def corporation_name @corporation_name ||= options.fetch('@corporationName') end def alliance_id @alliance_id ||= options.fetch('@allianceID').to_i end def alliance_name @alliance_name ||= options.fetch('@allianceName') end def faction_id @faction_id ||= options.fetch('@factionID').to_i end def faction_name @faction_name ||= options.fetch('@factionName') end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
eve_online-0.7.0 | lib/eve_online/character.rb |
eve_online-0.6.0 | lib/eve_online/character.rb |
eve_online-0.5.0 | lib/eve_online/character.rb |