Skip to content

Commit

Permalink
Fix uri encoding (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
radkomih authored Oct 1, 2020
1 parent d4cbcc5 commit 1c9e847
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
football_api (0.1.4)
football_api (0.1.5)

GEM
remote: https://rubygems.org/
Expand Down
1 change: 1 addition & 0 deletions lib/football_api/base_resource.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ def fetch(ident = nil, **options)
uri = [path, ident].compact.join('/')
query_params = build_params(options)
uri += query_params if query_params
uri = URI.encode(uri)
format_result(get(uri))
end

Expand Down
4 changes: 1 addition & 3 deletions lib/football_api/coach.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ def all_by_team(team_id, **options)
end

def search(name, **options)
search_term = URI.encode(name)

fetch("search/#{search_term}", options)
fetch("search/#{name}", options)
end

private
Expand Down
4 changes: 1 addition & 3 deletions lib/football_api/league.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ def all_by_team_and_season(team_id, season, **options)
end

def search(name_or_country, **options)
search_term = URI.encode(name_or_country)

fetch("search/#{search_term}", options)
fetch("search/#{name_or_country}", options)
end

def all_by_country(country, **options)
Expand Down
4 changes: 1 addition & 3 deletions lib/football_api/teams/data.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ def all_by_league(league_id, **options)
end

def search(name_or_country, **options)
search_term = URI.encode(name_or_country)

fetch("search/#{search_term}", options)
fetch("search/#{name_or_country}", options)
end

private
Expand Down

0 comments on commit 1c9e847

Please sign in to comment.