kagaribi 0.1.0 → 0.1.1

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: d7009cb11cae6982c8214c7de69349b851ac8b7475959801b48ebb309762a5e6
4
- data.tar.gz: 77887aa0a0f38a9cc1a83177505e78ec3bd4d20a6cf2f37eddae03ddb4f17539
3
+ metadata.gz: 6341d635aacd9883dd113c02dd8d96494a1f7cbc52e727f521fa25210dbc4951
4
+ data.tar.gz: 4cc8aa1c3c4243a403c0a7299313063c20be62eb534b02c8f59a1c1b0f8dea85
5
5
  SHA512:
6
- metadata.gz: f3849fcf52d60d06a23105f2318547bd9a14c49edaa9a9df6cdc28cd08ab1b91b78a533349c68935204a632e86b4b569600209f9cbfb14796f67df0e75fb351d
7
- data.tar.gz: 26c6ee337021f3c5d68a9d622db22cbc3c54e4052eb4e75e4af36d80c616b3f6af5c095cbc87e23ae8d6c8198dbd21171ade05196baec2bc9bcb850ef19c6f1b
6
+ metadata.gz: f91c7d409d479cb25648a2cf873751a9d9c30c009ea4053593802a7eb1a05a4d8d9ba080ec80a666759cc2563ff8fee19431d454876f536db416403abc2ad33e
7
+ data.tar.gz: 04e176fa8b69703742932bde47be84b3c6e969ee8f9c41dc375fb2cda5e134e5201c92065c6c0b1e1a70655d0b48c8b19188144a08c719a95aff2b1b70102149
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  ## [Unreleased]
2
- [full changelog](http://github.com/sue445/kagaribi/compare/v0.1.0...main)
2
+ [full changelog](http://github.com/sue445/kagaribi/compare/v0.1.1...main)
3
+
4
+ ## [0.1.1] - 2024-05-12
5
+ [full changelog](http://github.com/sue445/kagaribi/compare/v0.1.0...v0.1.1)
6
+
7
+ - Add missing rbs
8
+ - https://github.com/sue445/kagaribi/pull/18
3
9
 
4
10
  ## [0.1.0] - 2024-05-11
5
11
 
data/README.md CHANGED
@@ -1,6 +1,7 @@
1
1
  # Kagaribi(篝火) :fire:
2
2
  Simple client for [Cloud Firestore](https://cloud.google.com/firestore)
3
3
 
4
+ [![Gem Version](https://badge.fury.io/rb/kagaribi.svg)](https://badge.fury.io/rb/kagaribi)
4
5
  [![test](https://github.com/sue445/kagaribi/actions/workflows/test.yml/badge.svg)](https://github.com/sue445/kagaribi/actions/workflows/test.yml)
5
6
 
6
7
  ## Installation
@@ -22,13 +23,28 @@ Pass environment variables for Firestore authentication
22
23
 
23
24
  see https://cloud.google.com/ruby/docs/reference/google-cloud-firestore/latest/AUTHENTICATION
24
25
 
26
+ ### Requirements
27
+ Firestore CRUD(Create/Read/Update/Delete) requires at least the following IAM Role
28
+
29
+ * [Cloud Datastore User](https://cloud.google.com/iam/docs/understanding-roles#datastore.user) (`roles/datastore.user`)
30
+
25
31
  ### Simple usage
26
32
  ```ruby
27
33
  require "kagaribi"
28
34
 
29
35
  collection = Kagaribi.collection("users")
30
36
 
37
+ # or
38
+
39
+ class UsersCollection < Kagaribi::Collection
40
+ def initialize
41
+ super("users")
42
+ end
43
+ end
44
+ collection = UsersCollection.new
45
+
31
46
  collection.set("sue445", name: "sue445", url: "https://github.com/sue445")
47
+ #=> document is stored in a key named "users/sue445" to Firestore collection
32
48
 
33
49
  collection.get("sue445")
34
50
  #=> { name: "sue445", url: "https://github.com/sue445" }
@@ -1,24 +1,45 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Kagaribi
4
+ # Manage a Firestore collection
5
+ #
6
+ # @example
7
+ # require "kagaribi"
8
+ #
9
+ # collection = Kagaribi.collection("users")
10
+ #
11
+ # # or
12
+ #
13
+ # class UsersCollection < Kagaribi::Collection
14
+ # def initialize
15
+ # super("users")
16
+ # end
17
+ # end
18
+ # collection = UsersCollection.new
19
+ #
20
+ # collection.set("sue445", name: "sue445", url: "https://github.com/sue445")
21
+ # #=> document is stored in a key named "users/sue445" to Firestore collection
22
+ #
23
+ # collection.get("sue445")
24
+ # #=> { name: "sue445", url: "https://github.com/sue445" }
4
25
  class Collection
5
26
  MAX_RETRY_COUNT = 5
6
27
 
7
28
  # @!attribute [r] collection_name
8
- # @return [String]
29
+ # @return [String]
9
30
  attr_reader :collection_name
10
31
 
11
32
  # @!attribute [r] database_id
12
- # @return [String,nil]
33
+ # @return [String,nil]
13
34
  attr_reader :database_id
14
35
 
15
36
  # @!attribute [r] logger
16
- # @return [Logger]
37
+ # @return [Logger]
17
38
  attr_reader :logger
18
39
 
19
40
  # @param collection_name [String]
20
41
  # @param database_id [String,nil] Identifier for a Firestore database. If not present, the default database of the project is used.
21
- # @param logger [Logger] default is `STDOUT` Logger
42
+ # @param logger [Logger,nil] default is `STDOUT` Logger
22
43
  def initialize(collection_name, database_id: nil, logger: nil)
23
44
  @collection_name = collection_name
24
45
  @database_id = database_id
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Kagaribi
4
- VERSION = "0.1.0"
4
+ VERSION = "0.1.1"
5
5
  end
@@ -13,6 +13,7 @@ module Kagaribi
13
13
 
14
14
  def initialize: (String collection_name, ?database_id: string?, ?logger: Logger?) -> void
15
15
  def set: (String doc_key, Hash[untyped, untyped] data) -> void
16
+ def update: (String doc_key, Hash[untyped, untyped] data) -> void
16
17
  def get: (String doc_key) -> Hash[Symbol, untyped]
17
18
  def exists?: (String doc_key) -> bool
18
19
  def delete: (String doc_key) -> void
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kagaribi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - sue445
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-05-11 00:00:00.000000000 Z
11
+ date: 2024-05-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: google-cloud-firestore