statelydb 0.5.0 → 0.7.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8b27d32c4da703530db30a90682ed114e0c6d51d5c3dc6a686a7ab2bf766998c
4
- data.tar.gz: f5166027a052648eba7dbda0c57b3f6a43803bfda0ab7231228439d11a30cd4c
3
+ metadata.gz: 2a1e0f8a92fb069b35013afdfd66b98ba831118a6c61f6825049d25ef892c42b
4
+ data.tar.gz: 5aae07d1f1e704d7715235ba315d573976245d1237a2ed256127fe0c23828650
5
5
  SHA512:
6
- metadata.gz: 68066039cfd9d52a577e2a1be1b66be66468fb40e12bb98e8a4ef4b02e4b97136c20824efa4a1bbd6cf3a099146a43aa8e44114ac5e1eb2cb5402d583773faf4
7
- data.tar.gz: a1ee650259c49d439f32a72d7ab2161a560c0d0e27eb8c87c7a3b03c255ab369d5bd0ceedf25901234b0a93eaee996221002f1782a4e7ed923a249ba93c0f72b
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
- require 'statelydb'
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
- # Client is a client for interacting with the Stately Cloud API.
26
- class Client
27
- # Initialize a new StatelyDB Client
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 schema module to use for mapping StatelyDB Items.
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: nil,
35
- schema: StatelyDB::Types,
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 [StatelyDB::Client] a new client with the allow_stale flag set
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::Client.
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.5.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-25 00:00:00.000000000 Z
11
+ date: 2024-10-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: async