statelydb 0.5.0 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/statelydb.rb +9 -10
- data/lib/transaction/transaction.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2a1e0f8a92fb069b35013afdfd66b98ba831118a6c61f6825049d25ef892c42b
|
4
|
+
data.tar.gz: 5aae07d1f1e704d7715235ba315d573976245d1237a2ed256127fe0c23828650
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d1bf5854d4726dbdc17782451af7f5e8c52ea63bd7cc9f6cd26bc7f74c6c2af8bd20e2c8a79bf49b6ab66ff9a39f6fee6cdb060b26d3777fcc8a837845b3dda9
|
7
|
+
data.tar.gz: 9b60c991d8fcf38fc3f22b90669a99747ccafa07b22a7779e1175a5f0d4094ac212906f710df415001220029243ddc4fd066c36d3d37e40dcd4d9c8e6f5a5753
|
data/README.md
CHANGED
@@ -29,7 +29,7 @@ gem install statelydb
|
|
29
29
|
Create an authenticated client, then import your item types from your generated schema module and use the client!
|
30
30
|
|
31
31
|
```ruby
|
32
|
-
|
32
|
+
require_relative 'schema/stately'
|
33
33
|
|
34
34
|
def put_my_item
|
35
35
|
# Create a client. This will use the environment variables
|
data/lib/statelydb.rb
CHANGED
@@ -22,25 +22,24 @@ require "token"
|
|
22
22
|
require "uuid"
|
23
23
|
|
24
24
|
module StatelyDB
|
25
|
-
#
|
26
|
-
|
27
|
-
|
25
|
+
# CoreClient is a low level client for interacting with the Stately Cloud API.
|
26
|
+
# This client shouldn't be used directly in most cases. Instead, use the generated
|
27
|
+
# client for your schema.
|
28
|
+
class CoreClient
|
29
|
+
# Initialize a new StatelyDB CoreClient
|
28
30
|
#
|
29
31
|
# @param store_id [Integer] the StatelyDB to use for all operations with this client.
|
30
|
-
# @param schema [Module] the
|
32
|
+
# @param schema [Module] the generated Schema module to use for mapping StatelyDB Items.
|
31
33
|
# @param token_provider [Common::Auth::TokenProvider] the token provider to use for authentication.
|
32
34
|
# @param endpoint [String] the endpoint to connect to.
|
33
35
|
# @param region [String] the region to connect to.
|
34
|
-
def initialize(store_id
|
35
|
-
schema
|
36
|
+
def initialize(store_id:,
|
37
|
+
schema:,
|
36
38
|
token_provider: Common::Auth::Auth0TokenProvider.new,
|
37
39
|
endpoint: nil,
|
38
40
|
region: nil)
|
39
|
-
raise "store_id is required" if store_id.nil?
|
40
|
-
raise "schema is required" if schema.nil?
|
41
41
|
|
42
42
|
endpoint = self.class.make_endpoint(endpoint:, region:)
|
43
|
-
|
44
43
|
channel = Common::Net.new_channel(endpoint:)
|
45
44
|
|
46
45
|
auth_interceptor = Common::Auth::Interceptor.new(token_provider:)
|
@@ -56,7 +55,7 @@ module StatelyDB
|
|
56
55
|
# Set whether to allow stale results for all operations with this client. This produces a new client
|
57
56
|
# with the allow_stale flag set.
|
58
57
|
# @param allow_stale [Boolean] whether to allow stale results
|
59
|
-
# @return [
|
58
|
+
# @return [self] a new client with the allow_stale flag set
|
60
59
|
# @example
|
61
60
|
# client.with_allow_stale(true).get("/ItemType-identifier")
|
62
61
|
def with_allow_stale(allow_stale)
|
@@ -3,7 +3,7 @@
|
|
3
3
|
module StatelyDB
|
4
4
|
module Transaction
|
5
5
|
# Transaction coordinates sending requests and waiting for responses. Consumers should not need
|
6
|
-
# to interact with this class directly, but instead use the methods provided by the StatelyDB::
|
6
|
+
# to interact with this class directly, but instead use the methods provided by the StatelyDB::CoreClient.
|
7
7
|
#
|
8
8
|
# The example below demonstrates using a transaction, which accepts a block. The lines in the block
|
9
9
|
# are executed within the context of the transaction. The transaction is committed when the block
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: statelydb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stately Cloud, Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-10-
|
11
|
+
date: 2024-10-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: async
|