trmnl-api 0.12.0 → 0.13.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 +68 -55
- data/lib/trmnl/api/models/model.rb +6 -2
- data/lib/trmnl/api/models/palette.rb +13 -2
- 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: 1bf06832c324918b8f93b02b8a8700b617c57cd804e206b2b28b20dc0509c6f2
|
|
4
|
+
data.tar.gz: 5547395a2b3fe1abb54de0cee20a58bbb438bdfc9786a5a602eef40a8b12e147
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e8c73489d9f1334bbd721aab3c7c6270b4bb791982112245b57a9a1305d1e8f6f108e82356dcecf25db970e644ee9de3b626b1db5b4b741edcd633ed262e4e03
|
|
7
|
+
data.tar.gz: c511a0cd0e6ca2a15584ee84bf58b6f6556b503118b2a89075401e0c515217a9821ce1e249b1e77741e166bd432678e932d9d4416926174067381df50ebef848
|
checksums.yaml.gz.sig
CHANGED
|
Binary file
|
data/README.adoc
CHANGED
|
@@ -76,8 +76,8 @@ end
|
|
|
76
76
|
|
|
77
77
|
You can configure the client via the following environment variables:
|
|
78
78
|
|
|
79
|
-
* `TRMNL_API_CONTENT_TYPE`: Defines the HTTP `Content-Type` header. You shouldn't need to change this but is here if you need it. Default: "application/json"
|
|
80
|
-
* `TRMNL_API_URI`: Defines the API URI. Default: "https://trmnl.app/api"
|
|
79
|
+
* `TRMNL_API_CONTENT_TYPE`: Defines the HTTP `Content-Type` header. You shouldn't need to change this but is here if you need it. Default: `"application/json"`.
|
|
80
|
+
* `TRMNL_API_URI`: Defines the API URI. Default: `"https://trmnl.app/api"`.
|
|
81
81
|
|
|
82
82
|
Any/all environment changes will be applied unless you override these settings via the client configuration block shown above.
|
|
83
83
|
|
|
@@ -227,46 +227,48 @@ client = TRMNL::API.new
|
|
|
227
227
|
client.models
|
|
228
228
|
|
|
229
229
|
# Success(
|
|
230
|
-
#
|
|
231
|
-
#
|
|
232
|
-
#
|
|
233
|
-
#
|
|
234
|
-
#
|
|
235
|
-
#
|
|
236
|
-
#
|
|
237
|
-
#
|
|
238
|
-
#
|
|
239
|
-
#
|
|
240
|
-
#
|
|
241
|
-
#
|
|
242
|
-
#
|
|
243
|
-
#
|
|
244
|
-
#
|
|
245
|
-
#
|
|
246
|
-
#
|
|
247
|
-
#
|
|
248
|
-
#
|
|
249
|
-
#
|
|
250
|
-
#
|
|
251
|
-
#
|
|
252
|
-
#
|
|
253
|
-
#
|
|
254
|
-
#
|
|
255
|
-
#
|
|
256
|
-
#
|
|
257
|
-
#
|
|
258
|
-
#
|
|
259
|
-
#
|
|
260
|
-
#
|
|
261
|
-
#
|
|
262
|
-
#
|
|
263
|
-
#
|
|
264
|
-
#
|
|
265
|
-
#
|
|
266
|
-
#
|
|
267
|
-
#
|
|
268
|
-
#
|
|
269
|
-
#
|
|
230
|
+
# [
|
|
231
|
+
# #<data TRMNL::API::Models::Model
|
|
232
|
+
# name="test",
|
|
233
|
+
# label="Test",
|
|
234
|
+
# description="A test.",
|
|
235
|
+
# kind="trmnl",
|
|
236
|
+
# colors=2,
|
|
237
|
+
# bit_depth=1,
|
|
238
|
+
# scale_factor=1,
|
|
239
|
+
# rotation=90,
|
|
240
|
+
# mime_type="image/png",
|
|
241
|
+
# width=800,
|
|
242
|
+
# height=480,
|
|
243
|
+
# offset_x=10,
|
|
244
|
+
# offset_y=15,
|
|
245
|
+
# palette_names=["bw"],
|
|
246
|
+
# css: {
|
|
247
|
+
# classes: {
|
|
248
|
+
# device: "screen--og_png",
|
|
249
|
+
# size: "screen--md"
|
|
250
|
+
# },
|
|
251
|
+
# variables: [
|
|
252
|
+
# [
|
|
253
|
+
# "--screen-w",
|
|
254
|
+
# "800px"
|
|
255
|
+
# ],
|
|
256
|
+
# [
|
|
257
|
+
# "--screen-h",
|
|
258
|
+
# "480px"
|
|
259
|
+
# ],
|
|
260
|
+
# [
|
|
261
|
+
# "--ui-scale",
|
|
262
|
+
# "1.0"
|
|
263
|
+
# ],
|
|
264
|
+
# [
|
|
265
|
+
# "--gap-scale",
|
|
266
|
+
# "1.0"
|
|
267
|
+
# ]
|
|
268
|
+
# ]
|
|
269
|
+
# }
|
|
270
|
+
# >
|
|
271
|
+
# ]
|
|
270
272
|
# )
|
|
271
273
|
----
|
|
272
274
|
|
|
@@ -274,7 +276,7 @@ client.models
|
|
|
274
276
|
|
|
275
277
|
==== Palettes
|
|
276
278
|
|
|
277
|
-
Allows you to obtain palettes details. The
|
|
279
|
+
Allows you to obtain palettes details. The names correlate to the `palette_names` as found in the Models API. Example:
|
|
278
280
|
|
|
279
281
|
[source,ruby]
|
|
280
282
|
----
|
|
@@ -283,19 +285,30 @@ client.palettes
|
|
|
283
285
|
|
|
284
286
|
Success(
|
|
285
287
|
[
|
|
286
|
-
#<
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
grays=2,
|
|
290
|
-
colors=
|
|
291
|
-
framework_class="screen--1bit"
|
|
288
|
+
#<Struct:TRMNL::API::Models::Palette
|
|
289
|
+
name = "bw",
|
|
290
|
+
label = "Black & White (1-bit)",
|
|
291
|
+
grays = 2,
|
|
292
|
+
colors = [],
|
|
293
|
+
framework_class = "screen--1bit"
|
|
294
|
+
>,
|
|
295
|
+
#<Struct:TRMNL::API::Models::Palette
|
|
296
|
+
name = "color-3bwr",
|
|
297
|
+
label = "Color (3 colors)",
|
|
298
|
+
grays = 2,
|
|
299
|
+
colors = [
|
|
300
|
+
"#000000",
|
|
301
|
+
"#FF0000",
|
|
302
|
+
"#FFFFFF"
|
|
303
|
+
],
|
|
304
|
+
framework_class = nil
|
|
292
305
|
>,
|
|
293
|
-
#<
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
grays=
|
|
297
|
-
colors=
|
|
298
|
-
framework_class=
|
|
306
|
+
#<Struct:TRMNL::API::Models::Palette
|
|
307
|
+
name = "color-24bit",
|
|
308
|
+
label = "Color (16777216 colors)",
|
|
309
|
+
grays = 2,
|
|
310
|
+
colors = [],
|
|
311
|
+
framework_class = nil
|
|
299
312
|
>
|
|
300
313
|
]
|
|
301
314
|
)
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
require "refinements/hash"
|
|
4
|
+
|
|
3
5
|
module TRMNL
|
|
4
6
|
module API
|
|
5
7
|
module Models
|
|
@@ -18,10 +20,10 @@ module TRMNL
|
|
|
18
20
|
:height,
|
|
19
21
|
:offset_x,
|
|
20
22
|
:offset_y,
|
|
21
|
-
:
|
|
23
|
+
:palette_names,
|
|
22
24
|
:css
|
|
23
25
|
) do
|
|
24
|
-
def self.for(attributes) = new(**attributes)
|
|
26
|
+
def self.for(attributes) = new(**attributes.transform_keys(palette_ids: :palette_names))
|
|
25
27
|
|
|
26
28
|
def initialize(**)
|
|
27
29
|
super
|
|
@@ -34,6 +36,8 @@ module TRMNL
|
|
|
34
36
|
private
|
|
35
37
|
|
|
36
38
|
def apply_defaults
|
|
39
|
+
self[:palette_names] ||= []
|
|
40
|
+
|
|
37
41
|
%i[colors bit_depth scale_factor rotation width height offset_x offset_y].each do |name|
|
|
38
42
|
self[name] ||= 0
|
|
39
43
|
end
|
|
@@ -1,11 +1,22 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
require "refinements/hash"
|
|
4
|
+
|
|
3
5
|
module TRMNL
|
|
4
6
|
module API
|
|
5
7
|
module Models
|
|
6
8
|
# Models the data of the API response.
|
|
7
|
-
Palette = Struct.new :
|
|
8
|
-
|
|
9
|
+
Palette = Struct.new :name, :label, :grays, :colors, :framework_class do
|
|
10
|
+
using Refinements::Hash
|
|
11
|
+
|
|
12
|
+
def self.for(attributes) = new(**attributes.transform_keys(name: :label, id: :name))
|
|
13
|
+
|
|
14
|
+
def initialize(**)
|
|
15
|
+
super
|
|
16
|
+
self[:grays] ||= 0
|
|
17
|
+
self[:colors] ||= []
|
|
18
|
+
freeze
|
|
19
|
+
end
|
|
9
20
|
end
|
|
10
21
|
end
|
|
11
22
|
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.13.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- TRMNL
|
|
@@ -253,7 +253,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
253
253
|
- !ruby/object:Gem::Version
|
|
254
254
|
version: '0'
|
|
255
255
|
requirements: []
|
|
256
|
-
rubygems_version: 4.0.
|
|
256
|
+
rubygems_version: 4.0.8
|
|
257
257
|
specification_version: 4
|
|
258
258
|
summary: A monadic TRMNL API client.
|
|
259
259
|
test_files: []
|
metadata.gz.sig
CHANGED
|
Binary file
|