mirror of
https://github.com/cyberarm/w3d_hub_linux_launcher.git
synced 2025-12-16 09:12:35 +00:00
Games page back to semi-functional; games are out of order however
This commit is contained in:
@@ -28,8 +28,8 @@ class W3DHub
|
||||
@studio_id = @data[:"studio-id"]
|
||||
|
||||
# TODO: Do processing
|
||||
@channels = @data[:channels]
|
||||
@web_links = @data[:"web-links"]
|
||||
@channels = @data[:channels].map { |channel| Channel.new(channel) }
|
||||
@web_links = @data[:"web-links"]&.map { |link| WebLink.new(link) } || []
|
||||
@extended_data = @data[:"extended-data"]
|
||||
|
||||
color = @data[:"extended-data"].find { |h| h[:name] == "colour" }[:value].sub("#", "")
|
||||
@@ -38,6 +38,8 @@ class W3DHub
|
||||
end
|
||||
|
||||
class Channel
|
||||
attr_reader :id, :name, :user_level, :current_version
|
||||
|
||||
def initialize(hash)
|
||||
@data = hash
|
||||
|
||||
|
||||
32
lib/api/news.rb
Normal file
32
lib/api/news.rb
Normal file
@@ -0,0 +1,32 @@
|
||||
class W3DHub
|
||||
class Api
|
||||
class News
|
||||
attr_reader :items
|
||||
|
||||
def initialize(response)
|
||||
@data = JSON.parse(response, symbolize_names: true)
|
||||
|
||||
@items = @data[:news].map { |item| Item.new(item) }
|
||||
end
|
||||
|
||||
class Item
|
||||
attr_reader :topic_id, :title, :blurb, :image, :uri, :author, :author_uri, :timestamp, :date, :time
|
||||
|
||||
def initialize(hash)
|
||||
@data = hash
|
||||
|
||||
@topic_id = Integer(@data[:"topic-id"])
|
||||
@title = @data[:title]
|
||||
@blurb = @data[:blurb]
|
||||
@image = @data[:image].strip
|
||||
@uri = @data[:uri].strip
|
||||
@author = @data[:author]
|
||||
@author_uri = @data[:"author-uri"].strip
|
||||
@timestamp = Time.at(Integer(@data[:timestamp]))
|
||||
@date = @data[:date]
|
||||
@time = @data[:time]
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user