Class: EveCrest::BaseResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/base_response.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(json) ⇒ BaseResponse



4
5
6
# File 'lib/base_response.rb', line 4

def initialize(json)
  @data = json
end

Instance Attribute Details

#dataObject

Returns the value of attribute data.



3
4
5
# File 'lib/base_response.rb', line 3

def data
  @data
end

Instance Method Details

#cached_untilObject



20
21
22
# File 'lib/base_response.rb', line 20

def cached_until
  DateTime.strptime(data['cachedUntil'], '%Y-%m-%d %H:%M:%S')
end

#error_messageObject



13
14
15
16
17
18
19
# File 'lib/base_response.rb', line 13

def error_message
  if success?
    nil
  else
    data['exceptionType']
  end
end

#rawObject



10
11
12
# File 'lib/base_response.rb', line 10

def raw
  data
end

#success?Boolean



7
8
9
# File 'lib/base_response.rb', line 7

def success?
  !data.has_key?('exceptionType')
end