statelydb 0.5.0 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8b27d32c4da703530db30a90682ed114e0c6d51d5c3dc6a686a7ab2bf766998c
4
- data.tar.gz: f5166027a052648eba7dbda0c57b3f6a43803bfda0ab7231228439d11a30cd4c
3
+ metadata.gz: 0eb53c16c6251cf93076f780e932541700ccb6f023b98062441d8e6b2befebe1
4
+ data.tar.gz: 1cc3cde2aeceb6bb8a63e69289edea027e14870b4d53bad321ca40994c7d61e3
5
5
  SHA512:
6
- metadata.gz: 68066039cfd9d52a577e2a1be1b66be66468fb40e12bb98e8a4ef4b02e4b97136c20824efa4a1bbd6cf3a099146a43aa8e44114ac5e1eb2cb5402d583773faf4
7
- data.tar.gz: a1ee650259c49d439f32a72d7ab2161a560c0d0e27eb8c87c7a3b03c255ab369d5bd0ceedf25901234b0a93eaee996221002f1782a4e7ed923a249ba93c0f72b
6
+ metadata.gz: d6854cd8d7f966eb921edb9ab13202ca886e4e28a17c6d02cf0ac1bc9958491bb2d85a8e67a7a6e05b0bdc352135776ec9d371b98cce8ec570bf36ff7678c757
7
+ data.tar.gz: 5665372c41462b6cea5fe2a830f7a22150010a42754a0ad06dc2848de06c397b2a901e703305a3644b70608d17e619876f2b133141aefd3cc0c53d89e4f732c5
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.item_types'
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.6.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-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: async