chalk_ruby 0.1.3 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d2ede1c8828c78063446a6dde9f51f7b9bc487c5d25a4ffc36d4fa48c200504b
4
- data.tar.gz: 80d0d2513511d278d9ceeb2b64b71935287d9957c5f9df7e2e4758eea217b25f
3
+ metadata.gz: 9c3106a09f290ee6b461da0b625682c15d9e855d55cb0ac431dcd709270cb7e0
4
+ data.tar.gz: 4bab11c1d4580ec5481a46e9a2018e5060ba02cd5b2e044f0599a6cee5ae4ffb
5
5
  SHA512:
6
- metadata.gz: 0afdcc9b35ce5ae8a2cc4a1761e958ed844d0e0dc5e36f77192e538018fd420fca7ab0316a2ed4b6a85e4a05db896ace76385db236c5e1075d58ccd854396547
7
- data.tar.gz: 55ef6712afc0f55785065e19a8ef9392c1319851df453742192703cd4f396c4ae9971b429464b6bd40443956193d9036fa84975eaee37113e22c3fc8971ad654
6
+ metadata.gz: 9772a0495e12a417df35c25492c14ff6fdce02e3d3607fe24762554f9aaad32a6995d0929b61c0d08917606bb4b7a722f7c1b398ad166dc632bdf1e45ea21eb8
7
+ data.tar.gz: 60aaa19445588e8823d5afb75d4993128179ae5744c5fc0fa0281ca54c372e7f11a934ac6634fedc98687929901e926ad2bd69a338430c48df0adf9d9371868a
data/README.md CHANGED
@@ -8,7 +8,7 @@ https://rubygems.org/gems/chalk_ruby
8
8
 
9
9
  ## Getting Started
10
10
 
11
- First, install `chalk_ruby` via the [RubyGems](https://rubygems.org/) package manager:
11
+ First, install ChalkRuby Ruby API Client via the [RubyGems](https://rubygems.org/) package manager:
12
12
 
13
13
  ```bash
14
14
  gem install chalk_ruby
@@ -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
@@ -34,11 +34,17 @@ module ChalkRuby
34
34
  end
35
35
 
36
36
  unless success?(http_response_code: response.status)
37
- decoded_error = json_to_hash(json: response.error, symbolize_keys: true)
38
- raise ChalkHttpError.new(
39
- code: get_option(hash: decoded_error, key: 'status'),
40
- message: get_option(hash: decoded_error, key: 'message')
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
@@ -1,3 +1,3 @@
1
1
  module ChalkRuby
2
- VERSION = '0.1.3'.freeze
2
+ VERSION = '0.1.4'.freeze
3
3
  end
@@ -29,7 +29,8 @@ module ChalkRuby
29
29
  meta: Hash[String, String]?,
30
30
  explain: bool,
31
31
  include_meta: bool,
32
- store_plan_stages: bool
32
+ store_plan_stages: bool,
33
+ timeout: Float?
33
34
  ) -> Hash[Symbol, untyped]
34
35
 
35
36
  private
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.3
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-01-26 00:00:00.000000000 Z
11
+ date: 2024-12-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler