geewiz 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '039474659cf46318c5a4c771c9e34c8fc49d6931e8fc70acee6e9c02e974f0ee'
4
- data.tar.gz: 662bd008faff4ad118255f399a30fb83b409489549230c3e73db30f2673a1d7b
3
+ metadata.gz: d1f5049589b6ab231bba0aab5d7d437da6240845b83d92e2af6e4ad2930d8105
4
+ data.tar.gz: dd0b70dcf9b924f46d595bd19bba021dabc5b407f6024f7f009b91d00a4cb2ea
5
5
  SHA512:
6
- metadata.gz: 3627fa5b0a9c2103d4b42e191510b24f58a45542f0129fc70b00df578457df159e8a89581f72a7c3a455429ac83b1ba33d04ba352606387768412ebb69b136e2
7
- data.tar.gz: a0c0f4a959ef85564b7d0113a498a56578e0f26898584d775ffa520b00d097cb5d12c23e037cbc42edc1be68c54f01969dd8ea17750d6b52f33fe808a4ec06e3
6
+ metadata.gz: 862ddeb1f9b44362af4761bd23796a23aa623ae681a8d44c4e494385ff45d9fd497dfea448d77127aea30716aea66749629281975f4bd7e4d4be7e6254e86d8a
7
+ data.tar.gz: ba0beadf1268fe38d63227a8286fc7a9d9d1dbe00cc41790ca2ca1a31f334169ff4bd86dab7a1c48c2b80dac73c24055d72f04e4f08f995a5b1f39079e18c304
data/lib/geewiz/client.rb CHANGED
@@ -1,22 +1,26 @@
1
1
  module Geewiz
2
2
  # Client class for interacting with Geewiz.
3
3
  class Client
4
+ attr_reader :vars
5
+
4
6
  def initialize(input: $stdin, output: $stdout)
5
7
  @input = input
6
8
  @output = output
7
9
  @output.sync = true
10
+ @vars = VarCache.new(self)
8
11
  end
9
12
 
10
13
  def command(type, **params) = @output.print "@#{[type, params].to_json}\n"
11
14
 
12
- def read = @input.readline.chomp
15
+ def read = @input.readline
13
16
 
14
17
  def read_response = JSON.parse(read)
15
18
 
16
19
  def set(**options) = command("set", **options)
17
20
 
18
- def card(id = nil, **params)
19
- command "card", **(id ? { id: } : params), responseFormat: "json"
21
+ def card(id = nil, vars: {}, **params)
22
+ vars.each { |name, value| var(name, value) }
23
+ command "card", **params, **(id ? { id: } : {}), responseFormat: "json"
20
24
  read_response
21
25
  end
22
26
 
@@ -29,9 +33,5 @@ module Geewiz
29
33
  command("var", name:, value:)
30
34
  vars.store name, value
31
35
  end
32
-
33
- def vars
34
- @vars ||= VarCache.new(self)
35
- end
36
36
  end
37
37
  end
@@ -1,3 +1,3 @@
1
1
  module Geewiz
2
- VERSION = "0.1.0".freeze
2
+ VERSION = "0.1.1".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: geewiz
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Nicholaides
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-08-09 00:00:00.000000000 Z
11
+ date: 2024-08-10 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Geewiz SDK for Ruby
14
14
  email: