Class: Atatus::Config::ServerInfo Private
- Inherits:
-
Object
- Object
- Atatus::Config::ServerInfo
- Defined in:
- lib/atatus/config/server_info.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Constant Summary collapse
- VERSION_8_0 =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
'8.0'
- VERSION_0 =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
'0'
Instance Attribute Summary collapse
- #config ⇒ Object readonly private
- #http ⇒ Object readonly private
- #payload ⇒ Object readonly private
Instance Method Summary collapse
- #execute ⇒ Object private
-
#initialize(config) ⇒ ServerInfo
constructor
private
A new instance of ServerInfo.
- #version ⇒ Object private
Constructor Details
#initialize(config) ⇒ ServerInfo
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of ServerInfo.
29 30 31 32 |
# File 'lib/atatus/config/server_info.rb', line 29 def initialize(config) @config = config @http = Transport::Connection::Http.new(config) end |
Instance Attribute Details
#config ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
24 25 26 |
# File 'lib/atatus/config/server_info.rb', line 24 def config @config end |
#http ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
24 25 26 |
# File 'lib/atatus/config/server_info.rb', line 24 def http @http end |
#payload ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
24 25 26 |
# File 'lib/atatus/config/server_info.rb', line 24 def payload @payload end |
Instance Method Details
#execute ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
34 35 36 37 38 39 |
# File 'lib/atatus/config/server_info.rb', line 34 def execute resp = http.get(config.server_url) @payload = JSON.parse(resp.body) rescue @payload = { "version" => VERSION_0 } end |
#version ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
41 42 43 44 45 46 |
# File 'lib/atatus/config/server_info.rb', line 41 def version @version ||= begin execute payload["version"] ? payload["version"].to_s : VERSION_0 end end |