Class: Fme::Api::Request

Inherits:
Object
  • Object
show all
Includes:
ActiveAttr::Model
Defined in:
lib/fme/api/request.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#debugObject

Returns the value of attribute debug.



7
8
9
# File 'lib/fme/api/request.rb', line 7

def debug
  @debug
end

#hostObject

Returns the value of attribute host.



7
8
9
# File 'lib/fme/api/request.rb', line 7

def host
  @host
end

#jwtObject

Returns the value of attribute jwt.



7
8
9
# File 'lib/fme/api/request.rb', line 7

def jwt
  @jwt
end

Class Method Details

.protocolObject



9
10
11
12
13
14
15
# File 'lib/fme/api/request.rb', line 9

def self.protocol
  if Rails.env.development?
    'http://'
  else
    'https://'
  end
end

Instance Method Details

#healthy?Boolean

Returns:

  • (Boolean)


28
29
30
# File 'lib/fme/api/request.rb', line 28

def healthy?
  connection.get(service_url('/okcomputer/all.json')).body.dig('default', 'success')
end

#http_cache_optionsObject



17
18
19
20
21
22
23
24
25
26
# File 'lib/fme/api/request.rb', line 17

def http_cache_options
  http_cache_options = {
    shared_cache: false,
    store: Rails.cache
  }
  if debug
    http_cache_options[:logger] = Rails.logger
  end
  http_cache_options
end