chartquery 0.1.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.
@@ -0,0 +1,98 @@
1
+ module ChartQuery
2
+ VERSION: String
3
+ ENDPOINTS: Hash[String, Hash[Symbol, untyped]]
4
+
5
+ class Error < StandardError
6
+ end
7
+ class ConfigurationError < Error
8
+ end
9
+ class SerializationError < Error
10
+ attr_reader param: String?
11
+ def initialize: (String message, ?String? param) -> void
12
+ end
13
+ class TransportError < Error
14
+ end
15
+ class APIError < Error
16
+ attr_reader status: Integer
17
+ attr_reader error_message: String?
18
+ attr_reader response_body: untyped
19
+ attr_reader raw_response: RawResponse
20
+ end
21
+ class ResponseDecodingError < Error
22
+ attr_reader raw_response: RawResponse
23
+ end
24
+ class JobTimeoutError < Error
25
+ attr_reader job_id: String
26
+ attr_reader last_response: JsonResponse?
27
+ end
28
+
29
+ class RawResponse < Struct[untyped]
30
+ attr_accessor status: Integer
31
+ attr_accessor headers: Hash[String, Array[String]]
32
+ attr_accessor content_type: String?
33
+ attr_accessor body: String
34
+ end
35
+
36
+ class JsonResponse
37
+ attr_reader data: untyped
38
+ attr_reader raw_response: RawResponse
39
+ def kind: () -> :json
40
+ def json?: () -> true
41
+ def binary?: () -> false
42
+ end
43
+ class BinaryResponse
44
+ attr_reader bytes: String
45
+ attr_reader content_type: String?
46
+ attr_reader raw_response: RawResponse
47
+ def kind: () -> :binary
48
+ def json?: () -> false
49
+ def binary?: () -> true
50
+ def save: (String path) -> Integer
51
+ end
52
+
53
+ class BatchResult < Struct[untyped]
54
+ attr_accessor index: Integer
55
+ attr_accessor value: untyped
56
+ attr_accessor error: StandardError?
57
+ def ok?: () -> bool
58
+ end
59
+
60
+ type response = JsonResponse | BinaryResponse
61
+ type request_options = { ?method: String, ?timeout: Numeric?, ?headers: Hash[String, String], ?max_retries: Integer }
62
+
63
+ module Operations
64
+ def barcode: (data: String, ?type: String, ?height: Numeric, ?color: String, ?show_text: bool, ?text_position: String, ?text_align: String, ?font_size: Numeric, ?font_family: String, ?bar_width: Numeric, ?bar_gap: Numeric, ?background: String, ?margin: Numeric, ?margin_top: Numeric, ?margin_bottom: Numeric, ?margin_left: Numeric, ?margin_right: Numeric, ?rotation: Numeric, ?bearer_bars: bool, ?unit: String, ?aria_label: String, ?title: String, ?desc: String, ?format: String, ?share: bool, ?fields: String, ?is_async: bool, ?soft_fail: bool, ?request_options: request_options?) -> response
65
+ def chart: (query: String, ?version: String, ?share: bool, ?fields: String, ?is_async: bool, ?soft_fail: bool, ?request_options: request_options?) -> response
66
+ def chart_ai: (prompt: String, ?raw_data: String, ?title: String, ?subtitle: String, ?legend: String, ?format: String, ?width: Numeric, ?height: Numeric, ?background: String, ?device_pixel_ratio: Numeric, ?share: bool, ?fields: String, ?is_async: bool, ?soft_fail: bool, ?request_options: request_options?) -> JsonResponse
67
+ def chart_render: (id: String, ?title: String, ?labels: String, ?data1: String, ?width: String, ?height: String, ?format: String, ?fields: String, ?is_async: bool, ?soft_fail: bool, ?request_options: request_options?) -> response
68
+ def chart_view: (id: String, ?share: bool, ?fields: String, ?is_async: bool, ?soft_fail: bool, ?request_options: request_options?) -> JsonResponse
69
+ def diagram: (type: String, query: String, ?format: String, ?share: bool, ?fields: String, ?is_async: bool, ?soft_fail: bool, ?request_options: request_options?) -> response
70
+ def diagram_ai: (prompt: String, ?diagram_type: String, ?output_format: String, ?share: bool, ?fields: String, ?is_async: bool, ?soft_fail: bool, ?request_options: request_options?) -> JsonResponse
71
+ def diagram_render: (id: String, ?format: String, ?query: String, ?share: bool, ?fields: String, ?is_async: bool, ?soft_fail: bool, ?request_options: request_options?) -> response
72
+ def diagram_view: (id: String, ?share: bool, ?fields: String, ?is_async: bool, ?soft_fail: bool, ?request_options: request_options?) -> JsonResponse
73
+ def jobs: (id: String, ?request_options: request_options?) -> JsonResponse
74
+ def label: (?format: String, ?share: bool, query: String, ?fields: String, ?is_async: bool, ?soft_fail: bool, ?request_options: request_options?) -> response
75
+ def label_compile: (width: Numeric, ?height: Numeric, ?unit: String, ?dpi: Numeric, ?gap: Numeric, ?speed: Numeric, ?density: Numeric, ?direction: Numeric, ?copies: Numeric, ?printer: String, elements: Array[untyped], language: String, ?fields: String, ?is_async: bool, ?soft_fail: bool, ?request_options: request_options?) -> JsonResponse
76
+ def label_convert: (source: String, from: String, to: String, ?dpi: Numeric, ?speed: Numeric, ?density: Numeric, ?copies: Numeric, ?fields: String, ?is_async: bool, ?soft_fail: bool, ?request_options: request_options?) -> JsonResponse
77
+ def label_parse: (source: String, language: String, ?fields: String, ?is_async: bool, ?soft_fail: bool, ?request_options: request_options?) -> JsonResponse
78
+ def label_render: (id: String, ?format: String, ?fields: String, ?is_async: bool, ?soft_fail: bool, ?request_options: request_options?) -> response
79
+ def label_validate: (source: String, language: String, ?fields: String, ?is_async: bool, ?soft_fail: bool, ?request_options: request_options?) -> JsonResponse
80
+ def label_view: (id: String, ?fields: String, ?is_async: bool, ?soft_fail: bool, ?request_options: request_options?) -> JsonResponse
81
+ def qrcode: (data: String, ?size: Numeric, ?ec_level: String, ?dot_type: String, ?color: String, ?shape: String, ?dot_size: Numeric, ?background: String, ?margin: Numeric, ?version: Numeric, ?mode: String, ?mask: Numeric, ?unit: String, ?xml_declaration: bool, ?aria_label: String, ?title: String, ?desc: String, ?format: String, ?share: bool, ?fields: String, ?is_async: bool, ?soft_fail: bool, ?request_options: request_options?) -> response
82
+ def stats: (?engine: String, ?path: String, ?request_options: request_options?) -> JsonResponse
83
+ def usage: (?request_options: request_options?) -> JsonResponse
84
+ end
85
+
86
+ class Client
87
+ include Operations
88
+ DEFAULT_CONCURRENCY: Integer
89
+ MAX_RETRIES: Integer
90
+ RETRY_BACKOFF_FACTOR: Float
91
+ DEFAULT_RETRY_DELAY: Float
92
+ DEFAULT_TIMEOUT: Integer
93
+ def initialize: (?api_key: String?, ?base_url: String, ?timeout: Numeric?, ?headers: Hash[untyped, untyped], ?max_retries: Integer, ?retry_delay: Numeric, ?transport: untyped) -> void
94
+ def request: (String | Symbol method, String path, ?Hash[untyped, untyped]? params, ?timeout: Numeric?, ?headers: Hash[untyped, untyped]?, ?max_retries: Integer?) -> response
95
+ def batch: [I, T] (Enumerable[I] items, ?concurrency: Integer) { (I item) -> T } -> Array[BatchResult]
96
+ def wait_for_job: (String job_id, ?interval: Numeric, ?timeout: Numeric) ?{ (untyped job) -> void } -> JsonResponse
97
+ end
98
+ end
metadata ADDED
@@ -0,0 +1,66 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: chartquery
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - ChartQuery
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2026-11-06 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Generate chart images, diagrams, barcodes, QR codes and thermal labels
14
+ on demand. PNG, SVG or PDF output.
15
+ email:
16
+ - contact@chartquery.com
17
+ executables: []
18
+ extensions: []
19
+ extra_rdoc_files: []
20
+ files:
21
+ - LICENSE
22
+ - README.md
23
+ - examples/README.md
24
+ - examples/binary.rb
25
+ - examples/json.rb
26
+ - examples/request.rb
27
+ - examples/wait_for_job.rb
28
+ - lib/chartquery.rb
29
+ - lib/chartquery/client.rb
30
+ - lib/chartquery/endpoints.rb
31
+ - lib/chartquery/errors.rb
32
+ - lib/chartquery/operations.rb
33
+ - lib/chartquery/responses.rb
34
+ - lib/chartquery/serialization.rb
35
+ - lib/chartquery/transport.rb
36
+ - lib/chartquery/version.rb
37
+ - sig/chartquery.rbs
38
+ homepage: https://www.chartquery.com
39
+ licenses:
40
+ - MIT
41
+ metadata:
42
+ bug_tracker_uri: https://github.com/chartquery/chartquery-ruby/issues
43
+ documentation_uri: https://app.chartquery.com/openapi
44
+ homepage_uri: https://www.chartquery.com
45
+ rubygems_mfa_required: 'true'
46
+ source_code_uri: https://github.com/chartquery/chartquery-ruby
47
+ post_install_message:
48
+ rdoc_options: []
49
+ require_paths:
50
+ - lib
51
+ required_ruby_version: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: '3.1'
56
+ required_rubygems_version: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: '0'
61
+ requirements: []
62
+ rubygems_version: 3.5.22
63
+ signing_key:
64
+ specification_version: 4
65
+ summary: Official Ruby SDK for the ChartQuery chart and QR code API.
66
+ test_files: []