Sha256: 8d0a58a633ed3b39f0d9f76092d86e69880b6872708eae7bb0645680cfc554af
Contents?: true
Size: 1.37 KB
Versions: 1
Compression:
Stored size: 1.37 KB
Contents
module EveOnline class Event attr_reader :options def initialize(options = {}) @options = options end def as_json(*args) { event_id: event_id, owner_id: owner_id, owner_name: owner_name, event_date: event_date, event_title: event_title, duration: duration, importance: importance, response: response, event_text: event_text, owner_type_id: owner_type_id } end def event_id @event_id ||= options.fetch('@eventID').to_i end def owner_id @owner_id ||= options.fetch('@ownerID').to_i end def owner_name @owner_name ||= options.fetch('@ownerName') end def event_date @event_date ||= \ ActiveSupport::TimeZone['UTC'].parse(options.fetch('@eventDate')) end def event_title @event_title ||= options.fetch('@eventTitle') end def duration @duration ||= options.fetch('@duration').to_i end def importance @importance ||= options.fetch('@importance').eql?('1') end def response # TODO: convert to symbol. e.g. "Undecided" => :undecided @response ||= options.fetch('@response') end def event_text @event_text ||= options.fetch('@eventText') end def owner_type_id @owner_type_id ||= options.fetch('@ownerTypeID').to_i end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
eve_online-0.5.0 | lib/eve_online/event.rb |