quill-sql 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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: aac08db9b308774dc3af6239d16abbde87a98162806af1835e1954f5fa95828d
4
+ data.tar.gz: edf2c32f651d099e12cbb167a87dfff14f06d38d36dbd6bb7f19d768ed182ff1
5
+ SHA512:
6
+ metadata.gz: 47933c7fe80e0e99e7116795ef81a2fd23c474bd36d2c037ff2424fd0b5a441955277d6d055b71ccbdf183de9d0ef6417722259e1e2e3d1ca06c0c397f8f3ef9
7
+ data.tar.gz: 34e3e84f8a818572dd5a14df6cdab81d4b3c806b40c704701509c3ce2ff606bc06945745ed8f5605a0158344d993ced6f837465f134949cd843ff2a20af04a0f
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Quill
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,76 @@
1
+ # Quill Ruby SDK
2
+
3
+ ## Installation
4
+
5
+ Add this line to your application's Gemfile:
6
+
7
+ ```ruby
8
+ gem 'quill-sql'
9
+ ```
10
+
11
+ And then execute:
12
+ ```bash
13
+ $ bundle install
14
+ ```
15
+
16
+ ## Usage Example
17
+
18
+ ```ruby
19
+ require 'sinatra'
20
+ require 'sinatra/cors'
21
+ require 'json'
22
+ require 'quill-sql'
23
+
24
+ private_key = "pk_yourprivatekeyhere12345"
25
+ database_type = "clickhouse"
26
+ database_connection_string = "https://[username]:[password]@[hostname]:[port]"
27
+
28
+ quill = Quill.new(
29
+ private_key: private_key,
30
+ database_type: database_type,
31
+ database_connection_string: database_connection_string
32
+ )
33
+
34
+ configure do
35
+ enable :cors
36
+ set :allow_origin, '*'
37
+ set :allow_methods, 'GET,POST,OPTIONS'
38
+ set :allow_headers, 'Content-Type, Authorization'
39
+ end
40
+
41
+ post '/quill' do
42
+ content_type :json
43
+ headers 'Access-Control-Allow-Origin' => '*'
44
+ metadata = JSON.parse(request.body.read)['metadata']
45
+ result = quill.query(
46
+ tenants: [metadata['orgId'] || '*'],
47
+ metadata: metadata
48
+ )
49
+ result.to_json
50
+ end
51
+
52
+ options '/quill' do
53
+ response.headers["Allow"] = "GET,POST,OPTIONS"
54
+ response.headers["Access-Control-Allow-Origin"] = "*"
55
+ response.headers["Access-Control-Allow-Headers"] = "Content-Type, Authorization"
56
+ 200
57
+ end
58
+ ```
59
+
60
+ ## For local testing (dev purposes only)
61
+
62
+ Create a `.env` file in your project root with the following key-value pairs:
63
+
64
+ ```
65
+ PRIVATE_KEY=
66
+ DB_TYPE=
67
+ DB_URL=
68
+ ```
69
+
70
+ Use the following commands to start a locally hosted dev server:
71
+
72
+ ```bash
73
+ bundle exec ruby server.rb
74
+ ```
75
+
76
+ You should be able to ping your local server at `http://localhost:3007`.