mirror of
https://github.com/usetrmnl/trmnl-api.git
synced 2026-04-29 13:35:13 -07:00
Refactored models to reference native Ruby Data objects
Necessary to ensure we reference native Ruby data objects versus the new data objects own by this gem when dealing with JSON Data APIs. Milestone: patch
This commit is contained in:
@@ -4,7 +4,7 @@ module TRMNL
|
||||
module API
|
||||
module Models
|
||||
# Models the data of the API response.
|
||||
CurrentScreen = Data.define :refresh_rate, :image_url, :filename do
|
||||
CurrentScreen = ::Data.define :refresh_rate, :image_url, :filename do
|
||||
def self.for(attributes) = new(**attributes)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -4,7 +4,7 @@ module TRMNL
|
||||
module API
|
||||
module Models
|
||||
# Models the data of the API response.
|
||||
Firmware = Data.define :url, :version do
|
||||
Firmware = ::Data.define :url, :version do
|
||||
def self.for(attributes) = new(**attributes)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -4,7 +4,7 @@ module TRMNL
|
||||
module API
|
||||
module Models
|
||||
# Models the data of the API response.
|
||||
IPAddress = Data.define :version_4, :version_6 do
|
||||
IPAddress = ::Data.define :version_4, :version_6 do
|
||||
def self.for attributes
|
||||
new(**attributes.transform_keys(ipv4: :version_4, ipv6: :version_6))
|
||||
end
|
||||
|
||||
@@ -4,7 +4,7 @@ module TRMNL
|
||||
module API
|
||||
module Models
|
||||
# Models the data of the API response.
|
||||
Recipe = Data.define(
|
||||
Recipe = ::Data.define(
|
||||
:data,
|
||||
:total,
|
||||
:from,
|
||||
|
||||
@@ -5,7 +5,7 @@ module TRMNL
|
||||
module Models
|
||||
module Recipes
|
||||
# Models the statistics of the API response.
|
||||
Statistics = Data.define :installs, :forks
|
||||
Statistics = ::Data.define :installs, :forks
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -4,7 +4,7 @@ module TRMNL
|
||||
module API
|
||||
module Models
|
||||
# Models the data of the API response.
|
||||
Setup = Data.define :api_key, :friendly_id, :image_url, :message do
|
||||
Setup = ::Data.define :api_key, :friendly_id, :image_url, :message do
|
||||
def self.for(attributes) = new(**attributes)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user