Class: Lol::LolStatusRequest

Inherits:
Request
  • Object
show all
Defined in:
lib/lol/lol_status_request.rb

Instance Attribute Summary

Attributes inherited from Request

#api_key, #cache_store, #region

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Request

#api_base_url, #api_query_string, #cached?, #clean_url, #perform_request, #post_api_url, #store, #ttl

Constructor Details

#initialize(region = nil, cache_store = {}) ⇒ LolStatusRequest

Returns a new instance of LolStatusRequest.



8
9
10
# File 'lib/lol/lol_status_request.rb', line 8

def initialize region = nil, cache_store = {}
  super nil, region, cache_store
end

Class Method Details

.api_versionObject



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

def self.api_version
  "v1.0"
end

Instance Method Details

#api_url(path, params = {}) ⇒ Object



28
29
30
31
32
# File 'lib/lol/lol_status_request.rb', line 28

def api_url path, params = {}
  "http://status.leagueoflegends.com/#{path}".tap do |url|
    url << "/#{params}" unless params.empty?
  end
end

#current_shardDynamicModel

Returns a detailed status of the current shard

Returns:



23
24
25
26
# File 'lib/lol/lol_status_request.rb', line 23

def current_shard
  shard_data = perform_request(api_url('shards', region))
  DynamicModel.new shard_data
end

#shardsArray

Returns a list of each shard status This special call works against all regions

Returns:

  • (Array)

    an array of DynamicModel representing the response



15
16
17
18
19
# File 'lib/lol/lol_status_request.rb', line 15

def shards
  perform_request(api_url('shards')).map do |shard_data|
    DynamicModel.new shard_data
  end
end