chalk_ruby 0.1.2 → 0.1.4
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/README.md +4 -2
- data/Rakefile +1 -1
- data/SECURITY.md +4 -4
- data/lib/chalk_ruby/client.rb +17 -4
- data/lib/chalk_ruby/config.rb +7 -7
- data/lib/chalk_ruby/http/http_requester_chalk.rb +11 -5
- data/lib/chalk_ruby/version.rb +1 -1
- data/sig/chalk_ruby/client.rbs +2 -1
- metadata +6 -6
- /data/test/{chalk_ai → chalk_ruby}/integration/client_test.rb +0 -0
- /data/test/{chalk_ai → chalk_ruby}/test_helper.rb +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9c3106a09f290ee6b461da0b625682c15d9e855d55cb0ac431dcd709270cb7e0
|
4
|
+
data.tar.gz: 4bab11c1d4580ec5481a46e9a2018e5060ba02cd5b2e044f0599a6cee5ae4ffb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9772a0495e12a417df35c25492c14ff6fdce02e3d3607fe24762554f9aaad32a6995d0929b61c0d08917606bb4b7a722f7c1b398ad166dc632bdf1e45ea21eb8
|
7
|
+
data.tar.gz: 60aaa19445588e8823d5afb75d4993128179ae5744c5fc0fa0281ca54c372e7f11a934ac6634fedc98687929901e926ad2bd69a338430c48df0adf9d9371868a
|
data/README.md
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
## ChalkRuby Ruby
|
2
2
|
|
3
|
-
|
3
|
+
[](https://badge.fury.io/rb/chalk_ruby)
|
4
|
+
|
5
|
+
Ruby client for Chalk!
|
4
6
|
|
5
7
|
https://rubygems.org/gems/chalk_ruby
|
6
8
|
|
@@ -9,7 +11,7 @@ https://rubygems.org/gems/chalk_ruby
|
|
9
11
|
First, install ChalkRuby Ruby API Client via the [RubyGems](https://rubygems.org/) package manager:
|
10
12
|
|
11
13
|
```bash
|
12
|
-
gem install
|
14
|
+
gem install chalk_ruby
|
13
15
|
```
|
14
16
|
|
15
17
|
Then, create a new client using your client ID and client secret:
|
data/Rakefile
CHANGED
@@ -17,7 +17,7 @@ namespace :test do
|
|
17
17
|
Rake::TestTask.new(:integration) do |t|
|
18
18
|
t.libs << 'test'
|
19
19
|
t.libs << 'lib'
|
20
|
-
t.test_files = FileList['test/
|
20
|
+
t.test_files = FileList['test/chalk_ruby/integration/**/*_test.rb']
|
21
21
|
t.verbose = true
|
22
22
|
t.warning = false
|
23
23
|
end
|
data/SECURITY.md
CHANGED
@@ -1,17 +1,17 @@
|
|
1
1
|
## Security
|
2
2
|
|
3
|
-
If you believe you have found a security vulnerability in
|
3
|
+
If you believe you have found a security vulnerability in Chalk's Ruby package, please report it to us!
|
4
4
|
|
5
5
|
### Reporting Security Issues
|
6
6
|
|
7
7
|
**Please do not report security vulnerabilities through public GitHub issues.**
|
8
8
|
|
9
|
-
Please email security concerns to [security@
|
9
|
+
Please email security concerns to [security@chalk.ai](mailto:security@chalk.ai).
|
10
10
|
|
11
11
|
### Security Overview
|
12
12
|
|
13
|
-
https://docs.
|
13
|
+
https://docs.chalk.ai/docs/security
|
14
14
|
|
15
15
|
### SOC-2 Report
|
16
16
|
|
17
|
-
To request access to ChalkRuby's SOC-2 report, please email [security@
|
17
|
+
To request access to ChalkRuby's SOC-2 report, please email [security@chalk.ai](mailto:security@chalk_ruby.ai).
|
data/lib/chalk_ruby/client.rb
CHANGED
@@ -107,6 +107,12 @@ module ChalkRuby
|
|
107
107
|
# Typically, each query that you make from your application should have a name.
|
108
108
|
# Chalk will present metrics and dashboard functionality grouped by 'query_name'.
|
109
109
|
#
|
110
|
+
# @param query_name_version [String?]
|
111
|
+
# If query_name is specified, this specifies the version of the named query you're
|
112
|
+
# making. This is only useful if you want your query to use a NamedQuery with a
|
113
|
+
# specific name and a specific version. If a query_name has not been supplied, then
|
114
|
+
# this parameter is ignored.
|
115
|
+
#
|
110
116
|
# @param meta [Hash[String, String]?]
|
111
117
|
# Arbitrary `key:value` pairs to associate with a query.
|
112
118
|
#
|
@@ -125,6 +131,9 @@ module ChalkRuby
|
|
125
131
|
# This option dramatically impacts the performance of the query,
|
126
132
|
# so it should only be used for debugging.
|
127
133
|
#
|
134
|
+
# @option options [Float?] :timeout
|
135
|
+
# Allows overriding default timeout for query operations (in seconds).
|
136
|
+
#
|
128
137
|
# @return [Hash[Symbol, String]]
|
129
138
|
#
|
130
139
|
def query(
|
@@ -136,10 +145,12 @@ module ChalkRuby
|
|
136
145
|
branch: nil,
|
137
146
|
correlation_id: nil,
|
138
147
|
query_name: nil,
|
148
|
+
query_name_version: nil,
|
139
149
|
meta: nil,
|
140
150
|
explain: nil,
|
141
151
|
include_meta: nil,
|
142
|
-
store_plan_stages: nil
|
152
|
+
store_plan_stages: nil,
|
153
|
+
timeout: nil
|
143
154
|
)
|
144
155
|
query_server_request(
|
145
156
|
method: :post,
|
@@ -153,12 +164,14 @@ module ChalkRuby
|
|
153
164
|
branch_id: branch,
|
154
165
|
correlation_id: correlation_id,
|
155
166
|
query_name: query_name,
|
167
|
+
query_name_version: query_name_version,
|
156
168
|
meta: meta,
|
157
169
|
explain: explain || false,
|
158
170
|
include_meta: include_meta || false,
|
159
171
|
store_plan_stages: store_plan_stages || false
|
160
172
|
},
|
161
|
-
headers: get_authenticated_engine_headers(branch: branch)
|
173
|
+
headers: get_authenticated_engine_headers(branch: branch),
|
174
|
+
timeout:
|
162
175
|
)
|
163
176
|
end
|
164
177
|
|
@@ -214,12 +227,12 @@ module ChalkRuby
|
|
214
227
|
)
|
215
228
|
end
|
216
229
|
|
217
|
-
def query_server_request(method:, path:, body:, headers:)
|
230
|
+
def query_server_request(method:, path:, body:, headers:, timeout: nil)
|
218
231
|
@transporter.send_request(
|
219
232
|
method: method,
|
220
233
|
host: query_server_host,
|
221
234
|
path: path,
|
222
|
-
timeout: @config.query_timeout,
|
235
|
+
timeout: timeout || @config.query_timeout,
|
223
236
|
connect_timeout: @config.connect_timeout,
|
224
237
|
body: body,
|
225
238
|
headers: headers
|
data/lib/chalk_ruby/config.rb
CHANGED
@@ -31,13 +31,13 @@ module ChalkRuby
|
|
31
31
|
# The API server to use.
|
32
32
|
# If not provided, it will be read from the CHALK_API_SERVER environment variable.
|
33
33
|
#
|
34
|
-
# @option options [
|
35
|
-
# The timeout for
|
34
|
+
# @option options [Float?] :query_timeout
|
35
|
+
# The timeout for query operations (in seconds).
|
36
36
|
#
|
37
|
-
# @option options [
|
38
|
-
# The timeout for
|
37
|
+
# @option options [Float?] :api_timeout
|
38
|
+
# The timeout for non-query API operations (in seconds).
|
39
39
|
#
|
40
|
-
# @option options [
|
40
|
+
# @option options [Float?] :connect_timeout
|
41
41
|
# The timeout for connect operations (in seconds).
|
42
42
|
#
|
43
43
|
# @option options [Hash<String, String>?] :additional_headers
|
@@ -49,8 +49,8 @@ module ChalkRuby
|
|
49
49
|
@environment = opts[:environment] || ENV['CHALK_ACTIVE_ENVIRONMENT']
|
50
50
|
@query_server = opts[:query_server] || ENV['CHALK_QUERY_SERVER'] || Defaults::QUERY_SERVER
|
51
51
|
@api_server = opts[:api_server] || ENV['CHALK_API_SERVER'] || Defaults::API_SERVER
|
52
|
-
@query_timeout = opts[:query_timeout] || Defaults::
|
53
|
-
@api_timeout = opts[:api_timeout] || Defaults::
|
52
|
+
@query_timeout = opts[:query_timeout] || Defaults::QUERY_TIMEOUT
|
53
|
+
@api_timeout = opts[:api_timeout] || Defaults::API_TIMEOUT
|
54
54
|
@connect_timeout = opts[:connect_timeout] || Defaults::CONNECT_TIMEOUT
|
55
55
|
@additional_headers = opts[:additional_headers] || {}
|
56
56
|
|
@@ -34,11 +34,17 @@ module ChalkRuby
|
|
34
34
|
end
|
35
35
|
|
36
36
|
unless success?(http_response_code: response.status)
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
37
|
+
begin
|
38
|
+
decoded_error = json_to_hash(json: response.error, symbolize_keys: true)
|
39
|
+
message = get_option(hash: decoded_error, key: 'description')
|
40
|
+
rescue MultiJson::ParseError
|
41
|
+
message = response.error
|
42
|
+
ensure
|
43
|
+
raise ChalkHttpError.new(
|
44
|
+
code: response.status,
|
45
|
+
message: message
|
46
|
+
)
|
47
|
+
end
|
42
48
|
end
|
43
49
|
json_to_hash(json: response.body, symbolize_keys: true)
|
44
50
|
end
|
data/lib/chalk_ruby/version.rb
CHANGED
data/sig/chalk_ruby/client.rbs
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chalk_ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chalk AI, Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-12-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -236,8 +236,8 @@ files:
|
|
236
236
|
- sig/chalk_ruby/http/response.rbs
|
237
237
|
- sig/chalk_ruby/token.rbs
|
238
238
|
- sig/chalk_ruby/versions.rbs
|
239
|
-
- test/
|
240
|
-
- test/
|
239
|
+
- test/chalk_ruby/integration/client_test.rb
|
240
|
+
- test/chalk_ruby/test_helper.rb
|
241
241
|
homepage: https://github.com/chalk-ai/chalk-ruby
|
242
242
|
licenses:
|
243
243
|
- Apache-2.0
|
@@ -265,5 +265,5 @@ signing_key:
|
|
265
265
|
specification_version: 4
|
266
266
|
summary: A simple Ruby client for Chalk
|
267
267
|
test_files:
|
268
|
-
- test/
|
269
|
-
- test/
|
268
|
+
- test/chalk_ruby/integration/client_test.rb
|
269
|
+
- test/chalk_ruby/test_helper.rb
|
File without changes
|
File without changes
|