trmnl-api 0.21.0 → 0.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/README.adoc +32 -0
- data/lib/trmnl/api/client.rb +1 -1
- data/lib/trmnl/api/endpoints/firmware/latest.rb +17 -1
- data/trmnl-api.gemspec +1 -1
- data.tar.gz.sig +0 -0
- metadata +2 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 8efedaa295b0c387a87ff3ae179bc8179e21485505de33474d1b5e00bb694e15
|
|
4
|
+
data.tar.gz: ca6875d143b129e2b42114289a3be856e41b5581b4e7ba5286292e6829b3c940
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d2ba42f64f6e549c6852b5326d7ef0e1a1a8356baff3010fa88e2fe7469fcc82986b3b15ade6fe9734cc1d7df36474139b8c6345733eb8bf932e900ddd04f791
|
|
7
|
+
data.tar.gz: 0d7e7e1ade6a86c1f689ac783ba5160dd87544306e295b9befe9150c86cb26d410f15e0efa64ee867be9e2a06ef06bd82c6ff19a6502a53709da4a2f863db570
|
checksums.yaml.gz.sig
CHANGED
|
Binary file
|
data/README.adoc
CHANGED
|
@@ -232,6 +232,38 @@ client.firmware_latest
|
|
|
232
232
|
# )
|
|
233
233
|
----
|
|
234
234
|
|
|
235
|
+
You can also tweak the result to answer current (or past) versions, specific model names, and/or both. Examples:
|
|
236
|
+
|
|
237
|
+
**By Version**
|
|
238
|
+
|
|
239
|
+
[source,ruby]
|
|
240
|
+
----
|
|
241
|
+
client = TRMNL::API.new
|
|
242
|
+
client.firmware_latest "1.8.0"
|
|
243
|
+
|
|
244
|
+
# Success(
|
|
245
|
+
# #<data TRMNL::API::Models::Firmware::Latest
|
|
246
|
+
# url="https://trmnl-fw.s3.us-east-2.amazonaws.com/trmnl_og/FW1.8.0.bin",
|
|
247
|
+
# version="1.8.0">
|
|
248
|
+
# )
|
|
249
|
+
----
|
|
250
|
+
|
|
251
|
+
**By Model Name**
|
|
252
|
+
|
|
253
|
+
[source,ruby]
|
|
254
|
+
----
|
|
255
|
+
client = TRMNL::API.new
|
|
256
|
+
client.firmware_latest model_name: "trmnl_x"
|
|
257
|
+
|
|
258
|
+
# Success(
|
|
259
|
+
# #<data TRMNL::API::Models::Firmware::Latest
|
|
260
|
+
# url="https://trmnl-fw.s3.us-east-2.amazonaws.com/trmnl_x/FW1.8.17.bin",
|
|
261
|
+
# version="1.8.17">
|
|
262
|
+
# )
|
|
263
|
+
----
|
|
264
|
+
|
|
265
|
+
⚠️ This isn't officially supported by the TRMNL API since the endpoint only knows how to provide the latest firmware for OG models so the above allows you to obtain what you need by dynamically formatting the URI based on version and model name. This also means if you make a typo, you might get a URI that doesn't exist since no verification happens.
|
|
266
|
+
|
|
235
267
|
==== IP Addresses
|
|
236
268
|
|
|
237
269
|
Allows you obtain a list of public IP addresses for all TRMNL core servers because plugin poll requests will only originate from these IPs. Example:
|
data/lib/trmnl/api/client.rb
CHANGED
|
@@ -43,7 +43,7 @@ module TRMNL
|
|
|
43
43
|
|
|
44
44
|
def firmware_flashes = endpoints.fetch(__method__).call
|
|
45
45
|
|
|
46
|
-
def firmware_latest = endpoints.fetch(__method__).call
|
|
46
|
+
def firmware_latest(...) = endpoints.fetch(__method__).call(...)
|
|
47
47
|
|
|
48
48
|
def ip_addresses = endpoints.fetch(__method__).call
|
|
49
49
|
|
|
@@ -18,12 +18,28 @@ module TRMNL
|
|
|
18
18
|
include Inspectable[schema: :type]
|
|
19
19
|
include Pipeable
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
ASSET_URI = "https://trmnl-fw.s3.us-east-2.amazonaws.com/%<model_name>s/FW%<version>s.bin"
|
|
22
|
+
|
|
23
|
+
def initialize(asset_uri: ASSET_URI, **)
|
|
24
|
+
@asset_uri = asset_uri
|
|
25
|
+
super(**)
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def call version = nil, model_name: "trmnl_og"
|
|
22
29
|
pipe requester.get("firmware/latest"),
|
|
23
30
|
try(:parse, catch: JSON::ParserError),
|
|
24
31
|
validate(schema, as: :to_h),
|
|
32
|
+
fmap { transform_uri it, (version || it[:version]), model_name },
|
|
25
33
|
to(model, :for)
|
|
26
34
|
end
|
|
35
|
+
|
|
36
|
+
private
|
|
37
|
+
|
|
38
|
+
attr_reader :asset_uri
|
|
39
|
+
|
|
40
|
+
def transform_uri data, version, model_name
|
|
41
|
+
data.merge! url: format(asset_uri, model_name:, version:), version:
|
|
42
|
+
end
|
|
27
43
|
end
|
|
28
44
|
end
|
|
29
45
|
end
|
data/trmnl-api.gemspec
CHANGED
data.tar.gz.sig
CHANGED
|
Binary file
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: trmnl-api
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.22.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Brooke Kuhlmann
|
|
@@ -272,7 +272,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
272
272
|
- !ruby/object:Gem::Version
|
|
273
273
|
version: '0'
|
|
274
274
|
requirements: []
|
|
275
|
-
rubygems_version: 4.0.
|
|
275
|
+
rubygems_version: 4.0.22
|
|
276
276
|
specification_version: 4
|
|
277
277
|
summary: A monadic TRMNL API client.
|
|
278
278
|
test_files: []
|
metadata.gz.sig
CHANGED
|
Binary file
|