Skip to content

Commit 18eabdc

Browse files
authored
chore: rename InvocableScripts to InvokableScripts (#103)
1 parent ddc260b commit 18eabdc

File tree

10 files changed

+36
-30
lines changed

10 files changed

+36
-30
lines changed

CHANGELOG.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
## 2.5.0 [unreleased]
22

3+
### Breaking Changes
4+
1. [#103](https://github.com/influxdata/influxdb-client-ruby/pull/103): Rename `InvocableScripts` to `InvokableScripts`
5+
36
## 2.4.0 [2022-04-19]
47

58
### Features
6-
1. [#101](https://github.com/influxdata/influxdb-client-ruby/pull/101): Add `InvocableScriptsApi` to create, update, list, delete and invoke scripts by seamless way
9+
1. [#101](https://github.com/influxdata/influxdb-client-ruby/pull/101): Add `InvokableScriptsApi` to create, update, list, delete and invoke scripts by seamless way
710

811
## 2.3.0 [2022-03-18]
912

bin/invocable-scripts.yml

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
11
openapi: 3.0.0
22
info:
3-
title: InfluxData Invocable Scripts API
3+
title: InfluxData Invokable Scripts API
44
version: 0.1.0
55
description: |
66
Manage and execute scripts as API endpoints in InfluxDB.
77
8-
An API Invocable Script assigns your custom Flux script to a new InfluxDB API endpoint for your organization.
9-
Invocable scripts let you execute your script as an HTTP request to the endpoint.
8+
An API Invokable Script assigns your custom Flux script to a new InfluxDB API endpoint for your organization.
9+
Invokable scripts let you execute your script as an HTTP request to the endpoint.
1010
11-
Invocable scripts accept parameters. Add parameter references in your script as `params.myparameter`.
11+
Invokable scripts accept parameters. Add parameter references in your script as `params.myparameter`.
1212
When you `invoke` your script, you send parameters as key-value pairs in the `params` object.
1313
InfluxDB executes your script with the key-value pairs as arguments and returns the result.
1414
15-
For more information and examples, see [Invoke custom scripts](https://docs.influxdata.com/influxdb/cloud/api-guide/api-invocable-scripts).
15+
For more information and examples, see [Invoke custom scripts](https://docs.influxdata.com/influxdb/cloud/api-guide/api-invokable-scripts/).
1616
servers:
1717
- url: /api/v2
1818
paths:
1919
/scripts:
2020
get:
2121
operationId: GetScripts
2222
tags:
23-
- Invocable Scripts
23+
- Invokable Scripts
2424
summary: List scripts
2525
parameters:
2626
- in: query
@@ -48,7 +48,7 @@ paths:
4848
post:
4949
operationId: PostScripts
5050
tags:
51-
- Invocable Scripts
51+
- Invokable Scripts
5252
summary: Create a script
5353
requestBody:
5454
description: The script to create.
@@ -71,9 +71,9 @@ paths:
7171
get:
7272
operationId: GetScriptsID
7373
tags:
74-
- Invocable Scripts
74+
- Invokable Scripts
7575
summary: Retrieve a script
76-
description: Uses script ID to retrieve details of an invocable script.
76+
description: Uses script ID to retrieve details of an invokable script.
7777
parameters:
7878
- in: path
7979
name: scriptID
@@ -94,10 +94,10 @@ paths:
9494
patch:
9595
operationId: PatchScriptsID
9696
tags:
97-
- Invocable Scripts
97+
- Invokable Scripts
9898
summary: Update a script
9999
description: |
100-
Updates properties (`name`, `description`, and `script`) of an invocable script.
100+
Updates properties (`name`, `description`, and `script`) of an invokable script.
101101
requestBody:
102102
description: Script update to apply
103103
required: true
@@ -125,7 +125,7 @@ paths:
125125
delete:
126126
operationId: DeleteScriptsID
127127
tags:
128-
- Invocable Scripts
128+
- Invokable Scripts
129129
summary: Delete a script
130130
description: Deletes a script and all associated records.
131131
parameters:
@@ -145,7 +145,7 @@ paths:
145145
post:
146146
operationId: PostScriptsIDInvoke
147147
tags:
148-
- Invocable Scripts
148+
- Invokable Scripts
149149
summary: Invoke a script
150150
description: Invokes a script and substitutes `params` keys referenced in the script with `params` key-values sent in the request body.
151151
parameters:
@@ -286,6 +286,7 @@ components:
286286
properties:
287287
params:
288288
type: object
289+
additionalProperties: true
289290
ScriptLanguage:
290291
type: string
291292
enum:

examples/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@
1111
- [create_new_bucket.rb](create_new_bucket.rb) - How to create Buckets
1212

1313
## Others
14-
- [invocable_scripts.rb](invocable_scripts.rb) - How to use Invocable scripts Cloud API to create custom endpoints that query data
14+
- [invokable_scripts.rb](invokable_scripts.rb) - How to use Invokable scripts Cloud API to create custom endpoints that query data
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
$LOAD_PATH.unshift File.expand_path('../lib', __dir__)
22
require 'influxdb-client'
33

4-
# warning: Invocable Scripts are supported only in InfluxDB Cloud, currently there is no support in InfluxDB OSS.
4+
# warning: Invokable Scripts are supported only in InfluxDB Cloud, currently there is no support in InfluxDB OSS.
55

66
url = 'https://us-west-2-1.aws.cloud2.influxdata.com'
77
token = '...'
@@ -22,10 +22,10 @@
2222
.add_field('temperature', 24.3)
2323
client.create_write_api.write(data: [point1, point2])
2424

25-
scripts_api = client.create_invocable_scripts_api
25+
scripts_api = client.create_invokable_scripts_api
2626

2727
#
28-
# Create Invocable Script
28+
# Create Invokable Script
2929
#
3030
puts "------- Create -------\n"
3131
script_query = 'from(bucket: params.bucket_name) |> range(start: -30d) |> limit(n:2)'
@@ -38,7 +38,7 @@
3838
puts created_script.inspect
3939

4040
#
41-
# Update Invocable Script
41+
# Update Invokable Script
4242
#
4343
puts "------- Update -------\n"
4444
update_request = InfluxDB2::ScriptUpdateRequest.new(description: 'my updated description')

lib/influxdb-client.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
require 'influxdb2/client/delete_api'
2828
require 'influxdb2/client/health_api'
2929
require 'influxdb2/client/ping_api'
30-
require 'influxdb2/client/invocable_scripts_api'
30+
require 'influxdb2/client/invokable_scripts_api'
3131
require 'influxdb2/client/point'
3232
require 'influxdb2/client/flux_table'
3333
require 'influxdb2/client/write_retry'

lib/influxdb2/client/client.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,11 @@ def create_delete_api
8585
DeleteApi.new(options: @options)
8686
end
8787

88-
# Create an InvocableScripts API instance.
88+
# Create an InvokableScripts API instance.
8989
#
90-
# @return [InvocableScriptsApi] New instance of InvocableScriptsApi.
91-
def create_invocable_scripts_api
92-
InvocableScriptsApi.new(options: @options)
90+
# @return [InvokableScriptsApi] New instance of InvokableScriptsApi.
91+
def create_invokable_scripts_api
92+
InvokableScriptsApi.new(options: @options)
9393
end
9494

9595
# Get the health of an instance.

lib/influxdb2/client/flux_csv_parser.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def initialize(message)
4646
class FluxResponseMode
4747
# full information about types, default values and groups
4848
FULL = 'full'.freeze
49-
# useful for Invocable scripts
49+
# useful for Invokable scripts
5050
ONLY_NAMES = 'only_names'.freeze
5151
end
5252

lib/influxdb2/client/invocable_scripts_api.rb renamed to lib/influxdb2/client/invokable_scripts_api.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ module InfluxDB2
2525
#
2626
# API invokable scripts let you assign scripts to API endpoints and then execute them as standard REST operations
2727
# in InfluxDB Cloud.
28-
class InvocableScriptsApi < DefaultApi
28+
class InvokableScriptsApi < DefaultApi
2929
# @param [Hash] options The options to be used by the client.
3030
def initialize(options:)
3131
super(options: options)

lib/influxdb2/client/models/script_invocation_params.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,9 @@ def initialize(attributes = {})
5353
}
5454

5555
if attributes.key?(:'params')
56-
self.params = attributes[:'params']
56+
if (value = attributes[:'params']).is_a?(Hash)
57+
self.params = value
58+
end
5759
end
5860
end
5961

test/influxdb/invocable_scripts_api_test.rb renamed to test/influxdb/invokable_scripts_api_test.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
require 'test_helper'
2222

23-
class InvocableScriptsApiTest < MiniTest::Test
23+
class InvokableScriptsApiTest < MiniTest::Test
2424
def setup
2525
WebMock.disable_net_connect!
2626
@client = InfluxDB2::Client.new('http://localhost:8086', 'my-token',
@@ -35,7 +35,7 @@ def teardown
3535
end
3636

3737
def test_create_instance
38-
invocable_scripts_api = @client.create_invocable_scripts_api
39-
refute_nil invocable_scripts_api
38+
invokable_scripts_api = @client.create_invokable_scripts_api
39+
refute_nil invokable_scripts_api
4040
end
4141
end

0 commit comments

Comments
 (0)