gapic-common 0.1.0 → 0.3.2
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 +21 -0
 - data/lib/gapic/call_options.rb +9 -1
 - data/lib/gapic/common/version.rb +1 -1
 - data/lib/gapic/config.rb +1 -1
 - data/lib/gapic/grpc/service_stub/rpc_call.rb +1 -1
 - data/lib/gapic/operation.rb +11 -6
 - data/lib/gapic/paged_enumerable.rb +1 -0
 - metadata +13 -7
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: eb1fde9489ba4700abd83cbf1a7fea7aab2ed2f844da5ac2070b8c73fe6bf0d8
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: bf9a3bce0b7d5c31edf806baceb5e228318ea3656a84c2a6e8b00bf11acbeee2
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 281a1e48c10da144d2494e566468849299cf24639ca6119428cea669080c7ff435b758383b2ecf1173edd774c765d69a017f347b1e4ad49373b0c9d2925c2834
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: b33835a789ff87319ccb7ef8c448de8cadd44a8c44cf2c52f9553f7ceeea6d9b4715dcd19a1723cf9085d32b5be69dec0e2a46d39755aff0a795e6b030332339
         
     | 
    
        data/CHANGELOG.md
    CHANGED
    
    | 
         @@ -1,5 +1,26 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            # Release History
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
      
 3 
     | 
    
         
            +
            ### 0.3.2 / 2020-07-30
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            * Alias PagedEnumerable#next_page to PagedEnumerable#next_page!
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
            ### 0.3.1 / 2020-06-19
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
            * Fix file permissions
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
            ### 0.3.0 / 2020-06-18
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
            * Update the dependency on google-protobuf to 3.12.2
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
            ### 0.2.1 / 2020-06-02
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
            * Fix a crash when resetting a config field to nil when it has a parent but no default
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
            ### 0.2.0 / 2020-03-17
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
            * Support default call options in Gapic::Operation
         
     | 
| 
      
 22 
     | 
    
         
            +
            * Fix implicit kwarg warnings under Ruby 2.7
         
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
       3 
24 
     | 
    
         
             
            ### 0.1.0 / 2020-01-09
         
     | 
| 
       4 
25 
     | 
    
         | 
| 
       5 
26 
     | 
    
         
             
            Initial release
         
     | 
    
        data/lib/gapic/call_options.rb
    CHANGED
    
    | 
         @@ -42,7 +42,7 @@ module Gapic 
     | 
|
| 
       42 
42 
     | 
    
         
             
                #
         
     | 
| 
       43 
43 
     | 
    
         
             
                def initialize timeout: nil, metadata: nil, retry_policy: nil
         
     | 
| 
       44 
44 
     | 
    
         
             
                  # Converts hash and nil to a policy object
         
     | 
| 
       45 
     | 
    
         
            -
                  retry_policy = RetryPolicy.new 
     | 
| 
      
 45 
     | 
    
         
            +
                  retry_policy = RetryPolicy.new(**retry_policy.to_h) if retry_policy.respond_to? :to_h
         
     | 
| 
       46 
46 
     | 
    
         | 
| 
       47 
47 
     | 
    
         
             
                  @timeout = timeout # allow to be nil so it can be overridden
         
     | 
| 
       48 
48 
     | 
    
         
             
                  @metadata = metadata.to_h # Ensure always hash, even for nil
         
     | 
| 
         @@ -64,5 +64,13 @@ module Gapic 
     | 
|
| 
       64 
64 
     | 
    
         
             
                  @metadata = metadata.merge @metadata if metadata
         
     | 
| 
       65 
65 
     | 
    
         
             
                  @retry_policy.apply_defaults retry_policy if @retry_policy.respond_to? :apply_defaults
         
     | 
| 
       66 
66 
     | 
    
         
             
                end
         
     | 
| 
      
 67 
     | 
    
         
            +
             
     | 
| 
      
 68 
     | 
    
         
            +
                def to_h
         
     | 
| 
      
 69 
     | 
    
         
            +
                  {
         
     | 
| 
      
 70 
     | 
    
         
            +
                    timeout:      timeout,
         
     | 
| 
      
 71 
     | 
    
         
            +
                    metadata:     metadata,
         
     | 
| 
      
 72 
     | 
    
         
            +
                    retry_policy: retry_policy
         
     | 
| 
      
 73 
     | 
    
         
            +
                  }
         
     | 
| 
      
 74 
     | 
    
         
            +
                end
         
     | 
| 
       67 
75 
     | 
    
         
             
              end
         
     | 
| 
       68 
76 
     | 
    
         
             
            end
         
     | 
    
        data/lib/gapic/common/version.rb
    CHANGED
    
    
    
        data/lib/gapic/config.rb
    CHANGED
    
    | 
         @@ -88,7 +88,7 @@ module Gapic 
     | 
|
| 
       88 
88 
     | 
    
         
             
                      valid_value ||= begin
         
     | 
| 
       89 
89 
     | 
    
         
             
                        # Allow nil if parent config has the getter method.
         
     | 
| 
       90 
90 
     | 
    
         
             
                        parent = instance_variable_get :@parent_config if instance_variable_defined? :@parent_config
         
     | 
| 
       91 
     | 
    
         
            -
                        parent&.respond_to?  
     | 
| 
      
 91 
     | 
    
         
            +
                        parent&.respond_to? name_setter
         
     | 
| 
       92 
92 
     | 
    
         
             
                      end
         
     | 
| 
       93 
93 
     | 
    
         
             
                    end
         
     | 
| 
       94 
94 
     | 
    
         
             
                    raise ArgumentError unless valid_value
         
     | 
| 
         @@ -112,7 +112,7 @@ module Gapic 
     | 
|
| 
       112 
112 
     | 
    
         
             
                  #
         
     | 
| 
       113 
113 
     | 
    
         
             
                  def call request, options: nil
         
     | 
| 
       114 
114 
     | 
    
         
             
                    # Converts hash and nil to an options object
         
     | 
| 
       115 
     | 
    
         
            -
                    options = Gapic::CallOptions.new 
     | 
| 
      
 115 
     | 
    
         
            +
                    options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
         
     | 
| 
       116 
116 
     | 
    
         
             
                    deadline = calculate_deadline options
         
     | 
| 
       117 
117 
     | 
    
         
             
                    metadata = options.metadata
         
     | 
| 
       118 
118 
     | 
    
         | 
    
        data/lib/gapic/operation.rb
    CHANGED
    
    | 
         @@ -83,13 +83,15 @@ module Gapic 
     | 
|
| 
       83 
83 
     | 
    
         
             
                #   looked up. Optional.
         
     | 
| 
       84 
84 
     | 
    
         
             
                # @param metadata_type [Class] The class type to be unpacked from the metadata. If not provided the class type
         
     | 
| 
       85 
85 
     | 
    
         
             
                #   will be looked up. Optional.
         
     | 
| 
      
 86 
     | 
    
         
            +
                # @param options [Gapic::CallOptions] call options for this operation
         
     | 
| 
       86 
87 
     | 
    
         
             
                #
         
     | 
| 
       87 
     | 
    
         
            -
                def initialize grpc_op, client, result_type: nil, metadata_type: nil
         
     | 
| 
      
 88 
     | 
    
         
            +
                def initialize grpc_op, client, result_type: nil, metadata_type: nil, options: {}
         
     | 
| 
       88 
89 
     | 
    
         
             
                  @grpc_op = grpc_op
         
     | 
| 
       89 
90 
     | 
    
         
             
                  @client = client
         
     | 
| 
       90 
91 
     | 
    
         
             
                  @result_type = result_type
         
     | 
| 
       91 
92 
     | 
    
         
             
                  @metadata_type = metadata_type
         
     | 
| 
       92 
93 
     | 
    
         
             
                  @on_done_callbacks = []
         
     | 
| 
      
 94 
     | 
    
         
            +
                  @options = options
         
     | 
| 
       93 
95 
     | 
    
         
             
                end
         
     | 
| 
       94 
96 
     | 
    
         | 
| 
       95 
97 
     | 
    
         
             
                ##
         
     | 
| 
         @@ -196,7 +198,7 @@ module Gapic 
     | 
|
| 
       196 
198 
     | 
    
         
             
                #
         
     | 
| 
       197 
199 
     | 
    
         
             
                def cancel options: nil
         
     | 
| 
       198 
200 
     | 
    
         
             
                  # Converts hash and nil to an options object
         
     | 
| 
       199 
     | 
    
         
            -
                  options = Gapic::CallOptions.new 
     | 
| 
      
 201 
     | 
    
         
            +
                  options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
         
     | 
| 
       200 
202 
     | 
    
         | 
| 
       201 
203 
     | 
    
         
             
                  @client.cancel_operation({ name: @grpc_op.name }, options)
         
     | 
| 
       202 
204 
     | 
    
         
             
                end
         
     | 
| 
         @@ -209,7 +211,7 @@ module Gapic 
     | 
|
| 
       209 
211 
     | 
    
         
             
                #
         
     | 
| 
       210 
212 
     | 
    
         
             
                def delete options: nil
         
     | 
| 
       211 
213 
     | 
    
         
             
                  # Converts hash and nil to an options object
         
     | 
| 
       212 
     | 
    
         
            -
                  options = Gapic::CallOptions.new 
     | 
| 
      
 214 
     | 
    
         
            +
                  options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
         
     | 
| 
       213 
215 
     | 
    
         | 
| 
       214 
216 
     | 
    
         
             
                  @client.delete_operation({ name: @grpc_op.name }, options)
         
     | 
| 
       215 
217 
     | 
    
         
             
                end
         
     | 
| 
         @@ -223,9 +225,12 @@ module Gapic 
     | 
|
| 
       223 
225 
     | 
    
         
             
                # @return [Gapic::Operation] Since this method changes internal state, it returns itself.
         
     | 
| 
       224 
226 
     | 
    
         
             
                #
         
     | 
| 
       225 
227 
     | 
    
         
             
                def reload! options: nil
         
     | 
| 
       226 
     | 
    
         
            -
                   
     | 
| 
       227 
     | 
    
         
            -
             
     | 
| 
       228 
     | 
    
         
            -
             
     | 
| 
      
 228 
     | 
    
         
            +
                  options = if options.respond_to? :to_h
         
     | 
| 
      
 229 
     | 
    
         
            +
                              options.to_h.merge @options.to_h
         
     | 
| 
      
 230 
     | 
    
         
            +
                            else
         
     | 
| 
      
 231 
     | 
    
         
            +
                              @options.to_h
         
     | 
| 
      
 232 
     | 
    
         
            +
                            end
         
     | 
| 
      
 233 
     | 
    
         
            +
                  options = Gapic::CallOptions.new(**options)
         
     | 
| 
       229 
234 
     | 
    
         
             
                  gax_op = @client.get_operation({ name: @grpc_op.name }, options)
         
     | 
| 
       230 
235 
     | 
    
         
             
                  @grpc_op = gax_op.grpc_op
         
     | 
| 
       231 
236 
     | 
    
         | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: gapic-common
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.3.2
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Google API Authors
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2020- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2020-07-30 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: google-protobuf
         
     | 
| 
         @@ -16,14 +16,20 @@ dependencies: 
     | 
|
| 
       16 
16 
     | 
    
         
             
                requirements:
         
     | 
| 
       17 
17 
     | 
    
         
             
                - - "~>"
         
     | 
| 
       18 
18 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       19 
     | 
    
         
            -
                    version: '3. 
     | 
| 
      
 19 
     | 
    
         
            +
                    version: '3.12'
         
     | 
| 
      
 20 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 21 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 22 
     | 
    
         
            +
                    version: 3.12.2
         
     | 
| 
       20 
23 
     | 
    
         
             
              type: :runtime
         
     | 
| 
       21 
24 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       22 
25 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       23 
26 
     | 
    
         
             
                requirements:
         
     | 
| 
       24 
27 
     | 
    
         
             
                - - "~>"
         
     | 
| 
       25 
28 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       26 
     | 
    
         
            -
                    version: '3. 
     | 
| 
      
 29 
     | 
    
         
            +
                    version: '3.12'
         
     | 
| 
      
 30 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 31 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 32 
     | 
    
         
            +
                    version: 3.12.2
         
     | 
| 
       27 
33 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       28 
34 
     | 
    
         
             
              name: googleapis-common-protos
         
     | 
| 
       29 
35 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
         @@ -180,14 +186,14 @@ dependencies: 
     | 
|
| 
       180 
186 
     | 
    
         
             
              name: rake
         
     | 
| 
       181 
187 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       182 
188 
     | 
    
         
             
                requirements:
         
     | 
| 
       183 
     | 
    
         
            -
                - - " 
     | 
| 
      
 189 
     | 
    
         
            +
                - - ">="
         
     | 
| 
       184 
190 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       185 
191 
     | 
    
         
             
                    version: '12.0'
         
     | 
| 
       186 
192 
     | 
    
         
             
              type: :development
         
     | 
| 
       187 
193 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       188 
194 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       189 
195 
     | 
    
         
             
                requirements:
         
     | 
| 
       190 
     | 
    
         
            -
                - - " 
     | 
| 
      
 196 
     | 
    
         
            +
                - - ">="
         
     | 
| 
       191 
197 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       192 
198 
     | 
    
         
             
                    version: '12.0'
         
     | 
| 
       193 
199 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
         @@ -268,7 +274,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       268 
274 
     | 
    
         
             
                - !ruby/object:Gem::Version
         
     | 
| 
       269 
275 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       270 
276 
     | 
    
         
             
            requirements: []
         
     | 
| 
       271 
     | 
    
         
            -
            rubygems_version: 3. 
     | 
| 
      
 277 
     | 
    
         
            +
            rubygems_version: 3.0.3
         
     | 
| 
       272 
278 
     | 
    
         
             
            signing_key: 
         
     | 
| 
       273 
279 
     | 
    
         
             
            specification_version: 4
         
     | 
| 
       274 
280 
     | 
    
         
             
            summary: Common code for GAPIC-generated API clients
         
     |