Skip to content
This repository was archived by the owner on Apr 9, 2024. It is now read-only.

Commit f19aeba

Browse files
committed
Made api keys required and added support for the news aes endpoint.
1 parent 06f7941 commit f19aeba

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

lib/fortniteapi/api.rb

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,14 @@ class FortniteAPI
77
CreativeNews = Struct.new(:image, :hidden, :messageType, :type, :adspace, :spotlight, :title, :body)
88
ShopItem = Struct.new(:regularPrice, :finalPrice, :isBundle, :giftable, :refundable, :panel, :sortPriority, :banner, :items)
99
CreatorCode = Struct.new(:id, :slug, :displayName, :status, :verified)
10+
AES = Struct.new(:aes, :build, :lastUpdate)
1011

1112
def initialize(apikey=nil)
1213
@apikey = apikey
1314
@headers = {"x-api-key" => @apikey}
1415

1516
if apikey == nil
16-
puts 'Warning: Next monday (Dec. 9th) at 8 PM (UTC) every endpoint will require an API-Key, you can get one at: fortnite-api.com.'
17+
raise 'Not API key provided, this is now required. You can get one at: fortnite-api.com.'
1718
end
1819
end
1920

@@ -146,4 +147,11 @@ def get_br_store(language='en')
146147
br_store = [featured_items, daily_items]
147148
br_store
148149
end
150+
151+
def get_aes()
152+
response = HTTParty.get("https://fortnite-api.com/aes", :headers => @headers)
153+
data = JSON.parse(response.body)['data']
154+
aes = AES.new(data['aes'], data['build'], x['lastUpdate'])
155+
aes
156+
end
149157
end

0 commit comments

Comments
 (0)