Class: FortniteExperience::Services::FortniteAPI
- Inherits:
-
Object
- Object
- FortniteExperience::Services::FortniteAPI
show all
- Defined in:
- lib/fortnite_experience/services/fortnite_api.rb
Defined Under Namespace
Classes: APIKeyNotValidError, DailyRequestLimitExceededError
Constant Summary
collapse
- BASE_URI =
-'https://fortniteapi.io'
- POI_URI =
-"#{BASE_URI}/game/poi?lang=en"
- WEEKLY_CHALLENGES_URI =
-"#{BASE_URI}/v1/challenges?season=current&lang=en"
Class Method Summary
collapse
Class Method Details
.get_poi_names(api_key) ⇒ Object
14
15
16
17
18
|
# File 'lib/fortnite_experience/services/fortnite_api.rb', line 14
def get_poi_names(api_key)
response = HTTParty.get(POI_URI, headers: { 'Authorization' => api_key })
verify(response)
response.parsed_response['list'].map { |poi| poi['name'] }
end
|
.get_weekly_challenges(api_key) ⇒ Object
20
21
22
23
24
|
# File 'lib/fortnite_experience/services/fortnite_api.rb', line 20
def get_weekly_challenges(api_key)
response = HTTParty.get(WEEKLY_CHALLENGES_URI, headers: { 'Authorization' => api_key })
verify(response)
response.parsed_response['weeks'].values.map { |week| week['challenges'] }.flatten
end
|