Class: MetaNexus::Sc2::Profile

Inherits:
MetaNexus::Sc2 show all
Defined in:
lib/meta_nexus/sc2/profile.rb

Class Method Summary collapse

Methods inherited from MetaNexus::Sc2

client, #url

Methods inherited from Api

call_api, #url

Class Method Details

.ladders(id, region, name) ⇒ Object



39
40
41
42
# File 'lib/meta_nexus/sc2/profile.rb', line 39

def self.ladders(id, region, name)
  call_url = "#{client.url}/profile/#{id}/#{region}/#{name}/ladders?locale=#{MetaNexus.config.locale}&apikey=#{MetaNexus.config.api_key}"
  MetaNexus::Api.call_api(call_url)
end

.match_history(id, region, name) ⇒ Object



44
45
46
47
# File 'lib/meta_nexus/sc2/profile.rb', line 44

def self.match_history(id, region, name)
  call_url = "#{client.url}/profile/#{id}/#{region}/#{name}/matches?locale=#{MetaNexus.config.locale}&apikey=#{MetaNexus.config.api_key}"
  MetaNexus::Api.call_api(call_url)
end

.profile(id, region, name) ⇒ Object

Find Sc2 Profile in Battle.net StarCraft 2 Api Required arguments: id - User profile id region - User profile region id name - User profile name

Example:

sc2 = MetaNexus::Sc2::Profile.new('eu', 'ru_RU', 'api_key')
sc2.profile(10886, 2, 'out')

Response in Hash:

{"id"=>10886, "realm"=>2, "displayName"=>"out", "clanName"=>"TopolM", "clanTag"=>"SS27", "profilePath"=>"/profile/10886/2/out/", "portrait"=>{"x"=>-270, "y"=>-270, "w"=>90, "h"=>90, "offset"=>21, ...

Find Sc2 profile ladders in Battle.net StarCraft 2 Api Required arguments: same as for profile

Example:

Sc2 = MetaNexus::Sc2::Profile
sc2.ladders(10886, 2, 'out')

Resonse in Hash: {“currentSeason”=>[], “previousSeason”=>[], “showcasePlacement”=>[]}

Find Sc2 profile match history in Battle.net Diablo 3 Api Required arguments: same as for profile

Example:

Sc2 = MetaNexus::Sc2::Profile
sc2.match_history(10886, 2, 'out')

Resonse in Hash: {“matches”=>[{“map”=>“Исследовательский комплекс”, “type”=>“THREES”, “decision”=>“WIN”, “speed”=>“FASTER”, …



34
35
36
37
# File 'lib/meta_nexus/sc2/profile.rb', line 34

def self.profile(id, region, name)
  call_url = "#{client.url}/profile/#{id}/#{region}/#{name}/?locale=#{MetaNexus.config.locale}&apikey=#{MetaNexus.config.api_key}"
  MetaNexus::Api.call_api(call_url)
end