Skip to content

Commit

Permalink
Merge pull request #47 from prsauer/matchlist-fix
Browse files Browse the repository at this point in the history
Fix for matchhistory becoming matchlist
  • Loading branch information
nicolaracco committed Nov 3, 2015
2 parents 162e7b4 + 01ff55d commit 8c304f4
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 13 deletions.
6 changes: 3 additions & 3 deletions lib/lol/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ def match
@match_request ||= MatchRequest.new(api_key, region, cache_store)
end

# @return [MatchHistoryRequest]
def match_history
@match_history_request ||= MatchHistoryRequest.new(api_key, region, cache_store)
# @return [MatchListRequest]
def match_list
@match_history_request ||= MatchListRequest.new(api_key, region, cache_store)
end

# @return [StatsRequest]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
module Lol
class MatchHistoryRequest < Request
class MatchListRequest < Request
# Returns the supported API Version
# @return [String] the supported api version
def self.api_version
"v2.2"
end

# Returns match history for a summoner
# Returns match list for a summoner
# @return []
def get summoner_id
perform_request(api_url("matchhistory/#{summoner_id}"))
perform_request(api_url("matchlist/by-summoner/#{summoner_id}"))
end
end
end
2 changes: 1 addition & 1 deletion spec/api_version_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def check_api_version(klass, version)
check_api_version(LeagueRequest, "v2.5")
check_api_version(StaticRequest, "v1.2")
check_api_version(MatchRequest, "v2.2")
check_api_version(MatchHistoryRequest, "v2.2")
check_api_version(MatchListRequest, "v2.2")
check_api_version(StatsRequest, "v1.3")
check_api_version(SummonerRequest, "v1.4")
check_api_version(TeamRequest, "v2.4")
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,24 @@

include Lol

describe MatchHistoryRequest do
describe MatchListRequest do
it "inherits from Request" do
expect(MatchHistoryRequest.ancestors[1]).to eq(Request)
expect(MatchListRequest.ancestors[1]).to eq(Request)
end

let(:request) { MatchHistoryRequest.new("api_key", "euw") }
let(:request) { MatchListRequest.new("api_key", "euw") }

describe "#get" do
subject { request.get(1) }

before { stub_request(request, 'match_history', 'matchhistory/1') }
before { stub_request(request, 'match_list', 'matchlist/by-summoner/1') }

it 'returns an hash' do
expect(subject).to be_a(Hash)
end

it 'fetches matches from the API' do
fixture = load_fixture('match_history', MatchHistoryRequest.api_version)
fixture = load_fixture('match_list', MatchListRequest.api_version)
expect(subject.keys).to match_array fixture.keys
end
end
Expand Down

0 comments on commit 8c304f4

Please sign in to comment.