gapic-common 0.0.1 → 0.3.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 +16 -0
 - data/lib/gapic/call_options.rb +9 -1
 - data/lib/gapic/common/version.rb +1 -1
 - data/lib/gapic/config.rb +2 -2
 - data/lib/gapic/grpc/service_stub/rpc_call.rb +1 -1
 - data/lib/gapic/operation.rb +11 -6
 - metadata +27 -7
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 205d234f597f11bdd4853983740b20cc749d8c5f2983a0b80a7bb482c9b9c5ed
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: c32678b8d5094120cf9048ad829a899a15ec0f405188bf06f8f591f3912b7c47
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: f82e408a5e56f9aff64e1a160294029eaed2526b1f1c7fcda9b678d3718f9336cdfaf3fdcbf349953679d120e6d194d463c0173ec9a73f8363d4933ae9137e8f
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 4ed55cc0b72bdb29fb898036f99d9e0b941609d123d0a53a594e4cc0052ca251f12840485c6e6218ba9640779d5cd51fadc1c86ae4ee23bb604eba9ced6c6d63
         
     | 
    
        data/CHANGELOG.md
    CHANGED
    
    | 
         @@ -1,2 +1,18 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            # Release History
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
      
 3 
     | 
    
         
            +
            ### 0.3.0 / 2020-06-18
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            * Update the dependency on google-protobuf to 3.12.2
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
            ### 0.2.1 / 2020-06-02
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
            * Fix a crash when resetting a config field to nil when it has a parent but no default
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
            ### 0.2.0 / 2020-03-17
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
            * Support default call options in Gapic::Operation
         
     | 
| 
      
 14 
     | 
    
         
            +
            * Fix implicit kwarg warnings under Ruby 2.7
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
            ### 0.1.0 / 2020-01-09
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
            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
    
    | 
         @@ -72,7 +72,7 @@ module Gapic 
     | 
|
| 
       72 
72 
     | 
    
         | 
| 
       73 
73 
     | 
    
         
             
                    if instance_variable_defined? :@parent_config
         
     | 
| 
       74 
74 
     | 
    
         
             
                      parent = instance_variable_get :@parent_config
         
     | 
| 
       75 
     | 
    
         
            -
                      return parent. 
     | 
| 
      
 75 
     | 
    
         
            +
                      return parent.__send__ name if parent&.respond_to? name
         
     | 
| 
       76 
76 
     | 
    
         
             
                    end
         
     | 
| 
       77 
77 
     | 
    
         | 
| 
       78 
78 
     | 
    
         
             
                    default
         
     | 
| 
         @@ -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.0 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.3.0
         
     | 
| 
       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:  
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2020-06-19 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
         
     | 
| 
         @@ -92,6 +98,20 @@ dependencies: 
     | 
|
| 
       92 
98 
     | 
    
         
             
                - - "~>"
         
     | 
| 
       93 
99 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       94 
100 
     | 
    
         
             
                    version: '1.25'
         
     | 
| 
      
 101 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 102 
     | 
    
         
            +
              name: google-cloud-core
         
     | 
| 
      
 103 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 104 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 105 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 106 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 107 
     | 
    
         
            +
                    version: '1.5'
         
     | 
| 
      
 108 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 109 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 110 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 111 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 112 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 113 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 114 
     | 
    
         
            +
                    version: '1.5'
         
     | 
| 
       95 
115 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       96 
116 
     | 
    
         
             
              name: google-style
         
     | 
| 
       97 
117 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
         @@ -166,14 +186,14 @@ dependencies: 
     | 
|
| 
       166 
186 
     | 
    
         
             
              name: rake
         
     | 
| 
       167 
187 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       168 
188 
     | 
    
         
             
                requirements:
         
     | 
| 
       169 
     | 
    
         
            -
                - - " 
     | 
| 
      
 189 
     | 
    
         
            +
                - - ">="
         
     | 
| 
       170 
190 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       171 
191 
     | 
    
         
             
                    version: '12.0'
         
     | 
| 
       172 
192 
     | 
    
         
             
              type: :development
         
     | 
| 
       173 
193 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       174 
194 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       175 
195 
     | 
    
         
             
                requirements:
         
     | 
| 
       176 
     | 
    
         
            -
                - - " 
     | 
| 
      
 196 
     | 
    
         
            +
                - - ">="
         
     | 
| 
       177 
197 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       178 
198 
     | 
    
         
             
                    version: '12.0'
         
     | 
| 
       179 
199 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
         @@ -254,7 +274,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       254 
274 
     | 
    
         
             
                - !ruby/object:Gem::Version
         
     | 
| 
       255 
275 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       256 
276 
     | 
    
         
             
            requirements: []
         
     | 
| 
       257 
     | 
    
         
            -
            rubygems_version: 3. 
     | 
| 
      
 277 
     | 
    
         
            +
            rubygems_version: 3.0.3
         
     | 
| 
       258 
278 
     | 
    
         
             
            signing_key: 
         
     | 
| 
       259 
279 
     | 
    
         
             
            specification_version: 4
         
     | 
| 
       260 
280 
     | 
    
         
             
            summary: Common code for GAPIC-generated API clients
         
     |