Move api related modules to api dir
This commit is contained in:
parent
df34d7b8c5
commit
7ebcab23ea
@ -1,5 +1,5 @@
|
||||
defmodule Scrapper.Data.Model.Match.Info do
|
||||
alias Scrapper.Data.Model.Match.Participant
|
||||
defmodule Scrapper.Data.Api.Model.Match.Info do
|
||||
alias Scrapper.Data.Api.Model.Match.Participant
|
||||
|
||||
defstruct endOfGameResult: "",
|
||||
gameCreation: "",
|
@ -0,0 +1,6 @@
|
||||
defmodule Scrapper.Data.Api.Model.Match.MatchResponse do
|
||||
alias Scrapper.Data.Api.Model.Match.{Info, Metadata}
|
||||
|
||||
defstruct metadata: %Metadata{},
|
||||
info: %Info{}
|
||||
end
|
@ -1,3 +1,3 @@
|
||||
defmodule Scrapper.Data.Model.Match.Metadata do
|
||||
defmodule Scrapper.Data.Api.Model.Match.Metadata do
|
||||
defstruct [:dataVersion, :matchId, :participants]
|
||||
end
|
@ -1,4 +1,4 @@
|
||||
defmodule Scrapper.Data.Model.Match.Participant do
|
||||
defmodule Scrapper.Data.Api.Model.Match.Participant do
|
||||
# Enum.map(participant, fn {k,_v} -> ":#{k}" end) |> Enum.join(", ")
|
||||
defstruct [
|
||||
:onMyWayPings,
|
@ -1,4 +1,4 @@
|
||||
defmodule Scrapper.Data.MatchApi do
|
||||
defmodule Scrapper.Data.Api.MatchApi do
|
||||
@match_base_endpoint "https://europe.api.riotgames.com/lol/match/v5/matches/%{matchid}"
|
||||
@puuid_matches_base_endpoint "https://europe.api.riotgames.com/lol/match/v5/matches/by-puuid/%{puuid}/ids"
|
||||
|
||||
@ -18,7 +18,7 @@ defmodule Scrapper.Data.MatchApi do
|
||||
200 ->
|
||||
# process the response here
|
||||
response.body
|
||||
Poison.decode!(response.body, as: %Scrapper.Data.Model.Match.MatchResponse{})
|
||||
Poison.decode!(response.body, as: %Scrapper.Data.Api.Model.Match.MatchResponse{})
|
||||
|
||||
_ ->
|
||||
# handle error responses
|
@ -1,7 +0,0 @@
|
||||
defmodule Scrapper.Data.Model.Match.MatchResponse do
|
||||
alias Scrapper.Data.Model.Match.Info
|
||||
alias Scrapper.Data.Model.Match.Metadata
|
||||
|
||||
defstruct metadata: %Metadata{},
|
||||
info: %Info{}
|
||||
end
|
Loading…
x
Reference in New Issue
Block a user