google-cloud-firestore 2.10.1 → 2.11.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 +4 -4
 - data/CHANGELOG.md +6 -0
 - data/lib/google/cloud/firestore/service.rb +6 -3
 - data/lib/google/cloud/firestore/version.rb +1 -1
 - data/lib/google/cloud/firestore.rb +6 -2
 - data/lib/google-cloud-firestore.rb +28 -4
 - metadata +4 -4
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: c8fe0d4f3e79da21256a4495d0a19da58febfaf27298ea1735fef2042c8c7281
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 10e4929cd461e369991e153356d3878add4b179c972715880734456b566832ca
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 7491e2f8033a2e2033e37e77b16e0401f9ecd77e9e357ecf47c72ab55204df6a7b8aa0a8bdf508d58215c3f6e3818a3ffaa7eebd0cc425e9355fe987df1bc478
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 0f92c886ee8ba0043782aae64166947efd7d5ea1ccd0968fd21fa1bc2e7936f2eba3cb4805853a569d3631e221415fb2649a9c6a5aac101c87cdab1976558472
         
     | 
    
        data/CHANGELOG.md
    CHANGED
    
    
| 
         @@ -34,17 +34,19 @@ module Google 
     | 
|
| 
       34 
34 
     | 
    
         | 
| 
       35 
35 
     | 
    
         
             
                    ##
         
     | 
| 
       36 
36 
     | 
    
         
             
                    # Creates a new Service instance.
         
     | 
| 
       37 
     | 
    
         
            -
                    def initialize project, credentials, host: nil, timeout: nil, database: nil
         
     | 
| 
      
 37 
     | 
    
         
            +
                    def initialize project, credentials, host: nil, timeout: nil, database: nil, transport: :grpc
         
     | 
| 
       38 
38 
     | 
    
         
             
                      @project = project
         
     | 
| 
       39 
39 
     | 
    
         
             
                      @credentials = credentials
         
     | 
| 
       40 
40 
     | 
    
         
             
                      @host = host
         
     | 
| 
       41 
41 
     | 
    
         
             
                      @timeout = timeout
         
     | 
| 
       42 
42 
     | 
    
         
             
                      @database = database
         
     | 
| 
      
 43 
     | 
    
         
            +
                      @transport = transport
         
     | 
| 
       43 
44 
     | 
    
         
             
                    end
         
     | 
| 
       44 
45 
     | 
    
         | 
| 
       45 
46 
     | 
    
         
             
                    def firestore
         
     | 
| 
       46 
     | 
    
         
            -
                      @firestore ||=  
     | 
| 
       47 
     | 
    
         
            -
                        V1::Firestore::Client 
     | 
| 
      
 47 
     | 
    
         
            +
                      @firestore ||= begin
         
     | 
| 
      
 48 
     | 
    
         
            +
                        client_class = @transport == :rest ? V1::Firestore::Rest::Client : V1::Firestore::Client
         
     | 
| 
      
 49 
     | 
    
         
            +
                        client_class.new do |config|
         
     | 
| 
       48 
50 
     | 
    
         
             
                          config.credentials = credentials if credentials
         
     | 
| 
       49 
51 
     | 
    
         
             
                          config.timeout = timeout if timeout
         
     | 
| 
       50 
52 
     | 
    
         
             
                          config.endpoint = host if host
         
     | 
| 
         @@ -52,6 +54,7 @@ module Google 
     | 
|
| 
       52 
54 
     | 
    
         
             
                          config.lib_version = Google::Cloud::Firestore::VERSION
         
     | 
| 
       53 
55 
     | 
    
         
             
                          config.metadata = { "google-cloud-resource-prefix": "projects/#{@project}/databases/#{@database}" }
         
     | 
| 
       54 
56 
     | 
    
         
             
                        end
         
     | 
| 
      
 57 
     | 
    
         
            +
                      end
         
     | 
| 
       55 
58 
     | 
    
         
             
                    end
         
     | 
| 
       56 
59 
     | 
    
         | 
| 
       57 
60 
     | 
    
         
             
                    def get_documents document_paths, mask: nil, transaction: nil, read_time: nil
         
     | 
| 
         @@ -61,6 +61,8 @@ module Google 
     | 
|
| 
       61 
61 
     | 
    
         
             
                  #   If the param is nil, uses the value of the `emulator_host` config.
         
     | 
| 
       62 
62 
     | 
    
         
             
                  # @param [String] database_id Identifier for a Firestore database. If not
         
     | 
| 
       63 
63 
     | 
    
         
             
                  #   present, the default database of the project is used.
         
     | 
| 
      
 64 
     | 
    
         
            +
                  # @param [:grpc,:rest] transport Which transport to use to communicate
         
     | 
| 
      
 65 
     | 
    
         
            +
                  #   with the server. Defaults to `:grpc`.
         
     | 
| 
       64 
66 
     | 
    
         
             
                  # @param [String] project Alias for the `project_id` argument. Deprecated.
         
     | 
| 
       65 
67 
     | 
    
         
             
                  # @param [String] keyfile Alias for the `credentials` argument.
         
     | 
| 
       66 
68 
     | 
    
         
             
                  #   Deprecated.
         
     | 
| 
         @@ -79,6 +81,7 @@ module Google 
     | 
|
| 
       79 
81 
     | 
    
         
             
                               endpoint: nil,
         
     | 
| 
       80 
82 
     | 
    
         
             
                               emulator_host: nil,
         
     | 
| 
       81 
83 
     | 
    
         
             
                               database_id: nil,
         
     | 
| 
      
 84 
     | 
    
         
            +
                               transport: nil,
         
     | 
| 
       82 
85 
     | 
    
         
             
                               project: nil,
         
     | 
| 
       83 
86 
     | 
    
         
             
                               keyfile: nil
         
     | 
| 
       84 
87 
     | 
    
         
             
                    project_id ||= (project || default_project_id)
         
     | 
| 
         @@ -87,13 +90,14 @@ module Google 
     | 
|
| 
       87 
90 
     | 
    
         
             
                    endpoint ||= configure.endpoint
         
     | 
| 
       88 
91 
     | 
    
         
             
                    emulator_host ||= configure.emulator_host
         
     | 
| 
       89 
92 
     | 
    
         
             
                    database_id ||= configure.database_id
         
     | 
| 
      
 93 
     | 
    
         
            +
                    transport ||= configure.transport
         
     | 
| 
       90 
94 
     | 
    
         | 
| 
       91 
95 
     | 
    
         
             
                    if emulator_host
         
     | 
| 
       92 
96 
     | 
    
         
             
                      project_id = project_id.to_s
         
     | 
| 
       93 
97 
     | 
    
         
             
                      raise ArgumentError, "project_id is missing" if project_id.empty?
         
     | 
| 
       94 
98 
     | 
    
         | 
| 
       95 
99 
     | 
    
         
             
                      service = Firestore::Service.new project_id, :this_channel_is_insecure, host: emulator_host,
         
     | 
| 
       96 
     | 
    
         
            -
                                                       timeout: timeout, database: database_id
         
     | 
| 
      
 100 
     | 
    
         
            +
                                                       timeout: timeout, database: database_id, transport: transport
         
     | 
| 
       97 
101 
     | 
    
         
             
                      return Firestore::Client.new service
         
     | 
| 
       98 
102 
     | 
    
         
             
                    end
         
     | 
| 
       99 
103 
     | 
    
         | 
| 
         @@ -109,7 +113,7 @@ module Google 
     | 
|
| 
       109 
113 
     | 
    
         
             
                    raise ArgumentError, "project_id is missing" if project_id.empty?
         
     | 
| 
       110 
114 
     | 
    
         | 
| 
       111 
115 
     | 
    
         
             
                    service = Firestore::Service.new project_id, credentials, host: endpoint,
         
     | 
| 
       112 
     | 
    
         
            -
                                                     timeout: timeout, database: database_id
         
     | 
| 
      
 116 
     | 
    
         
            +
                                                     timeout: timeout, database: database_id, transport: transport
         
     | 
| 
       113 
117 
     | 
    
         
             
                    Firestore::Client.new service
         
     | 
| 
       114 
118 
     | 
    
         
             
                  end
         
     | 
| 
       115 
119 
     | 
    
         | 
| 
         @@ -44,6 +44,8 @@ module Google 
     | 
|
| 
       44 
44 
     | 
    
         
             
                # @param [Integer] timeout Default timeout to use in requests. Optional.
         
     | 
| 
       45 
45 
     | 
    
         
             
                # @param [String] database_id Identifier for a Firestore database. If not
         
     | 
| 
       46 
46 
     | 
    
         
             
                #   present, the default database of the project is used.
         
     | 
| 
      
 47 
     | 
    
         
            +
                # @param [:grpc,:rest] transport Which transport to use to communicate
         
     | 
| 
      
 48 
     | 
    
         
            +
                #   with the server. Defaults to `:grpc`.
         
     | 
| 
       47 
49 
     | 
    
         
             
                #
         
     | 
| 
       48 
50 
     | 
    
         
             
                # @return [Google::Cloud::Firestore::Client]
         
     | 
| 
       49 
51 
     | 
    
         
             
                #
         
     | 
| 
         @@ -67,8 +69,16 @@ module Google 
     | 
|
| 
       67 
69 
     | 
    
         
             
                #   database_id = "my-todo-database"
         
     | 
| 
       68 
70 
     | 
    
         
             
                #   firestore = gcloud.firestore database_id: database_id
         
     | 
| 
       69 
71 
     | 
    
         
             
                #
         
     | 
| 
       70 
     | 
    
         
            -
                def firestore scope: nil, 
     | 
| 
       71 
     | 
    
         
            -
             
     | 
| 
      
 72 
     | 
    
         
            +
                def firestore scope: nil,
         
     | 
| 
      
 73 
     | 
    
         
            +
                              timeout: nil,
         
     | 
| 
      
 74 
     | 
    
         
            +
                              database_id: nil,
         
     | 
| 
      
 75 
     | 
    
         
            +
                              transport: nil
         
     | 
| 
      
 76 
     | 
    
         
            +
                  transport ||= Google::Cloud.configure.firestore.transport
         
     | 
| 
      
 77 
     | 
    
         
            +
                  Google::Cloud.firestore @project, @keyfile,
         
     | 
| 
      
 78 
     | 
    
         
            +
                                          scope: scope,
         
     | 
| 
      
 79 
     | 
    
         
            +
                                          timeout: (timeout || @timeout),
         
     | 
| 
      
 80 
     | 
    
         
            +
                                          database_id: database_id,
         
     | 
| 
      
 81 
     | 
    
         
            +
                                          transport: transport
         
     | 
| 
       72 
82 
     | 
    
         
             
                end
         
     | 
| 
       73 
83 
     | 
    
         | 
| 
       74 
84 
     | 
    
         
             
                ##
         
     | 
| 
         @@ -94,6 +104,8 @@ module Google 
     | 
|
| 
       94 
104 
     | 
    
         
             
                # @param [Integer] timeout Default timeout to use in requests. Optional.
         
     | 
| 
       95 
105 
     | 
    
         
             
                # @param [String] database_id Identifier for a Firestore database. If not
         
     | 
| 
       96 
106 
     | 
    
         
             
                #   present, the default database of the project is used.
         
     | 
| 
      
 107 
     | 
    
         
            +
                # @param [:grpc,:rest] transport Which transport to use to communicate
         
     | 
| 
      
 108 
     | 
    
         
            +
                #   with the server. Defaults to `:grpc`.
         
     | 
| 
       97 
109 
     | 
    
         
             
                #
         
     | 
| 
       98 
110 
     | 
    
         
             
                # @return [Google::Cloud::Firestore::Client]
         
     | 
| 
       99 
111 
     | 
    
         
             
                #
         
     | 
| 
         @@ -102,17 +114,26 @@ module Google 
     | 
|
| 
       102 
114 
     | 
    
         
             
                #
         
     | 
| 
       103 
115 
     | 
    
         
             
                #   firestore = Google::Cloud.firestore
         
     | 
| 
       104 
116 
     | 
    
         
             
                #
         
     | 
| 
       105 
     | 
    
         
            -
                def self.firestore project_id = nil, 
     | 
| 
      
 117 
     | 
    
         
            +
                def self.firestore project_id = nil,
         
     | 
| 
      
 118 
     | 
    
         
            +
                                   credentials = nil,
         
     | 
| 
      
 119 
     | 
    
         
            +
                                   scope: nil,
         
     | 
| 
      
 120 
     | 
    
         
            +
                                   timeout: nil,
         
     | 
| 
      
 121 
     | 
    
         
            +
                                   database_id: nil,
         
     | 
| 
      
 122 
     | 
    
         
            +
                                   transport: nil
         
     | 
| 
       106 
123 
     | 
    
         
             
                  require "google/cloud/firestore"
         
     | 
| 
      
 124 
     | 
    
         
            +
                  transport ||= Google::Cloud.configure.firestore.transport
         
     | 
| 
       107 
125 
     | 
    
         
             
                  Google::Cloud::Firestore.new project_id: project_id,
         
     | 
| 
       108 
126 
     | 
    
         
             
                                               credentials: credentials,
         
     | 
| 
       109 
127 
     | 
    
         
             
                                               scope: scope,
         
     | 
| 
       110 
128 
     | 
    
         
             
                                               timeout: timeout,
         
     | 
| 
       111 
     | 
    
         
            -
                                               database_id: database_id
         
     | 
| 
      
 129 
     | 
    
         
            +
                                               database_id: database_id,
         
     | 
| 
      
 130 
     | 
    
         
            +
                                               transport: transport
         
     | 
| 
       112 
131 
     | 
    
         
             
                end
         
     | 
| 
       113 
132 
     | 
    
         
             
              end
         
     | 
| 
       114 
133 
     | 
    
         
             
            end
         
     | 
| 
       115 
134 
     | 
    
         | 
| 
      
 135 
     | 
    
         
            +
            # rubocop:disable Metrics/BlockLength
         
     | 
| 
      
 136 
     | 
    
         
            +
             
     | 
| 
       116 
137 
     | 
    
         
             
            # Set the default firestore configuration
         
     | 
| 
       117 
138 
     | 
    
         
             
            Google::Cloud.configure.add_config! :firestore do |config|
         
     | 
| 
       118 
139 
     | 
    
         
             
              default_project = Google::Cloud::Config.deferred do
         
     | 
| 
         @@ -141,4 +162,7 @@ Google::Cloud.configure.add_config! :firestore do |config| 
     | 
|
| 
       141 
162 
     | 
    
         
             
              config.add_field! :emulator_host, default_emulator, match: String, allow_nil: true
         
     | 
| 
       142 
163 
     | 
    
         
             
              config.add_field! :endpoint, "firestore.googleapis.com", match: String
         
     | 
| 
       143 
164 
     | 
    
         
             
              config.add_field! :database_id, "(default)", match: String
         
     | 
| 
      
 165 
     | 
    
         
            +
              config.add_field! :transport, :grpc, match: Symbol
         
     | 
| 
       144 
166 
     | 
    
         
             
            end
         
     | 
| 
      
 167 
     | 
    
         
            +
             
     | 
| 
      
 168 
     | 
    
         
            +
            # rubocop:enable Metrics/BlockLength
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: google-cloud-firestore
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 2. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 2.11.0
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Google Inc
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2023-02- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2023-02-23 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: google-cloud-core
         
     | 
| 
         @@ -30,14 +30,14 @@ dependencies: 
     | 
|
| 
       30 
30 
     | 
    
         
             
                requirements:
         
     | 
| 
       31 
31 
     | 
    
         
             
                - - "~>"
         
     | 
| 
       32 
32 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       33 
     | 
    
         
            -
                    version: '0. 
     | 
| 
      
 33 
     | 
    
         
            +
                    version: '0.10'
         
     | 
| 
       34 
34 
     | 
    
         
             
              type: :runtime
         
     | 
| 
       35 
35 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       36 
36 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       37 
37 
     | 
    
         
             
                requirements:
         
     | 
| 
       38 
38 
     | 
    
         
             
                - - "~>"
         
     | 
| 
       39 
39 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       40 
     | 
    
         
            -
                    version: '0. 
     | 
| 
      
 40 
     | 
    
         
            +
                    version: '0.10'
         
     | 
| 
       41 
41 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       42 
42 
     | 
    
         
             
              name: concurrent-ruby
         
     | 
| 
       43 
43 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     |