Class: Gapic::Schema::Service
- Extended by:
- Forwardable
- Defined in:
- lib/gapic/schema/wrappers.rb
Overview
Wrapper for a protobuf service.
Instance Attribute Summary collapse
-
#methods ⇒ Object
readonly
@ return [Enumerable
] The methods of this service.
Attributes inherited from Proto
#address, #descriptor, #docs, #parent
Instance Method Summary collapse
-
#full_name ⇒ String
The full name for this service (e.g.
google.example.Service). -
#host ⇒ String
The hostname for this service (e.g. "foo.googleapis.com").
-
#initialize(descriptor, address, docs, methods) ⇒ Service
constructor
Initializes a Service object.
-
#is_deprecated? ⇒ Boolean
otherwise.
-
#name ⇒ String
The unqualified name of the service.
-
#options ⇒ Google::Protobuf::ServiceOptions
The options of this service.
-
#resources ⇒ Array<Google::Api::ResourceDescriptor>
A representation of the resource.
-
#ruby_package ⇒ String
Ruby Package.
-
#scopes ⇒ Array<String>
The OAuth scopes information for the client.
Methods inherited from Proto
#containing_api, #containing_file, #docs_leading_comments, #leading_comments, #leading_detached_comments, #path, #span, #trailing_comments
Constructor Details
#initialize(descriptor, address, docs, methods) ⇒ Service
Initializes a Service object.
246 247 248 249 250 |
# File 'lib/gapic/schema/wrappers.rb', line 246 def initialize descriptor, address, docs, methods super descriptor, address, docs @methods = methods || [] @methods.each { |m| m.parent = self } end |
Instance Attribute Details
#methods ⇒ Object (readonly)
@ return [Enumerable
233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 |
# File 'lib/gapic/schema/wrappers.rb', line 233 class Service < Proto extend Forwardable attr_reader :methods # Initializes a Service object. # @param descriptor [Google::Protobuf::ServiceDescriptorProto] the # protobuf representation of this service. # @param address [Enumerable<String>] The address of the proto. See # #address for more info. # @param docs [Google::Protobuf::SourceCodeInfo::Location] The docs # of the proto. See #docs for more info. # @param methods [Enumerable<Method>] The methods of this service. def initialize descriptor, address, docs, methods super descriptor, address, docs @methods = methods || [] @methods.each { |m| m.parent = self } end # @return [String] The hostname for this service # (e.g. "foo.googleapis.com"). This should be specified with no # prefix. def host [:".google.api.default_host"] if end # @return [Array<String>] The OAuth scopes information for the client. def scopes String([:".google.api.oauth_scopes"]).split "," if end # @return [String] Ruby Package def ruby_package return nil if parent.nil? parent.ruby_package end # @return [Boolean] True if this service is marked as deprecated, false # otherwise. def is_deprecated? [:deprecated] if end # @return [Array<Google::Api::ResourceDescriptor>] A representation of the resource. # This is generally intended to be attached to the "name" field. # See `google/api/resource.proto`. def resources require "gapic/resource_lookup" @resources ||= Gapic::ResourceLookup.for_service self end # @return [String] The full name for this service # (e.g. `google.example.Service`). # Useful when matching against other pieces of information # which also reference full proto name, e.g. Service Config # or Grpc Service Config def full_name @address.join "." end # @!method name # @return [String] the unqualified name of the service. # @!method options # @return [Google::Protobuf::ServiceOptions] the options of this # service. def_delegators( :descriptor, :name, :options ) end |
Instance Method Details
#full_name ⇒ String
Returns The full name for this service
(e.g. google.example.Service).
Useful when matching against other pieces of information
which also reference full proto name, e.g. Service Config
or Grpc Service Config.
291 292 293 |
# File 'lib/gapic/schema/wrappers.rb', line 291 def full_name @address.join "." end |
#host ⇒ String
Returns The hostname for this service (e.g. "foo.googleapis.com"). This should be specified with no prefix.
255 256 257 |
# File 'lib/gapic/schema/wrappers.rb', line 255 def host [:".google.api.default_host"] if end |
#is_deprecated? ⇒ Boolean
otherwise.
273 274 275 |
# File 'lib/gapic/schema/wrappers.rb', line 273 def is_deprecated? [:deprecated] if end |
#name ⇒ String
Returns the unqualified name of the service.
300 301 302 303 304 |
# File 'lib/gapic/schema/wrappers.rb', line 300 def_delegators( :descriptor, :name, :options ) |
#options ⇒ Google::Protobuf::ServiceOptions
Returns the options of this service.
300 301 302 303 304 |
# File 'lib/gapic/schema/wrappers.rb', line 300 def_delegators( :descriptor, :name, :options ) |
#resources ⇒ Array<Google::Api::ResourceDescriptor>
Returns A representation of the resource.
This is generally intended to be attached to the "name" field.
See google/api/resource.proto.
280 281 282 283 284 |
# File 'lib/gapic/schema/wrappers.rb', line 280 def resources require "gapic/resource_lookup" @resources ||= Gapic::ResourceLookup.for_service self end |
#ruby_package ⇒ String
Returns Ruby Package.
265 266 267 268 269 |
# File 'lib/gapic/schema/wrappers.rb', line 265 def ruby_package return nil if parent.nil? parent.ruby_package end |
#scopes ⇒ Array<String>
Returns The OAuth scopes information for the client.
260 261 262 |
# File 'lib/gapic/schema/wrappers.rb', line 260 def scopes String([:".google.api.oauth_scopes"]).split "," if end |