Class: Gapic::Model::Mixins
- Inherits:
-
Object
- Object
- Gapic::Model::Mixins
- Defined in:
- lib/gapic/model/mixins.rb
Overview
Aggregated information about the mixin services that should be referenced from their gems in the generated client libraries
Defined Under Namespace
Classes: Mixin
Constant Summary collapse
- LRO_SERVICE =
LRO might be specified in the mixins but it is not generated as a mixin
"google.longrunning.Operations"- LOCATIONS_SERVICE =
Locations and Iam are generated as mixins
"google.cloud.location.Locations"- IAM_SERVICE =
"google.iam.v1.IAMPolicy"
Instance Attribute Summary collapse
-
#api_services ⇒ Enumerable<String>
List of services from the Api model.
Instance Method Summary collapse
-
#dependencies ⇒ Hash<String, String>
Aggregated dependencies for the mix-in services.
-
#initialize(api_services, service_config) ⇒ Mixins
constructor
A new instance of Mixins.
-
#mixin_services ⇒ Enumerable<String>
Full proto names of the mix-in services.
-
#mixins ⇒ Enumerable<Mixin>
List of Mixin objects, providing the information that is needed to add the mixin service references to the generated library.
-
#mixins? ⇒ Boolean
Whether there are any mix-in services.
Constructor Details
#initialize(api_services, service_config) ⇒ Mixins
Returns a new instance of Mixins.
39 40 41 42 |
# File 'lib/gapic/model/mixins.rb', line 39 def initialize api_services, service_config @api_services = api_services @service_config = service_config end |
Instance Attribute Details
#api_services ⇒ Enumerable<String>
Returns List of services from the Api model.
32 33 34 |
# File 'lib/gapic/model/mixins.rb', line 32 def api_services @api_services end |
Instance Method Details
#dependencies ⇒ Hash<String, String>
Returns Aggregated dependencies for the mix-in services.
65 66 67 |
# File 'lib/gapic/model/mixins.rb', line 65 def dependencies @dependencies ||= mixins.reduce({}) { |deps, mixin| deps.merge mixin.dependency } end |
#mixin_services ⇒ Enumerable<String>
Returns Full proto names of the mix-in services.
57 58 59 60 61 |
# File 'lib/gapic/model/mixins.rb', line 57 def mixin_services @mixin_services ||= services_in_config.select do |service| service != LRO_SERVICE && !@api_services.include?(service) end end |
#mixins ⇒ Enumerable<Mixin>
Returns List of Mixin objects, providing the information that is needed to add the mixin service references to the generated library.
52 53 54 |
# File 'lib/gapic/model/mixins.rb', line 52 def mixins @mixins ||= mixin_services.map { |service| create_mixin(service) } end |
#mixins? ⇒ Boolean
Returns Whether there are any mix-in services.
45 46 47 |
# File 'lib/gapic/model/mixins.rb', line 45 def mixins? mixin_services.any? end |