geewiz 0.1.0 → 0.1.2
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
- data/geewiz.gemspec +2 -2
- data/lib/geewiz/client.rb +20 -12
- data/lib/geewiz/var_cache.rb +3 -1
- data/lib/geewiz/version.rb +1 -1
- data/lib/geewiz.rb +23 -9
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 014b8d7b3b4e8e467174f86e1784dbba0b1d83affbe0b19fa3c9cc6368c6573b
|
4
|
+
data.tar.gz: 0d503a8c1e3c3a0d3810728c9fb1d9d18e03530f6c39563e3b9e4548dd19aedc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c98200cb66fc440a00d1af44c539719b54f72ca3d8a4c96283bb566d93f617588cef237b9ad80001b8e4280cc0a1abbc2cc64e63bd5b39c0b72bfd5122f6962c
|
7
|
+
data.tar.gz: 905180bc3a49a60aa8b104e267432ec71bb0eebd8fe847463a9af30219b69783c450364f211b51e74934e8cd7c0f14e2b6eb4fcde885faafdad7bfc03e0e7cda
|
data/geewiz.gemspec
CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
|
|
10
10
|
spec.description = "Geewiz SDK for Ruby"
|
11
11
|
# spec.homepage = "TODO: Put your gem's website or public repo URL here."
|
12
12
|
spec.license = "MIT"
|
13
|
-
spec.required_ruby_version = ">=
|
13
|
+
spec.required_ruby_version = ">= 2.6.0"
|
14
14
|
|
15
15
|
spec.metadata["allowed_push_host"] = "https://rubygems.org"
|
16
16
|
spec.metadata["rubygems_mfa_required"] = "true"
|
@@ -25,7 +25,7 @@ Gem::Specification.new do |spec|
|
|
25
25
|
`git ls-files -z`.split("\x0").reject do |f|
|
26
26
|
(f == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
|
27
27
|
end
|
28
|
-
end - %w[.rspec .rubocop.yml .rubocop_todo.yml Gemfile Gemfile.lock Rakefile]
|
28
|
+
end - %w[.rspec .rubocop.yml .rubocop_todo.yml Gemfile Gemfile.lock Rakefile .tool-versions]
|
29
29
|
spec.bindir = "exe"
|
30
30
|
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
31
31
|
spec.require_paths = ["lib"]
|
data/lib/geewiz/client.rb
CHANGED
@@ -1,37 +1,45 @@
|
|
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
|
-
def command(type, **params)
|
13
|
+
def command(type, **params)
|
14
|
+
@output.print "@#{[type, params].to_json}\n"
|
15
|
+
end
|
11
16
|
|
12
|
-
def read
|
17
|
+
def read
|
18
|
+
@input.readline
|
19
|
+
end
|
13
20
|
|
14
|
-
def read_response
|
21
|
+
def read_response
|
22
|
+
JSON.parse(read)
|
23
|
+
end
|
15
24
|
|
16
|
-
def set(**options)
|
25
|
+
def set(**options)
|
26
|
+
command("set", **options)
|
27
|
+
end
|
17
28
|
|
18
|
-
def card(id = nil, **params)
|
19
|
-
|
29
|
+
def card(id = nil, vars: {}, **params)
|
30
|
+
vars.each { |name, value| var(name, value) }
|
31
|
+
command "card", **params, **(id ? { id: id } : {}), responseFormat: "json"
|
20
32
|
read_response
|
21
33
|
end
|
22
34
|
|
23
35
|
def get_user_config(key)
|
24
|
-
command "get-user-config", key
|
36
|
+
command "get-user-config", key: key, responseFormat: "json"
|
25
37
|
read_response
|
26
38
|
end
|
27
39
|
|
28
40
|
def var(name, value)
|
29
|
-
command("var", name
|
41
|
+
command("var", name: name, value: value)
|
30
42
|
vars.store name, value
|
31
43
|
end
|
32
|
-
|
33
|
-
def vars
|
34
|
-
@vars ||= VarCache.new(self)
|
35
|
-
end
|
36
44
|
end
|
37
45
|
end
|
data/lib/geewiz/var_cache.rb
CHANGED
data/lib/geewiz/version.rb
CHANGED
data/lib/geewiz.rb
CHANGED
@@ -11,17 +11,31 @@ module Geewiz
|
|
11
11
|
|
12
12
|
module_function
|
13
13
|
|
14
|
-
def initialize_client(
|
15
|
-
@client = Client.new(
|
14
|
+
def initialize_client(*args, **options)
|
15
|
+
@client = Client.new(*args, **options)
|
16
16
|
end
|
17
17
|
|
18
|
-
def client(
|
19
|
-
@client ||= initialize_client(
|
18
|
+
def client(*args, **options)
|
19
|
+
@client ||= initialize_client(*args, **options)
|
20
20
|
end
|
21
21
|
|
22
|
-
def set(
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
def
|
22
|
+
def set(*args, **options)
|
23
|
+
client.set(*args, **options)
|
24
|
+
end
|
25
|
+
|
26
|
+
def card(*args, **options)
|
27
|
+
client.card(*args, **options)
|
28
|
+
end
|
29
|
+
|
30
|
+
def get_user_config(*args, **options)
|
31
|
+
client.get_user_config(*args, **options)
|
32
|
+
end
|
33
|
+
|
34
|
+
def var(*args, **options)
|
35
|
+
client.var(*args, **options)
|
36
|
+
end
|
37
|
+
|
38
|
+
def vars
|
39
|
+
client.vars
|
40
|
+
end
|
27
41
|
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.
|
4
|
+
version: 0.1.2
|
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-
|
11
|
+
date: 2024-08-11 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Geewiz SDK for Ruby
|
14
14
|
email:
|
@@ -39,14 +39,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
39
39
|
requirements:
|
40
40
|
- - ">="
|
41
41
|
- !ruby/object:Gem::Version
|
42
|
-
version:
|
42
|
+
version: 2.6.0
|
43
43
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
requirements: []
|
49
|
-
rubygems_version: 3.
|
49
|
+
rubygems_version: 3.5.11
|
50
50
|
signing_key:
|
51
51
|
specification_version: 4
|
52
52
|
summary: Geewiz SDK for Ruby
|